Skip to content

NoClassDefFoundError: Failed resolution of: Landroidx/compose/material/icons/Icons #277

@vol4arrra

Description

@vol4arrra

Before creating a new issue, please confirm:

Which UI component?

Liveness

Gradle script dependencies

awsAmplifyUi = "1.7.1"
awsAmplifyCognito = "2.30.1"

composeUi = "1.9.3"
composeMaterial = "1.4.0"

aws-amplify-ui = { module = "com.amplifyframework.ui:liveness", version.ref = "awsAmplifyUi" }
aws-amplify-cognito = { module = "com.amplifyframework:aws-auth-cognito", version.ref = "awsAmplifyCognito" }

compose-ui = { module = "androidx.compose.ui:ui", version.ref = "composeUi" }
compose-material = { module = "androidx.compose.material3:material3", version.ref = "composeMaterial" }

Environment information

Doesn't matter

Please include any relevant guides or documentation you're referencing

https://ui.docs.amplify.aws/android/getting-started/installation

Describe the bug

Since Material3 v1.4.0, the library no longer includes the icon set. Therefore, it's not enough to just implement the material3 dependency — you must also add an explicit icons dependency for the Liveness feature to work.

composeMaterialIcons = "1.7.8"

compose-material-icons = { module = "androidx.compose.material:material-icons-core", version.ref = "composeMaterialIcons" }

There are CancelChallengeButton that uses Icons.Default.Close and crashes the app.

According to Google’s documentation, this change was intentional. You may want to update your implementation accordingly. For now, adding the icons library to the project resolves the issue.

The androidx.compose.material.icons library is no longer recommended for displaying Material Icons in Compose, as Material Symbols are the new way forward. We have stopped publishing updates to this library and it has been removed from the latest Material 3 library release, you can still manually reference it if you cannot migrate yet.

Source: Android Developers – Compose Material3 release notes (v1.4.0)

Reproduction steps (if applicable)

No response

Code Snippet

Log output

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/material/icons/Icons;
  at com.amplifyframework.ui.liveness.ui.CancelChallengeButtonKt.CancelChallengeButton$lambda$1(CancelChallengeButton.kt:63)
  at com.amplifyframework.ui.liveness.ui.CancelChallengeButtonKt.$r8$lambda$GIG3TsqUki36098s4l3PfpcDHSA(Unknown Source:0)
  at com.amplifyframework.ui.liveness.ui.CancelChallengeButtonKt$$ExternalSyntheticLambda2.invoke(D8$$SyntheticClass:0)
  at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121)
  at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:51)
  at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:390)
  at androidx.compose.material3.IconButtonKt.IconButtonImpl(IconButton.kt:193)
  at androidx.compose.material3.IconButtonKt.IconButton(IconButton.kt:152)
  at androidx.compose.material3.IconButtonKt.IconButton(IconButton.kt:95)
  at com.amplifyframework.ui.liveness.ui.CancelChallengeButtonKt.CancelChallengeButton(CancelChallengeButton.kt:56)
  at com.amplifyframework.ui.liveness.ui.CancelChallengeButtonKt.CancelChallengeButton(CancelChallengeButton.kt:41)
  at com.amplifyframework.ui.liveness.ui.FaceLivenessDetectorKt.ChallengeView(FaceLivenessDetector.kt:368)
  at com.amplifyframework.ui.liveness.ui.FaceLivenessDetectorKt.ChallengeView$lambda$60(Unknown Source:19)
  at com.amplifyframework.ui.liveness.ui.FaceLivenessDetectorKt.$r8$lambda$ETqpPTZjkF6MXPAUBcI7zL9F0fU(Unknown Source:0)
  at com.amplifyframework.ui.liveness.ui.FaceLivenessDetectorKt$$ExternalSyntheticLambda11.invoke(D8$$SyntheticClass:0)
  at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:196)
  at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2895)
  at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3231)
  at androidx.compose.runtime.ComposerImpl.doCompose-aFTiNEg(Composer.kt:3855)
  at androidx.compose.runtime.ComposerImpl.recompose-aFTiNEg$runtime(Composer.kt:3779)
  at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:1075)
  at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1373)
  at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:156)
  at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend$lambda$22(Recomposer.kt:627)
  at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.$r8$lambda$OqADLCDYmRw1RgNUvn1CR0kX32M(Unknown Source:0)
  at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
  at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:39)
  at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:108)
  at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
  at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1568)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1579)
  at android.view.Choreographer.doCallbacks(Choreographer.java:1179)
  at android.view.Choreographer.doFrame(Choreographer.java:1104)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1553)
  at android.os.Handler.handleCallback(Handler.java:995)
  at android.os.Handler.dispatchMessage(Handler.java:103)
  at android.os.Looper.loopOnce(Looper.java:248)
  at android.os.Looper.loop(Looper.java:338)
  at android.app.ActivityThread.main(ActivityThread.java:9067)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)

Configuration File

No response

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions