Status Update
Comments
sg...@google.com <sg...@google.com> #2
Fix (pending) is I2c2dc7b600603ee430fd0d91b23d52ea8aa29ca9.
dm...@gmail.com <dm...@gmail.com> #3
sg...@google.com <sg...@google.com> #4
#sdkmanager --package_file=${PATH_WORKSPACE}/packages
while read p; do echo "y" | sdkmanager "${p}"; done <${PATH_WORKSPACE}/packages
dm...@gmail.com <dm...@gmail.com> #5
sg...@google.com <sg...@google.com> #6
sg...@google.com <sg...@google.com> #7
sg...@google.com <sg...@google.com>
ap...@google.com <ap...@google.com> #8
ap...@google.com <ap...@google.com> #9
ap...@google.com <ap...@google.com> #10
```
(15:58:11) C02W513SHTD8:files aso$ /opt/android-sdk-macosx/tools/bin/sdkmanager --version
26.1.1
(15:58:17) C02W513SHTD8:files aso$ /opt/android-sdk-macosx/tools/bin/sdkmanager --install --package_file=package_file
Warning: Unknown argument --package_file=package_file
```
ap...@google.com <ap...@google.com> #11
ap...@google.com <ap...@google.com> #12
ap...@google.com <ap...@google.com> #13
ap...@google.com <ap...@google.com> #14
ap...@google.com <ap...@google.com> #15
ap...@google.com <ap...@google.com> #16
Has anyone re-tried it?
We switched back to RUN sdkmanager --package_file=$ANDROID_HOME/packages.txt
in our Dockerfile back in March of 2021.
ap...@google.com <ap...@google.com> #17
For what it's worth, I did a quick test with the latest CLI: 11076708 (
./sdkmanager --sdk_root="../sdk" --package_file=deps.txt
Deps.txt:
platform-tools
extras;google;instantapps
build-tools;35.0.0-rc3
So perhaps this is now resolved? I haven't tried it with more packages
ap...@google.com <ap...@google.com> #18
Branch: 8.0
commit c507b4132c0d989286e2fce27e6118bef2a5cb86
Author: Søren Gjesse <sgjesse@google.com>
Date: Tue Aug 22 16:08:30 2023
Handle assume instructions in bridge hoisting
Bug:
Change-Id: I17f6760d041e95618a0d048572a306c64a042457
M src/main/java/com/android/tools/r8/ir/optimize/info/bridge/BridgeAnalyzer.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeAfterAssumeNoSideEffectsTest.java
sg...@google.com <sg...@google.com> #19
This is now fixed, and you can use R8 8.1.67 with AGP 8.1.1 (or 8.1.0). The fix did not make it into AGP 8.1.1, which shipped with
For AGP 8.0.x use 8.0.64. For AGP 8.2.x use 8.2.26 which will go into Android Studio Hedgehog / AGP 8.2 Beta 2.
To use a specific R8 version (e.g. 8.1.67) merge the following into settings.gradle
or settings.gradle.kts
:
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.1.67")
}
}
}
to...@gmail.com <to...@gmail.com> #20
Thank you for the report. Using -assumenosideeffects can have undesired effects at runtime
Sorry to jump on this issue, but since this is something that came up a few times but never ended in an official statement about it maybe now is the time to ask again.
I'm also using:
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static void checkNotNull(...);
public static void checkExpressionValueIsNotNull(...);
public static void checkNotNullExpressionValue(...);
public static void checkParameterIsNotNull(...);
public static void checkNotNullParameter(...);
public static void checkReturnedValueIsNotNull(...);
public static void checkFieldIsNotNull(...);
public static void throwUninitializedPropertyAccessException(...);
public static void throwNpe(...);
public static void throwJavaNpe(...);
public static void throwAssert(...);
public static void throwIllegalArgument(...);
public static void throwIllegalState(...);
}
As even with R8 full mode it reduce the dex file by aprox 100 Kb.
What is the official R8 team position about those rules, there's often remarks they probably should not be used, but no definitive answer about yes or no.
Is there any possible side effect about those specific ones, that could overcome the dex size gain?
sg...@google.com <sg...@google.com> #21
In general using -assumenosideeffects
can be dangerous as it can unconditionally remove code.
In the case of the check*
methods the null
checks will be removed. In most cases that will just postpone the NPE until later when the null value is accessed. However, that might be way later in the program execution (e.g. the value is used to set a field which is then accessed in a completely different code path). So the code will have different behavior. In the case of a pure Kotlin project this should (almost) be safe, as nullability is checked at compile time.
It is also possible to have the Kotlin compiler not emitting null checks using something like this:
android {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
However, that only works for the code which is compiled from source and not binary dependencies.
For the throw*
I don't know when they are actually generated by the Kotlin compiler, so how removing these affects the application soundness I cannot say.
ap...@google.com <ap...@google.com> #22
Branch: 4.0
commit 5b3819134a7d7bb3fc3ca4a9b79dc25a065a39f4
Author: Søren Gjesse <sgjesse@google.com>
Date: Tue Aug 22 16:21:18 2023
Handle assume instructions in bridge hoisting
Bug:
Change-Id: I17f6760d041e95618a0d048572a306c64a042457
M src/main/java/com/android/tools/r8/ir/optimize/info/bridge/BridgeAnalyzer.java
M src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeAfterAssumeNoSideEffectsTest.java
ap...@google.com <ap...@google.com> #23
Branch: 4.0
commit ec460f9dde31a99170d126d6e20f6f8794f9a559
Author: Søren Gjesse <sgjesse@google.com>
Date: Tue Aug 22 16:17:19 2023
Reproduce invalid code produced from bridge hoisting
Bug:
Change-Id: I3b1a7932dcdc7222f0ee9e3143ea3f855e2b936f
A src/test/java/com/android/tools/r8/bridgeremoval/hoisting/BridgeAfterAssumeNoSideEffectsTest.java
ap...@google.com <ap...@google.com> #24
Branch: 4.0
commit f91d04a07894ffa0d9bb58e6d45bdf87547dd4b5
Author: Søren Gjesse <sgjesse@google.com>
Date: Tue Aug 22 16:21:35 2023
Version 4.0.69
Bug:
Change-Id: I761b1fa3b18d28e3a26c1056482d8eb5657c0712
M src/main/java/com/android/tools/r8/Version.java
an...@google.com <an...@google.com> #25
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Hedgehog | 2023.1.1 Beta 3
- Android Gradle Plugin 8.2.0-beta03
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
an...@google.com <an...@google.com> #26
The fixes for this issue are now also available in:
- Android Studio Giraffe | 2022.3.1 Patch 2
- Android Gradle Plugin 8.1.2
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
After updating Kotlin from 1.8.21 to 1.9.0 and R8 from 4.0.48 to 8.1.56 I started receiving this fatal exception:
A quick look in a JaDX decompiler has shown that ox6 is some kind of autogenerated lambda state machine, probably a work of Kotlin compiler or R8?
Also, probably, this might be an issue of the following Proguard rules regarding stripping out Kotlin nullchecks in production, because removing them makes the application launch:
(these rules worked in R8 4.x, however)
R8: 8.1.56 (build 892155436bed60c4f2f7672d4993950e7b342bd9 from go/r8bot (luci-r8-custom-ci-focal-2-5rpr))
AGP: 8.1.0
Kotlin: 1.9.0 (K2 is disabled, KSP + KAPT applied)
JVM Target: 11