admin管理员组文章数量:1122846
I am developing an Android application in AOSP. Below is my configuration for my app Android.bp
android_library_import {
name: "MyApp-hilt-navigation-compose",
aars: ["libs/hilt-navigation-compose-1.2.0.aar"],
}
android_library_import {
name: "MyApp-hilt-android",
aars: ["libs/hilt-android-2.50.aar"],
}
android_library {
name: "MyApp-feature-demohomecpp",
platform_apis: true,
srcs: [
"src/main/**/*.kt",
],
manifest: "src/main/AndroidManifest.xml",
static_libs: [
"car-ui-lib",
"androidx.activity_activity-ktx",
"androidx.annotation_annotation",
"androidx.appcompat_appcompat",
"androidx.activity_activity",
"androidx.recyclerview_recyclerview",
"androidx.cardview_cardview",
"com.google.android.material_material",
"androidx.navigation_navigation-compose",
"androidxpose.runtime_runtime",
"androidx.activity_activity-compose",
"androidx.navigation_navigation-compose",
"androidxpose.ui_ui",
"androidxpose.ui_ui-tooling",
"androidxpose.ui_ui-tooling-preview",
"androidxpose.material3_material3",
"jetbrains-annotations",
"hilt-android",
"MyApp-hilt-navigation-compose",
"MyApp-asis",
"MyApp-core-cpp",
"MyApp-core-common",
"MyApp-core-ui",
"MyApp-core-utils",
"MyApp-data",
"MyApp-runtime-android"
]
}
After making the module successfully by command: m MyApp, I installed the apk file in the devices. However, when the application started up, the below error was explored.
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: FATAL EXCEPTION: main
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: Process: com.myapp.sample, PID: 30878
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/hilt/navigation/HiltViewModelFactory;
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.hilt.navigationpose.HiltViewModelKt.createHiltViewModelFactory(HiltViewModel.kt:95)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at com.myapp.sample.feature.demo.demoScreenKt.demoScreen(demoScreen.kt:408)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at com.myapp.sample.feature.demo.navigation.demoNavigationKt$demoScreen$1.invoke(demoNavigation.kt:18)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at com.myapp.sample.feature.demo.navigation.demoNavigationKt$demoScreen$1.invoke(demoNavigation.kt:17)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:138)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt$NavHost$14$1.invoke(NavHost.kt:310)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt$NavHost$14$1.invoke(NavHost.kt:308)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:65)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt$NavHost$14.invoke(NavHost.kt:308)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt$NavHost$14.invoke(NavHost.kt:292)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:138)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:801)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:790)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:117)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.animation.AnimatedVisibilityKt.AnimatedEnterExitImpl(AnimatedVisibility.kt:773)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:772)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:755)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:815)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt.NavHost(NavHost.kt:277)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt$NavHost$16.invoke(Unknown Source:27)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigationpose.NavHostKt$NavHost$16.invoke(Unknown Source:10)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.RecomposeScopeImplpose(RecomposeScopeImpl.kt:192)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidxpose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2511)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2780)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.ComposerImpl.doCompose(Composer.kt:3259)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3210)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.CompositionImpl.recompose(Composition.kt:864)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.Recomposer.performRecompose(Recomposer.kt:1125)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.Recomposer.access$performRecompose(Recomposer.kt:124)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:580)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:548)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidxpose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1341)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:952)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:878)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1326)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:958)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:205)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Looper.loop(Looper.java:294)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8248)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidxpose.runtime.PausableMonotonicFrameClock@ce858c2, androidxpose.ui.platform.MotionDurationScaleImpl@20516d3, StandaloneCoroutine{Cancelling}@3513210, AndroidUiDispatcher@f336109]
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: Caused by: java.lang.ClassNotFoundException: androidx.hilt.navigation.HiltViewModelFactory
Below is the code of the error block:
@Composable
internal fun DemoHomeCCPScreen(
modifier: Modifier = Modifier,
demoHomeCCPState: DemoHomeCCPState = rememberDemoHomeCCPState(),
viewModel: DemoHomeCCPViewModel = hiltViewModel(),
navigateToScreen: (String) -> Unit,
) {
}
How to resolve this issue when building the application in AOSP?
I am developing an Android application in AOSP. Below is my configuration for my app Android.bp
android_library_import {
name: "MyApp-hilt-navigation-compose",
aars: ["libs/hilt-navigation-compose-1.2.0.aar"],
}
android_library_import {
name: "MyApp-hilt-android",
aars: ["libs/hilt-android-2.50.aar"],
}
android_library {
name: "MyApp-feature-demohomecpp",
platform_apis: true,
srcs: [
"src/main/**/*.kt",
],
manifest: "src/main/AndroidManifest.xml",
static_libs: [
"car-ui-lib",
"androidx.activity_activity-ktx",
"androidx.annotation_annotation",
"androidx.appcompat_appcompat",
"androidx.activity_activity",
"androidx.recyclerview_recyclerview",
"androidx.cardview_cardview",
"com.google.android.material_material",
"androidx.navigation_navigation-compose",
"androidx.compose.runtime_runtime",
"androidx.activity_activity-compose",
"androidx.navigation_navigation-compose",
"androidx.compose.ui_ui",
"androidx.compose.ui_ui-tooling",
"androidx.compose.ui_ui-tooling-preview",
"androidx.compose.material3_material3",
"jetbrains-annotations",
"hilt-android",
"MyApp-hilt-navigation-compose",
"MyApp-asis",
"MyApp-core-cpp",
"MyApp-core-common",
"MyApp-core-ui",
"MyApp-core-utils",
"MyApp-data",
"MyApp-runtime-android"
]
}
After making the module successfully by command: m MyApp, I installed the apk file in the devices. However, when the application started up, the below error was explored.
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: FATAL EXCEPTION: main
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: Process: com.myapp.sample, PID: 30878
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/hilt/navigation/HiltViewModelFactory;
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.hilt.navigation.compose.HiltViewModelKt.createHiltViewModelFactory(HiltViewModel.kt:95)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at com.myapp.sample.feature.demo.demoScreenKt.demoScreen(demoScreen.kt:408)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at com.myapp.sample.feature.demo.navigation.demoNavigationKt$demoScreen$1.invoke(demoNavigation.kt:18)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at com.myapp.sample.feature.demo.navigation.demoNavigationKt$demoScreen$1.invoke(demoNavigation.kt:17)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:138)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(NavHost.kt:310)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(NavHost.kt:308)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:65)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt$NavHost$14.invoke(NavHost.kt:308)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt$NavHost$14.invoke(NavHost.kt:292)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:138)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:801)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:790)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:117)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.animation.AnimatedVisibilityKt.AnimatedEnterExitImpl(AnimatedVisibility.kt:773)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:772)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:755)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:815)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:277)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt$NavHost$16.invoke(Unknown Source:27)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.navigation.compose.NavHostKt$NavHost$16.invoke(Unknown Source:10)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
10-30 07:20:57.720 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2511)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2780)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3259)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3210)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:864)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1125)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:124)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:580)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:548)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1341)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:952)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:878)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1326)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:958)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:205)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.os.Looper.loop(Looper.java:294)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8248)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@ce858c2, androidx.compose.ui.platform.MotionDurationScaleImpl@20516d3, StandaloneCoroutine{Cancelling}@3513210, AndroidUiDispatcher@f336109]
10-30 07:20:57.721 E 30878 30878 AndroidRuntime: Caused by: java.lang.ClassNotFoundException: androidx.hilt.navigation.HiltViewModelFactory
Below is the code of the error block:
@Composable
internal fun DemoHomeCCPScreen(
modifier: Modifier = Modifier,
demoHomeCCPState: DemoHomeCCPState = rememberDemoHomeCCPState(),
viewModel: DemoHomeCCPViewModel = hiltViewModel(),
navigateToScreen: (String) -> Unit,
) {
}
How to resolve this issue when building the application in AOSP?
Share Improve this question edited Nov 22, 2024 at 8:49 Zappy.Mans asked Nov 22, 2024 at 8:41 Zappy.MansZappy.Mans 6721 gold badge8 silver badges23 bronze badges1 Answer
Reset to default 0Including the Hilt AAR isn't going to work because Hilt utilizes code generation and thus requires deeper integration into the build process.
AOSP already has Hilt checked in with a complete Soong integration in external/dagger2
. Notice the many plugins declared in the Android.bp
there.
Thus you should not include Hilt AARs, instead include Hilt in AOSP by referencing the pre-existing Soong dagger2 static lib like so:
static_libs: [
"androidx.activity_activity-compose",
"androidx.compose.foundation_foundation",
"androidx.compose.runtime_runtime",
"androidx.compose.ui_ui",
"androidx.hilt_hilt-navigation-compose",
"hilt_android",
],
See this project that is part of AOSP for a working example:
https://cs.android.com/android/platform/superproject/main/+/c97d572245aad0bd11bc2e89a0f50dcbdf53f6ae:packages/providers/MediaProvider/photopicker/Android.bp;bpv=1
本文标签: android sourceHilt doesn39t work with Jetpack Compose in AOSPStack Overflow
版权声明:本文标题:android source - Hilt doesn't work with Jetpack Compose in AOSP - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305091a1932467.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论