Verified
Status Update
Comments
js...@google.com <js...@google.com>
mk...@google.com <mk...@google.com> #2
Thank you for creating an issue. Looks like there may be a problem with the input.
If you are using R8 from source, which it looks like since you have a non-obfuscated stack trace, can you then place a break-point at:
com.android.tools.r8.naming.ProguardMapMinifier:489
and report what the reservedName, reference and definition is. Then we will be able to back-track from there.
You can attach the debugger to the gradle compilation by invoking the following command from the terminal:
./gradlew clean transformClassesAndResourcesWithR8ForReleaseAndroidTest --info --stacktrace -Dorg.gradle.debug=true --no-daemon --stacktrace
(you may have to change the name of the task)
Also, can I ask you to enable assertions in you build to see if there are any other problems we are not aware of. You can do it by modifying gradle.properties and extend the org.gradle.jvmargs with -ea:com.android.tools.r8...
You can also share you project if that is possible - that would allow me to find out why the definition is null.
If you are using R8 from source, which it looks like since you have a non-obfuscated stack trace, can you then place a break-point at:
com.android.tools.r8.naming.ProguardMapMinifier:489
and report what the reservedName, reference and definition is. Then we will be able to back-track from there.
You can attach the debugger to the gradle compilation by invoking the following command from the terminal:
./gradlew clean transformClassesAndResourcesWithR8ForReleaseAndroidTest --info --stacktrace -Dorg.gradle.debug=true --no-daemon --stacktrace
(you may have to change the name of the task)
Also, can I ask you to enable assertions in you build to see if there are any other problems we are not aware of. You can do it by modifying gradle.properties and extend the org.gradle.jvmargs with -ea:com.android.tools.r8...
You can also share you project if that is possible - that would allow me to find out why the definition is null.
ra...@9gag.com <ra...@9gag.com> #3
I am not using R8 from source, could you advise how can I do that? Which debugger / dev tools should I use as I am not familiar with it.
And btw, it seems I cannot solely execute transformClassesAndResourcesWithR8ForAppReleaseAndroidTest, it said task not found
And btw, it seems I cannot solely execute transformClassesAndResourcesWithR8ForAppReleaseAndroidTest, it said task not found
ra...@9gag.com <ra...@9gag.com> #4
Another update:
I've tried to update my release buildType to this:
release {
signingConfig signingConfigs.gagConfig
minifyEnabled true
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt', 'proguard-fresco.pro '
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt', 'proguard-fresco.pro '
}
Changing from proguard-android-optimize.txt to proguard-android.txt in getDefaultProguardFile(), NullPointerException is gone when building test APK
I've tried to update my release buildType to this:
release {
signingConfig signingConfigs.gagConfig
minifyEnabled true
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt', '
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt', '
}
Changing from proguard-android-optimize.txt to proguard-android.txt in getDefaultProguardFile(), NullPointerException is gone when building test APK
mk...@google.com <mk...@google.com> #5
Thank you for responding. The reason why I asked how you was running R8 is because this is the stacktrace:
Caused by: java.lang.NullPointerException
at com.android.tools.r8.naming.ProguardMapMinifier$ApplyMappingMemberNamingStrategy.reportReservationError(ProguardMapMinifier.java:542)
at com.android.tools.r8.naming.ProguardMapMinifier$ApplyMappingMemberNamingStrategy.nextName(ProguardMapMinifier.java:489)
at com.android.tools.r8.naming.ProguardMapMinifier$ApplyMappingMemberNamingStrategy.next(ProguardMapMinifier.java:445)
at com.android.tools.r8.naming.MethodNamingState.newOrReservedNameFor(MethodNamingState.java:64)
at com.android.tools.r8.naming.MethodNamingState.newOrReservedNameFor(MethodNamingState.java:46)
at com.android.tools.r8.naming.MethodNameMinifier.assignNameToMethod(MethodNameMinifier.java:236)
at com.android.tools.r8.naming.MethodNameMinifier.assignNamesToClassesMethods(MethodNameMinifier.java:215)
at com.android.tools.r8.naming.MethodNameMinifier.assignNamesToClassesMethods(MethodNameMinifier.java:222)
at com.android.tools.r8.naming.MethodNameMinifier.assignNamesToClassesMethods(MethodNameMinifier.java:222)
at com.android.tools.r8.naming.MethodNameMinifier.computeRenaming(MethodNameMinifier.java:188)
at com.android.tools.r8.naming.ProguardMapMinifier.run(ProguardMapMinifier.java:146)
at com.android.tools.r8.R8.run(R8.java:740)
at com.android.tools.r8.R8.run(R8.java:243)
We shrink the R8 compiler (using R8) so all of the classes and line-positions are not available - I guess when adding the dependency in gradle, the dependency will not use the R8 compiled library but take the full one. Sorry for the confusion.
Is it possible for you to share the project? If not, I have to add some logging to R8 to figure out what the exact problem is.
Caused by: java.lang.NullPointerException
at com.android.tools.r8.naming.ProguardMapMinifier$ApplyMappingMemberNamingStrategy.reportReservationError(ProguardMapMinifier.java:542)
at com.android.tools.r8.naming.ProguardMapMinifier$ApplyMappingMemberNamingStrategy.nextName(ProguardMapMinifier.java:489)
at com.android.tools.r8.naming.ProguardMapMinifier$ApplyMappingMemberNamingStrategy.next(ProguardMapMinifier.java:445)
at com.android.tools.r8.naming.MethodNamingState.newOrReservedNameFor(MethodNamingState.java:64)
at com.android.tools.r8.naming.MethodNamingState.newOrReservedNameFor(MethodNamingState.java:46)
at com.android.tools.r8.naming.MethodNameMinifier.assignNameToMethod(MethodNameMinifier.java:236)
at com.android.tools.r8.naming.MethodNameMinifier.assignNamesToClassesMethods(MethodNameMinifier.java:215)
at com.android.tools.r8.naming.MethodNameMinifier.assignNamesToClassesMethods(MethodNameMinifier.java:222)
at com.android.tools.r8.naming.MethodNameMinifier.assignNamesToClassesMethods(MethodNameMinifier.java:222)
at com.android.tools.r8.naming.MethodNameMinifier.computeRenaming(MethodNameMinifier.java:188)
at com.android.tools.r8.naming.ProguardMapMinifier.run(ProguardMapMinifier.java:146)
at com.android.tools.r8.R8.run(R8.java:740)
at com.android.tools.r8.R8.run(R8.java:243)
We shrink the R8 compiler (using R8) so all of the classes and line-positions are not available - I guess when adding the dependency in gradle, the dependency will not use the R8 compiled library but take the full one. Sorry for the confusion.
Is it possible for you to share the project? If not, I have to add some logging to R8 to figure out what the exact problem is.
ra...@9gag.com <ra...@9gag.com> #6
You may get the project here. (Please let me know when you got the project, so that I will revert the access, thanks!)
https://drive.google.com/file/d/1pJNMTrKfgCmixfqow_UoNScL0WCbx03l/view?usp=sharing (9gag-android-e36681ef273f346f1d054bc42ace0c3568e30d79.zip)
To setup, you will need this steps:
1. Create a keystore, 9gag-android-release-key.keystore, put it to folder root. You will need to update the alias, store and key password in repo/app/gradle.properties
2. Execute ./run.sh
To setup, you will need this steps:
1. Create a keystore, 9gag-android-release-key.keystore, put it to folder root. You will need to update the alias, store and key password in repo/app/gradle.properties
2. Execute ./run.sh
mk...@google.com <mk...@google.com> #7
I have downloaded the project now. You can revert access! Will let you know when I have found the issue.
ap...@google.com <ap...@google.com> #8
Project: r8
Branch: master
commit acebc712d7ad92a3885f36ca7991319ac607eed5
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Thu Jan 16 12:12:51 2020
Use toReference instead of asDexReference
Bug: 147480426
Change-Id: Ie123e7529ed8b4f53de6499cb3c04e28427e81b6
M src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
https://r8-review.googlesource.com/47616
Branch: master
commit acebc712d7ad92a3885f36ca7991319ac607eed5
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Thu Jan 16 12:12:51 2020
Use toReference instead of asDexReference
Bug: 147480426
Change-Id: Ie123e7529ed8b4f53de6499cb3c04e28427e81b6
M src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
ap...@google.com <ap...@google.com> #9
Project: r8
Branch: 1.6
commit d57c4db9259a1b119fca4c7d12016d0bf3e318bb
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Thu Jan 16 16:16:09 2020
Version 1.6.60
Cherry-pick: Use toReference instead of asDexReference
CL:https://r8-review.googlesource.com/47616
Bug: 147480426
Change-Id: I51aae47809ea12786302fddc8acee4584f4570c5
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
https://r8-review.googlesource.com/47685
Branch: 1.6
commit d57c4db9259a1b119fca4c7d12016d0bf3e318bb
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Thu Jan 16 16:16:09 2020
Version 1.6.60
Cherry-pick: Use toReference instead of asDexReference
CL:
Bug: 147480426
Change-Id: I51aae47809ea12786302fddc8acee4584f4570c5
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
mk...@google.com <mk...@google.com> #10
Raymond, can I ask you to try out version 1.6.60 that should resolve the issue? You can try it out by adding the following to your build.gradle file (your setup is a bit different but I am certain you can find the place :):
buildscript {
repositories {
maven {
url 'http://storage.googleapis.com/r8-releases/raw '
}
}
dependencies {
classpath 'com.android.tools:r8:1.6.60' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
buildscript {
repositories {
maven {
url '
}
}
dependencies {
classpath 'com.android.tools:r8:1.6.60' // Must be before the Gradle Plugin for Android.
classpath 'com.android.tools.build:gradle:X.Y.Z' // Your current AGP version.
}
}
ap...@google.com <ap...@google.com> #11
Project: r8
Branch: 2.0
commit d848786cc22672789d3f0e341860f9eb5dfaf7aa
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Fri Jan 17 11:22:36 2020
Version 2.0.17
Cherry-pick: Use toReference instead of asDexReference
CL:https://r8-review.googlesource.com/47685
Cherry-pick: Ensure handling of optional type args and inner if class
was merged
CL:https://r8-review.googlesource.com/47682
Cherry-pick: Use JDK9 in keep attributes dots test to fix windows
invocation
CL:https://r8-review.googlesource.com/47514
Bug: 147480426
Bug: 147800709
Change-Id: Ibe37414efed8604559e8785ccc4fccdda69e8f8c
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
M src/main/java/com/android/tools/r8/naming/signature/GenericSignatureParser.java
M src/main/java/com/android/tools/r8/naming/signature/GenericSignatureRewriter.java
M src/test/java/com/android/tools/r8/naming/signature/SignatureOfMergedClassesTest.java
A src/test/java/com/android/tools/r8/naming/signature/merging/ImplL.java
A src/test/java/com/android/tools/r8/naming/signature/merging/L.java
M src/test/java/com/android/tools/r8/shaking/attributes/KeepAttributesDotsTest.java
https://r8-review.googlesource.com/47745
Branch: 2.0
commit d848786cc22672789d3f0e341860f9eb5dfaf7aa
Author: Morten Krogh-Jespersen <mkroghj@google.com>
Date: Fri Jan 17 11:22:36 2020
Version 2.0.17
Cherry-pick: Use toReference instead of asDexReference
CL:
Cherry-pick: Ensure handling of optional type args and inner if class
was merged
CL:
Cherry-pick: Use JDK9 in keep attributes dots test to fix windows
invocation
CL:
Bug: 147480426
Bug: 147800709
Change-Id: Ibe37414efed8604559e8785ccc4fccdda69e8f8c
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
M src/main/java/com/android/tools/r8/naming/signature/GenericSignatureParser.java
M src/main/java/com/android/tools/r8/naming/signature/GenericSignatureRewriter.java
M src/test/java/com/android/tools/r8/naming/signature/SignatureOfMergedClassesTest.java
A src/test/java/com/android/tools/r8/naming/signature/merging/ImplL.java
A src/test/java/com/android/tools/r8/naming/signature/merging/L.java
M src/test/java/com/android/tools/r8/shaking/attributes/KeepAttributesDotsTest.java
ra...@9gag.com <ra...@9gag.com> #12
Hi, yes, version 1.6.60 works! Thanks!
Description
R8: 1.6.58
Gradle Wrapper: 5.4.1
Build tools: 29.0.2
targetSdk: 29
There are two exceptions actually as shown from the log. One is IllegalArgumentException, which looks like it's related to Firebase Performance SDK, but that error will go away on second compilation.
Can't instrument /Users/raymond/workspace/9gag-android/android/build/intermediates/javac/appRelease/classes/com/ninegag/android/app/ui/HomeActivity.class : null
However, the NullPointerException keeps throwing out on every compilation. Attached you may find the error log, full r8 config and the app's build.gradle