Status Update
Comments
ch...@gmail.com <ch...@gmail.com> #2
FWIW, the View Binding classes are generated correctly (and separate ones for the main
and wearable
modules are correct).
The only issue here is with them resolving correctly in Android Studio.
sg...@google.com <sg...@google.com> #3
Beautiful bug report, thank you. I'll try to take a look in the nearish future.
ch...@gmail.com <ch...@gmail.com> #4
Hey Ian, it looks like there is no v3.4.0-alpha04
tag. The most recent I see is v3.4.0-alpha03
.
ch...@gmail.com <ch...@gmail.com> #5
Yes, sorry. v3.4.0-alpha03
is the correct tag to look at.
ch...@gmail.com <ch...@gmail.com> #6
Ian, I know you're out until Monday. Maybe we can talk next week? This case seems really ambiguous, that you have two modules with the same package and same layout files. Can you walk me through how the framework resolves this?
sg...@google.com <sg...@google.com>
ch...@google.com <ch...@google.com> #7
In this particular case, these modules are entirely independent application modules, so the Android framework isn't involved - as mentioned, the builds themselves work fine as they are two independent builds.
It is just the resolution issue in Studio that is a regression from 3.6.2, which I didn't have this problem on.
ap...@google.com <ap...@google.com> #8
I see the problem, and a fix + test is in progress.
ap...@google.com <ap...@google.com> #9
Fix should land in 4.2 Canary 5.
Thanks again Ian for the great repro project and detailed info.
ap...@google.com <ap...@google.com> #10
ap...@google.com <ap...@google.com> #11
We've added tests to ensure a Kotlin regression like this won't happen again.
ap...@google.com <ap...@google.com> #12
Branch: 8.2
commit 14f886adf3b4ee762f6244ae7db0e47aa3aaa25f
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 10:55:11 2023
Version 8.2.41
Bug:
Change-Id: Ibff0492874768367753c54e527809d1eab98fc8c
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #13
Branch: 8.3
commit c076426f2d5a4f6a19308f78a5670d4a17045a51
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 10:57:14 2023
Version 8.3.23
Bug:
Change-Id: Ibb9c79f745035f99c77fcd1d7db1964bd8c40064
M src/main/java/com/android/tools/r8/Version.java
ap...@google.com <ap...@google.com> #14
Branch: 8.3
commit e54aa41361131312d4ce847c8723783f0b447b20
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 10:56:39 2023
Reproduce illegal publicizing of package private method
Bug:
Change-Id: I00f0ca577043b14eef46a53a86a4aba4bcfb24d8
A src/test/java/com/android/tools/r8/accessrelaxation/PackagePrivateOverrideWithInterfacePublicizerTest.java
ap...@google.com <ap...@google.com> #15
Branch: 8.3
commit 4d174f1f7898046e3d15e3c738b5762b95836ac1
Author: Christoffer Quist Adamsen <christofferqa@google.com>
Date: Wed Dec 13 10:57:03 2023
Fix unsafe state pruning in access modifier traversal
Fixes:
Change-Id: Ida1dc01c4355cc50ee561100e29ed639bf4de01f
M src/main/java/com/android/tools/r8/graph/ImmediateProgramSubtypingInfo.java
M src/main/java/com/android/tools/r8/optimize/accessmodification/AccessModifierTraversal.java
M src/test/java/com/android/tools/r8/accessrelaxation/PackagePrivateOverrideWithInterfacePublicizerTest.java
ch...@gmail.com <ch...@gmail.com> #16
Curious as to why R8 touches anything give a "keep all" instruction.
Glad I could be of help.
Chris
-----
"A temporary workaround is to rename the setRecyclerView method in SAOverscrollLLManagerTest to something else, so that it doesn't clash with the package private setRecyclerView in RecyclerView$LayoutManager."
ch...@google.com <ch...@google.com> #17
The issue is now fixed in R8 8.2.41 and 8.3.23.
You can update to R8 8.2.42, which will be bundled with AGP 8.2.1, by making the following changes to settings.gradle
.
pluginManagement {
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.2.42")
}
}
}
It is recommended to remove the above change to settings.gradle
when updating to AGP 8.2.1 (so that you will continue to get new versions of R8 when you update AGP in the future).
an...@google.com <an...@google.com> #18
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 Iguana | 2023.2.1 Beta 1
- Android Gradle Plugin 8.3.0-beta01
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> #19
The fixes for this issue are now also available in:
- Android Studio Hedgehog | 2023.1.1 Patch 1
- Android Gradle Plugin 8.2.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
Problem and Stack Trace
If I subclass LinearLayoutManager and run it thru R8, I get an exception when I run my app.
12-03 14:53:28.210 7267 7267 I System.out: ----------- [BusinessListActivity 1] [DEBUG] line: 1 buildContent() exited successfully.
12-03 14:53:28.210 7267 7267 I System.out: ----------- [BusinessListActivity 1] [DEBUG] line: 1 onCreate() exited successfully
Point of Breakage
12-03 14:53:28.221 7267 7336 W Parcel : Expecting binder but got null!
12-03 14:53:28.222 1946 4862 D CompatibilityChangeReporter: Compat change id reported: 168419799; UID 10429; state: DISABLED
12-03 14:53:28.222 1946 4862 D CompatibilityChangeReporter: Compat change id reported: 273564678; UID 10429; state: DISABLED
12-03 14:53:28.227 1946 4862 D CoreBackPreview: Window{10efe5a u0 com.spillikinaerospace.ourhangoutsapp/com.spillikinaerospace.ourhangoutsapp.ui.businesslistactivity.BusinessListActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@f88d68, mPriority=0, mIsAnimationCallback=false}
12-03 14:53:28.228 7267 7267 D AndroidRuntime: Shutting down VM
12-03 14:53:28.228 7267 7267 E AndroidRuntime: FATAL EXCEPTION: main
12-03 14:53:28.228 7267 7267 E AndroidRuntime: Process: com.spillikinaerospace.ourhangoutsapp, PID: 7267
12-03 14:53:28.228 7267 7267 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.recyclerview.widget.RecyclerView.n(int, int)' on a null object reference
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at androidx.recyclerview.widget.RecyclerView$m.onMeasure(Unknown Source:2)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at androidx.recyclerview.widget.RecyclerView.onMeasure(Unknown Source:29)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.measureVertical(LinearLayout.java:1031)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at androidx.appcompat.widget.ContentFrameLayout.onMeasure(Unknown Source:159)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7008)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at com.android.internal.policy.DecorView.onMeasure(DecorView.java:750)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.View.measure(View.java:27122)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4182)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2759)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3086)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2465)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9305)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1339)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:952)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:882)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:958)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:205)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.os.Looper.loop(Looper.java:294)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8177)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
12-03 14:53:28.228 7267 7267 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
12-03 14:53:28.230 1946 7663 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
12-03 14:53:28.231 1946 4862 W ActivityTaskManager: Force finishing activity com.spillikinaerospace.ourhangoutsapp/.ui.businesslistactivity.BusinessListActivity
------------------------------------------------------
Experiments.
1. Minimal subclass to demonstrate issue.
I created this minimal subclass which causes the app to crash when the activity that uses it is run.
When I remove the single method and keep only the constructors, the app runs just fine. If I add the method back in, the app crashes. I do not even need to call the method. (I'm thinking the JVM is doing some sort of optimization when it only sees constructors in the subclass.)
class SAOverscrollLLManagerTest : LinearLayoutManager {
constructor (context: Context) : super(context) {
}
constructor (context: Context, attributeSet: AttributeSet, int1: Int, int2: Int) :
super(context, attributeSet, int1, int2) {
}
constructor (context: Context, int: Int, boolean: Boolean) :
super(context, int, boolean) {
}
// Comment out this method and the app does not crash.
fun setRecyclerView(recyclerView: RecyclerView) {
// use this setting to improve performance if changes in content do not change
// layout size of RecyclerView
recyclerView.setHasFixedSize(true)
recyclerView.layoutManager = this
// recyclerView.overScrollMode = View.OVER_SCROLL_ALWAYS
// recyclerView.edgeEffectFactory = BounceEdgeEffectFactory()
}
}
2. R8 Keep settings
2.1 I tried this. App crashed under above conditions (subclass LinearLayoutManager)
Keep my app
-keep class com.spillikinaerospace.** { *; }
Keep RecyclerView (turned out not to be the issue)
-keep class androidx.recyclerview.widget.LinearLayoutManager { *; }
-keep class androidx.recyclerview.widget.GridLayoutManager { *; }
-keep class androidx.recyclerview.widget.RecyclerView { *; }
2.2 I tried this. App crashed under above conditions (subclass LinearLayoutManager)
Keep everything!
-keep class ** { *; }
------------------------------------------------------
Configuration Details.
1. proguard-rules.pro
In additino to Keep, I have these warning suppressions.
See
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
2. build.gradle Module
defaultConfig {
applicationId "com.spillikinaerospace.ourhangoutsapp"
minSdkVersion 33
targetSdkVersion 34
...
}
release {
debuggable false
shrinkResources false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
3. gradle.properties
Generate as many Keeps as I can.
android.enableR8.fullMode=false
4. build.gradle Project
ext.kotlin_version = '1.8.20'
dependencies {
classpath 'com.android.tools.build:gradle:8.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10"
...
}
------------------------------------------------------
Android Studio Version
Android Studio Hedgehog | 2023.1.1
Build #AI-231.9392.1.2311.11076708, built on November 9, 2023
Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.5
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false