google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.46k stars 599 forks source link

java.lang.NoSuchMethodError: No static method setSystemBarsColor #586

Closed udev closed 3 years ago

udev commented 3 years ago

Describe the bug

Calling setSystemBarsColor (or another method which changes the system UI color) on Accompanist 0.14.0 causes an app crash. The crash started occurring after a build tools update from artifact com.android.tools.build:gradle:7.1.0-alpha03 to com.android.tools.build:gradle:7.1.0-alpha04. The crash still appears present when using com.android.tools.build:gradle:7.1.0-alpha05. Downgrading to com.android.tools.build:gradle:7.1.0-alpha03 allows setSystemBarsColor to be called without causing a crash.

Stack trace:

2021-07-27 13:36:23.763 11084-11084/com.avicena.lvedp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.avicena.lvedp, PID: 11084
    java.lang.NoSuchMethodError: No static method setSystemBarsColor-Iv8Zu3U$default(Lcom/google/accompanist/systemuicontroller/SystemUiController;JZZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)V in class Lcom/google/accompanist/systemuicontroller/SystemUiController; or its super classes (declaration of 'com.google.accompanist.systemuicontroller.SystemUiController' appears in /data/app/~~t_SseEo2li-h0Om077pyIQ==/com.avicena.lvedp-bIqGWSUoby59qu27BeWrtw==/base.apk)
        at com.avicena.lvedp.feature.StartActivityKt$StartRoot$1$1.invoke(StartActivity.kt:63)
        at com.avicena.lvedp.feature.StartActivityKt$StartRoot$1$1.invoke(StartActivity.kt:62)
        at androidx.compose.runtime.CompositionImpl$RememberEventDispatcher.dispatchSideEffects(Composition.kt:789)
        at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:640)
        at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:733)
        at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:432)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:144)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:135)
        at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:727)
        at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:135)
        at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:187)
        at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
        at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:142)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:135)
        at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:814)
        at android.view.View.dispatchAttachedToWindow(View.java:20479)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3489)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3496)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2417)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
        at android.view.Choreographer.doFrame(Choreographer.java:731)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Expected behavior

setSystemBarsColor does not crash the app when Accompanist is used with the prescribed compose version

Environment:

Accompanist: 0.14.0 Compose: 1.0.0-rc02 Android Studio Arctic Fox | 2020.3.1 RC 1 Build #AI-203.7717.56.2031.7557721, built on July 16, 2021 Runtime version: 11.0.10+0-b96-7249189 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.4 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Registry: external.system.auto.import.disabled=true Non-Bundled Plugins: com.intellij.marketplace, com.jetbrains.ChooseRuntime, com.thoughtworks.gauge, com.developerphil.adbidea, com.jetbrains.kmm, org.intellij.plugins.markdown, org.jetbrains.compose.desktop.ide

Additional context

