首页 > 解决方案 > 发布开始时 Flutter 崩溃。E/LoadedApk:无法实例化 appComponentFactory,找不到类“com.example.androidx。17_4_2020

问题描述

我已将我的颤振升级到最新版本1.18.0-6.0.pre.65 • channel master 我的应用程序在发布时正在运行。但现在,它仅在调试模式下工作。并给出错误

E/LoadedApk: Unable to instantiate appComponentFactory
    java.lang.ClassNotFoundException: Didn't find class "com.example.androidx" on path: DexPathList[[zip file "/data/app/com.example-w8uMhpPeS9WD7rhvuuQjbg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example-w8uMhpPeS9WD7rhvuuQjbg==/lib/x86, /data/app/com.example-w8uMhpPeS9WD7rhvuuQjbg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]

我已经尝试了几乎所有可用的解决方案,例如:

1:invalidate cache,clean project,flutter clean,update,upgrade and rebuild

2:Add -keep class androidx.core.app.CoreComponentFactory { *; } to your proguard config so that this class won't be proguarded out

3-changed to stable channel没有运气。4-创建新的颤振项目并发布它,给出了同样的错误。

我的毕业典礼:

android {
    compileSdkVersion 'android-R'

    defaultConfig {
        applicationId "com.example"
        minSdkVersion 16
        targetSdkVersion 29
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    buildToolsVersion = '30.0.0 rc2'

标签: flutterandroidx

解决方案


解决了!。对于任何人都会面临这个问题,问题是你使用的一些包。尝试在真实设备上运行 release 并检查日志以获取库 name.so 的名称并从其更改日志中降级其版本


推荐阅读