Android 前进线编号问题
我和proguard有一个棘手的问题。 在我的Android 前进线编号问题,android,proguard,Android,Proguard,我和proguard有一个棘手的问题。 在我的proguard rules.pro中,我已经设置了保留行号: # Keep line numbers -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable 在我的build.gradle中,我打开了minifyEnable,debug和release: buildTypes { debug { min
proguard rules.pro
中,我已经设置了保留行号:
# Keep line numbers
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
在我的build.gradle
中,我打开了minifyEnable
,debug
和release
:
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'google-api-client.pro'
signingConfig signingConfigs.debug
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'google-api-client.pro'
signingConfig signingConfigs.release
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
}
但是当我遇到崩溃时,调试输出行号是正确的,但是发布行号是错误的。以下是使用minifyEnable
进行调试的日志,行号正确:
java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference
at com.frontrow.vlog.ui.personalpage.PersonalPageFragment.musicClicked(SourceFile:952) // The line number is the right position at my source code.
at com.frontrow.vlog.ui.personalpage.PersonalPageFragment_ViewBinding$e.a(SourceFile:244)
at butterknife.internal.b.onClick(SourceFile:18)
但是,在使用minifyEnable
的版本中,行号不正确是错误的:
java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference
at com.frontrow.vlog.ui.personalpage.PersonalPageFragment.musicClicked(SourceFile:1) // The line number is error.
at com.frontrow.vlog.ui.personalpage.PersonalPageFragment_ViewBinding$e.a(SourceFile:1)
at butterknife.internal.b.onClick(SourceFile:4)
我怎样才能解决这个问题,使发布输出可以采用正确的行号?好吧,我想这就是R8的问题。 我在
gradle.properties
中设置了android.enableR8=false
,行号正确。
gradle版本似乎大于3.4.0
默认情况下将打开r8