4

i am trying to build an Android JetPack Compose app. My problem is that when i import the bottom navigation dependency in build.gradle:

def nav_compose_version = "1.0.0-alpha01"
implementation "androidx.navigation:navigation-compose:$nav_compose_version"

When i run the application, it crashes with the following error:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.steganograph, PID: 10389
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/foundation/Background;
    at androidx.compose.foundation.BackgroundKt.background-1xq40Q0(Background.kt:44)
    at androidx.compose.material.SurfaceKt.Surface-biUpMIw(Surface.kt:101)
    at com.example.steganograph.MainActivity$onCreate$1$1.invoke(MainActivity.kt:19)
    at com.example.steganograph.MainActivity$onCreate$1$1.invoke(Unknown Source:10)
    at androidx.compose.runtime.internal.ComposableLambda.invoke(ComposableLambda.kt:144)
    at androidx.compose.runtime.internal.ComposableLambda.invoke(Unknown Source:10)
    at androidx.compose.runtime.AmbientKt.Providers(Ambient.kt:175)
    at androidx.compose.foundation.TextKt.ProvideTextStyle(Text.kt:238)
 Caused by: java.lang.ClassNotFoundException: androidx.compose.foundation.Background
    at java.lang.VMClassLoader.findLoadedClass(Native Method)
    at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        ... 64 more
 Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/ui/platform/InspectableParameter;
        ... 64 more
 Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.compose.ui.platform.InspectableParameter" on path: DexPathList[[zip file "/data/app/com.example.steganograph-7xhzN_I613wLPbtTa4vTGQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.steganograph-7xhzN_I613wLPbtTa4vTGQ==/lib/arm64, /system/lib64, /system/vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        ... 64 more

1 Answer 1

4

If you are using Compose 1.0.0-alpha07, you must use Navigation Compose 1.0.0-alpha02 as the internals of Compose have changed so much as to make alpha01 (which was built against Compose 1.0.0-alpha06) incompatible.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.