flutter -找不到“libflutter.so“

des4xlb0  于 2023-11-21  发布在  Flutter
关注(0)|答案(1)|浏览(161)

试图发布一个Flutter应用程序到Play商店,它发布罚款,而且他们还提供了应用程序在几个设备上工作的截图,然而,我得到这个错误:
找不到“libflutter.so“
堆栈跟踪:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.luna.chinesetopinyin/com.luna.chinesetopinyin.MainActivity}: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/lib/x86, /data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"

字符串
扩展堆栈跟踪:

Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.luna.chinesetopinyin/com.luna.chinesetopinyin.MainActivity}: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/lib/x86, /data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2913)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3048)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1808)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:193)
  at android.app.ActivityThread.main (ActivityThread.java:6669)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/lib/x86, /data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
  at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete (FlutterLoader.java)
  at io.flutter.embedding.engine.FlutterEngineGroup.<init> (FlutterEngineGroup.java)
  at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.setupFlutterEngine (FlutterActivityAndFragmentDelegate.java)
  at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach (FlutterActivityAndFragmentDelegate.java)
  at io.flutter.embedding.android.FlutterActivity.onCreate (FlutterActivity.java)
  at android.app.Activity.performCreate (Activity.java:7136)
  at android.app.Activity.performCreate (Activity.java:7127)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1271)
  at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate (MonitoringInstrumentation.java:2)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2893)
Caused by java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/lib/x86, /data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
  at java.util.concurrent.FutureTask.report (FutureTask.java:123)
  at java.util.concurrent.FutureTask.get (FutureTask.java:193)
  at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete (FlutterLoader.java)
Caused by java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk", zip file "/data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/lib/x86, /data/app/androidx.test.tools.crawler-upCIL-fUxIc3mK8nhXTrOQ==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/base.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.en.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.x86.apk!/lib/x86, /data/app/com.luna.chinesetopinyin-d2I0wNjby5VryoZY_G7GXA==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
  at java.lang.Runtime.loadLibrary0 (Runtime.java:1012)
  at java.lang.System.loadLibrary (System.java:1669)
  at io.flutter.embedding.engine.FlutterJNI.loadLibrary (FlutterJNI.java)
  at io.flutter.embedding.engine.loader.FlutterLoader$1.call (FlutterLoader.java)
  at io.flutter.embedding.engine.loader.FlutterLoader$1.call (FlutterLoader.java)
  at java.util.concurrent.FutureTask.run (FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:764)


我找到了很多资源来修改我的build.gradle,但是,我找不到任何可以解决这个问题的build.gradle配置:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

   def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }

   android {
    namespace "com.luna.chinesetopinyin"
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "com.luna.chinesetopinyin"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64', 'x86'
        }
    }

   signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
       }
   }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.work:work-runtime-ktx:2.7.0'
}


添加ndk的东西:

ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64', 'x86'
        }


航站楼Flutter升级
将pubspec.yaml中的所有包导入升级到最新版本

bt1cpqcv

bt1cpqcv1#

Flutter不支持x86设备。
在以下行中:

ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64', 'x86'
        }

字符串
删除x86并发布应用程序更新。
来自官方文档https://docs.flutter.dev/deployment/android#what-are-the-supported-target-architectures
ARM仿真现在支持x86。2只有少数设备支持x86架构。3你可以跳过它们。

相关问题