LoginSignup
1
1

More than 3 years have passed since last update.

Releaseビルドをデバッグしたい

Last updated at Posted at 2020-12-19

R8で難読化されたアプリがクラッシュするのでその調査のために
次の手順でReleaseビルドをデバッグ実行する。

Android Studio 4.1 にて "Ganarate signed Budle or APK" で作成した
keystore ファイルを使って module の build.gradle に下記のような設定を行う。

...
android {
...
    signingConfigs {
        local_release {
            storeFile file('LocalRelease.jks')
            storePassword 'password'
            keyAlias 'alias'
            keyPassword 'keypassword'
        }
    }
...
    defaultConfig {
        applicationId "jp.co.xxxx.hogehoge"
        minSdkVersion xx
        targetSdkVersion xx
        versionCode x
        versionName "x.x.x"
...
        signingConfig signingConfigs.local_release
    }
...
    buildTypes {
        release {
            // リリースビルドでのデバッグ許可
            debuggable true
            // リソースの圧縮
            shrinkResources true
            // コードの縮小、難読化、および最適化
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
...

デバッグ実行できるようになる。

ちなみに上記設定だと難読化が有効になっているので
Logcatのエラーログと下記のマッピングファイルを照らし合わせる。

...
java.lang.NullPointerException: Parameter specified as non-null is null: method i.w.d.i.e, parameter $this$toMutableList
...

こういう感じでパッケージやクラス名などが難読化される。

/app/build/outputs/mapping/developRelease/mapping.txt

mapping.txt に実際のクラスなどとのマッピング情報が記載されている。

以上。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1