Task :app:androidDependencies release releaseCompileClasspath - Dependencies for compilation +--- com.google.accompanist:accompanist-systemuicontroller:0.14.0@aar +--- androidx.navigation:navigation-compose:2.4.0-alpha05@aar +--- androidx.activity:activity-compose:1.3.0-rc02@aar +--- androidx.navigation:navigation-runtime-ktx:2.4.0-alpha05@aar +--- androidx.navigation:navigation-runtime:2.4.0-alpha05@aar +--- androidx.activity:activity-ktx:1.3.0-rc02@aar +--- androidx.navigation:navigation-common-ktx:2.4.0-alpha05@aar +--- androidx.navigation:navigation-common:2.4.0-alpha05@aar +--- androidx.lifecycle:lifecycle-runtime-ktx:2.3.1@aar +--- androidx.compose.material:material:1.0.0-rc02@aar +--- androidx.compose.ui:ui-tooling:1.0.0-rc02@aar +--- androidx.compose.material:material-ripple:1.0.0-rc02@aar +--- androidx.compose.foundation:foundation:1.0.0-rc02@aar +--- androidx.compose.material:material-icons-core:1.0.0-rc02@aar +--- androidx.compose.ui:ui-tooling-data:1.0.0-rc02@aar +--- androidx.compose.animation:animation:1.0.0-rc02@aar +--- androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07@aar +--- androidx.compose.foundation:foundation-layout:1.0.0-rc02@aar +--- androidx.compose.ui:ui:1.0.0-rc02@aar +--- androidx.compose.runtime:runtime-saveable:1.0.0-rc02@aar +--- androidx.compose.ui:ui-tooling-preview:1.0.0-rc02@aar +--- androidx.compose.runtime:runtime:1.0.0-rc02@aar +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1@aar +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0@jar +--- androidx.datastore:datastore:1.0.0-rc02@aar +--- androidx.compose.animation:animation-core:1.0.0-rc02@aar +--- androidx.datastore:datastore-core:1.0.0-rc02@jar +--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0@jar +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10@jar +--- androidx.core:core-ktx:1.6.0@aar +--- com.google.android.material:material:1.4.0@aar +--- androidx.constraintlayout:constraintlayout:2.0.1@aar +--- androidx.appcompat:appcompat:1.3.1@aar +--- com.google.dagger:hilt-android:2.37@aar +--- com.google.firebase:firebase-crashlytics:18.1.0@aar +--- com.google.firebase:firebase-analytics:19.0.0@aar +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.10@jar +--- androidx.savedstate:savedstate-ktx:1.1.0@aar +--- org.jetbrains.kotlin:kotlin-stdlib:1.5.10@jar +--- org.jetbrains:annotations:13.0@jar +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.5.10@jar +--- androidx.viewpager2:viewpager2:1.0.0@aar +--- com.google.android.gms:play-services-measurement-api:19.0.0@aar +--- com.google.firebase:firebase-installations:17.0.0@aar +--- com.google.firebase:firebase-common:20.0.0@aar +--- com.google.firebase:firebase-installations-interop:17.0.0@aar +--- com.google.android.gms:play-services-tasks:17.0.0@aar +--- com.google.firebase:firebase-measurement-connector:19.0.0@aar +--- com.google.android.gms:play-services-measurement:19.0.0@aar +--- com.google.android.gms:play-services-measurement-sdk:19.0.0@aar +--- com.google.android.gms:play-services-measurement-impl:19.0.0@aar +--- com.google.android.gms:play-services-ads-identifier:17.0.0@aar +--- com.google.android.gms:play-services-measurement-sdk-api:19.0.0@aar +--- com.google.android.gms:play-services-measurement-base:19.0.0@aar +--- com.google.android.gms:play-services-stats:17.0.0@aar +--- com.google.android.gms:play-services-basement:17.0.0@aar +--- androidx.fragment:fragment:1.3.6@aar +--- androidx.activity:activity:1.3.0-rc02@aar +--- androidx.appcompat:appcompat-resources:1.3.1@aar +--- androidx.drawerlayout:drawerlayout:1.0.0@aar +--- androidx.coordinatorlayout:coordinatorlayout:1.1.0@aar +--- androidx.dynamicanimation:dynamicanimation:1.0.0@aar +--- androidx.recyclerview:recyclerview:1.1.0@aar +--- androidx.transition:transition:1.2.0@aar +--- androidx.vectordrawable:vectordrawable-animated:1.1.0@aar +--- androidx.vectordrawable:vectordrawable:1.1.0@aar +--- androidx.viewpager:viewpager:1.0.0@aar +--- androidx.legacy:legacy-support-core-utils:1.0.0@aar +--- androidx.loader:loader:1.0.0@aar +--- androidx.customview:customview:1.0.0@aar +--- androidx.core:core:1.6.0@aar +--- androidx.cursoradapter:cursoradapter:1.0.0@aar +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1@aar +--- androidx.savedstate:savedstate:1.1.0@aar +--- androidx.cardview:cardview:1.0.0@aar +--- androidx.lifecycle:lifecycle-runtime:2.3.1@aar +--- androidx.compose.ui:ui-text:1.0.0-rc02@aar +--- androidx.compose.ui:ui-graphics:1.0.0-rc02@aar +--- androidx.compose.ui:ui-unit:1.0.0-rc02@aar +--- androidx.compose.ui:ui-geometry:1.0.0-rc02@aar +--- androidx.lifecycle:lifecycle-livedata:2.0.0@aar +--- androidx.lifecycle:lifecycle-livedata-core:2.3.1@aar +--- androidx.lifecycle:lifecycle-common:2.3.1@jar +--- androidx.lifecycle:lifecycle-viewmodel:2.3.1@aar +--- com.google.android.datatransport:transport-backend-cct:3.0.0@aar +--- com.google.firebase:firebase-encoders-json:18.0.0@aar +--- com.google.firebase:firebase-encoders:17.0.0@jar +--- com.google.android.datatransport:transport-runtime:3.0.1@aar +--- com.google.android.datatransport:transport-api:3.0.0@aar +--- com.google.firebase:firebase-components:17.0.0@aar +--- androidx.versionedparcelable:versionedparcelable:1.1.1@aar +--- androidx.collection:collection:1.1.0@jar +--- androidx.arch.core:core-runtime:2.1.0@aar +--- androidx.arch.core:core-common:2.1.0@jar +--- androidx.interpolator:interpolator:1.0.0@aar +--- androidx.documentfile:documentfile:1.0.0@aar +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar +--- androidx.print:print:1.0.0@aar +--- androidx.annotation:annotation:1.2.0@jar +--- androidx.annotation:annotation-experimental:1.1.0@aar +--- androidx.constraintlayout:constraintlayout-solver:2.0.1@jar +--- com.google.dagger:hilt-core:2.37@jar +--- com.google.dagger:dagger:2.37@jar +--- javax.inject:javax.inject:1@jar +--- com.google.dagger:dagger-lint-aar:2.37@aar +--- com.google.code.findbugs:jsr305:3.0.1@jar --- com.google.firebase:firebase-annotations:16.0.0@jar

