Jetpack Compose fails with NoClassDefFoundError: Failed resolution of: Landroidx/compose/runtime/MutableStateKt;
Jetpack Compose fails with NoClassDefFoundError: Failed resolution of: Landroidx/compose/runtime/MutableStateKt;
我构建了一个应用程序来玩转 Jetpack compose。在 alpha-11 之前一切正常,但由于我尝试将其更新为 alpha-12(甚至更新为 beta-1),该应用程序在运行时失败并出现错误 NoClassDefFoundError: Failed resolution of: Landroidx/compose/runtime/MutableStateKt;
另外说:
Didn't find class "androidx.compose.runtime.MutableStateKt" on path: DexPathList[[zip file "/data/app/com.example.APPNAME-TeAYAMsRf0C9pLQOdWShCA==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.APPNAME-TeAYAMsRf0C9pLQOdWShCA==/lib/x86, /system/lib, /system/product/lib]]
错误是由于使用 MutableState
和 mutableStateOf
引起的,它们都是从 androidx.compose.runtime 导入的,但我在任何地方都找不到任何信息...
这里是依赖块
我通过升级到测试版并按照本要点中的所有步骤解决了这个问题https://gist.github.com/mitchtabian/f1327d392e3c0ab9ac416c91204c329b
我不能确定是什么导致了这个问题,但很可能是版本不匹配,所以感谢那些向我指出问题的人。
我构建了一个应用程序来玩转 Jetpack compose。在 alpha-11 之前一切正常,但由于我尝试将其更新为 alpha-12(甚至更新为 beta-1),该应用程序在运行时失败并出现错误 NoClassDefFoundError: Failed resolution of: Landroidx/compose/runtime/MutableStateKt;
另外说:
Didn't find class "androidx.compose.runtime.MutableStateKt" on path: DexPathList[[zip file "/data/app/com.example.APPNAME-TeAYAMsRf0C9pLQOdWShCA==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.APPNAME-TeAYAMsRf0C9pLQOdWShCA==/lib/x86, /system/lib, /system/product/lib]]
错误是由于使用 MutableState
和 mutableStateOf
引起的,它们都是从 androidx.compose.runtime 导入的,但我在任何地方都找不到任何信息...
这里是依赖块
我通过升级到测试版并按照本要点中的所有步骤解决了这个问题https://gist.github.com/mitchtabian/f1327d392e3c0ab9ac416c91204c329b
我不能确定是什么导致了这个问题,但很可能是版本不匹配,所以感谢那些向我指出问题的人。