releaseRuntimeClasspath - Dependencies for runtime/packaging +--- com.google.accompanist:accompanist-systemuicontroller:0.14.0@aar +--- androidx.compose.ui:ui-tooling:1.0.0-rc02@aar +--- androidx.compose.material:material:1.0.0-rc02@aar +--- androidx.navigation:navigation-compose:2.4.0-alpha05@aar +--- androidx.activity:activity-compose:1.3.0-rc02@aar +--- androidx.compose.material:material-ripple:1.0.0-rc02@aar +--- androidx.compose.foundation:foundation:1.0.0-rc02@aar +--- androidx.compose.animation:animation:1.0.0-rc02@aar +--- androidx.compose.animation:animation-core:1.0.0-rc02@aar +--- androidx.compose.material:material-icons-core:1.0.0-rc02@aar +--- androidx.compose.foundation:foundation-layout:1.0.0-rc02@aar +--- androidx.compose.ui:ui-tooling-data:1.0.0-rc02@aar +--- androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07@aar +--- androidx.compose.ui:ui:1.0.0-rc02@aar +--- androidx.navigation:navigation-runtime-ktx:2.4.0-alpha05@aar +--- androidx.navigation:navigation-runtime:2.4.0-alpha05@aar +--- androidx.activity:activity-ktx:1.3.0-rc02@aar +--- androidx.navigation:navigation-common-ktx:2.4.0-alpha05@aar +--- androidx.navigation:navigation-common:2.4.0-alpha05@aar +--- androidx.lifecycle:lifecycle-runtime-ktx:2.3.1@aar +--- androidx.compose.ui:ui-text:1.0.0-rc02@aar +--- androidx.compose.runtime:runtime-saveable:1.0.0-rc02@aar +--- androidx.compose.ui:ui-graphics:1.0.0-rc02@aar +--- androidx.compose.ui:ui-unit:1.0.0-rc02@aar +--- androidx.compose.ui:ui-geometry:1.0.0-rc02@aar +--- androidx.compose.ui:ui-tooling-preview:1.0.0-rc02@aar +--- androidx.compose.runtime:runtime:1.0.0-rc02@aar +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1@aar +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0@jar +--- androidx.datastore:datastore:1.0.0-rc02@aar +--- androidx.datastore:datastore-core:1.0.0-rc02@jar +--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0@jar +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10@jar +--- androidx.core:core-ktx:1.6.0@aar +--- com.google.android.material:material:1.4.0@aar +--- androidx.constraintlayout:constraintlayout:2.0.1@aar +--- androidx.appcompat:appcompat:1.3.1@aar +--- com.google.dagger:hilt-android:2.37@aar +--- com.google.firebase:firebase-crashlytics:18.1.0@aar +--- com.google.firebase:firebase-analytics:19.0.0@aar +--- com.google.android.datatransport:transport-backend-cct:3.0.0@aar +--- com.google.firebase:firebase-encoders-json:18.0.0@aar +--- com.google.firebase:firebase-encoders:17.0.0@jar +--- com.google.android.gms:play-services-measurement-api:19.0.0@aar +--- com.google.firebase:firebase-installations:17.0.0@aar +--- com.google.firebase:firebase-common:20.0.0@aar +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.10@jar +--- androidx.compose.ui:ui-util:1.0.0-rc02@aar +--- androidx.savedstate:savedstate-ktx:1.1.0@aar +--- androidx.collection:collection-ktx:1.1.0@jar +--- org.jetbrains.kotlin:kotlin-stdlib:1.5.10@jar +--- androidx.viewpager2:viewpager2:1.0.0@aar +--- com.google.android.gms:play-services-measurement:19.0.0@aar +--- com.google.android.gms:play-services-measurement-sdk:19.0.0@aar +--- com.google.firebase:firebase-installations-interop:17.0.0@aar +--- com.google.android.gms:play-services-tasks:17.0.0@aar +--- com.google.android.gms:play-services-measurement-impl:19.0.0@aar +--- com.google.android.gms:play-services-ads-identifier:17.0.0@aar +--- com.google.android.gms:play-services-measurement-sdk-api:19.0.0@aar +--- com.google.android.gms:play-services-measurement-base:19.0.0@aar +--- com.google.android.gms:play-services-stats:17.0.0@aar +--- com.google.firebase:firebase-measurement-connector:19.0.0@aar +--- com.google.android.gms:play-services-basement:17.0.0@aar +--- androidx.fragment:fragment:1.3.6@aar +--- androidx.appcompat:appcompat-resources:1.3.1@aar +--- androidx.drawerlayout:drawerlayout:1.0.0@aar +--- androidx.coordinatorlayout:coordinatorlayout:1.1.0@aar +--- androidx.dynamicanimation:dynamicanimation:1.0.0@aar +--- androidx.transition:transition:1.2.0@aar +--- androidx.vectordrawable:vectordrawable-animated:1.1.0@aar +--- androidx.vectordrawable:vectordrawable:1.1.0@aar +--- androidx.autofill:autofill:1.0.0@aar +--- androidx.viewpager:viewpager:1.0.0@aar +--- androidx.legacy:legacy-support-core-utils:1.0.0@aar +--- androidx.loader:loader:1.0.0@aar +--- androidx.recyclerview:recyclerview:1.1.0@aar +--- androidx.customview:customview:1.0.0@aar +--- androidx.activity:activity:1.3.0-rc02@aar +--- androidx.core:core:1.6.0@aar +--- androidx.cursoradapter:cursoradapter:1.0.0@aar +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1@aar +--- androidx.savedstate:savedstate:1.1.0@aar +--- androidx.lifecycle:lifecycle-runtime:2.3.1@aar +--- androidx.lifecycle:lifecycle-viewmodel:2.3.1@aar +--- androidx.cardview:cardview:1.0.0@aar +--- androidx.lifecycle:lifecycle-common-java8:2.3.0@jar +--- androidx.profileinstaller:profileinstaller:1.0.0-rc02@aar +--- androidx.lifecycle:lifecycle-livedata:2.0.0@aar +--- androidx.lifecycle:lifecycle-livedata-core:2.3.1@aar +--- androidx.lifecycle:lifecycle-common:2.3.1@jar +--- com.google.android.datatransport:transport-runtime:3.0.1@aar +--- com.google.android.datatransport:transport-api:3.0.0@aar +--- com.google.firebase:firebase-components:17.0.0@aar +--- androidx.versionedparcelable:versionedparcelable:1.1.1@aar +--- androidx.collection:collection:1.1.0@jar +--- androidx.arch.core:core-runtime:2.1.0@aar +--- androidx.arch.core:core-common:2.1.0@jar +--- androidx.startup:startup-runtime:1.0.0@aar +--- androidx.interpolator:interpolator:1.0.0@aar +--- androidx.documentfile:documentfile:1.0.0@aar +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar +--- androidx.print:print:1.0.0@aar +--- androidx.tracing:tracing:1.0.0@aar +--- androidx.annotation:annotation:1.2.0@jar +--- androidx.annotation:annotation-experimental:1.1.0@aar +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.5.10@jar +--- com.google.dagger:hilt-core:2.37@jar +--- com.google.dagger:dagger:2.37@jar +--- com.google.dagger:dagger-lint-aar:2.37@aar +--- com.google.code.findbugs:jsr305:3.0.1@jar +--- javax.inject:javax.inject:1@jar +--- com.google.firebase:firebase-annotations:16.0.0@jar +--- org.jetbrains:annotations:13.0@jar --- androidx.constraintlayout:constraintlayout-solver:2.0.1@jar

BUILD SUCCESSFUL in 6s 1 actionable task: 1 executed

chrisbanes commented 3 years ago

This isn't an Accompanist bug. Sounds similar to https://issuetracker.google.com/issues/194289155

udev commented 3 years ago

Thanks. I'll keep an eye out for 7.1.0-alpha06 🙂