dart flutter应用程序崩溃问题

nzkunb0c  于 2023-03-15  发布在  Flutter
关注(0)|答案(1)|浏览(230)

我得到崩溃时,我打开我的应用程序和这个问题发生时,我才下载应用程序从Google Play,对emulaotor工程罚款我尝试了很多解决方案,但仍然崩溃我所有的时间。
我尝试了:

  • 我已经添加ndk到android/app/grandle。
  • multiDexEnabled为真。
  • 使缓存无效。
  • 拍得干干净净。
  • 通过change_app_package_name软件包更改了软件包名称。
  • 已将程序包更新为最新版本。
  • 将依赖项更新为最新版本。

当我改变软件包名称时,我在Google Play控制台上得到了另一个错误,说:

com.example.appname.MainActivity.onCreate

此视频描述了我的问题(不是我的):
https://www.youtube.com/watch?v=oYUagh35q

来自Google Play游戏机的完整错误消息:

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4169)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4325)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:101)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2574)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8757)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Caused by java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
  at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete (FlutterLoader.java)
  at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java)
  at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.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 com.example.appname.MainActivity.onCreate (MainActivity.java)
  at android.app.Activity.performCreate (Activity.java:8591)
  at android.app.Activity.performCreate (Activity.java:8570)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1384)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4150)
Caused by java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
  at java.util.concurrent.FutureTask.report (FutureTask.java:122)
  at java.util.concurrent.FutureTask.get (FutureTask.java:191)
  at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete (FlutterLoader.java)
Caused by java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
  at java.lang.Runtime.loadLibrary0 (Runtime.java:1077)
  at java.lang.Runtime.loadLibrary0 (Runtime.java:998)
  at java.lang.System.loadLibrary (System.java:1661)
  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:264)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1137)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:637)
  at java.lang.Thread.run (Thread.java:1012)

应用程序\内部版本.gradle:

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

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

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

android {
    compileSdkVersion 33

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.appname"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    } //Added

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            shrinkResources false
            minifyEnabled true // it was false
            signingConfig signingConfigs.release
            ndk {
                abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
            }
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:31.2.3') 
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-appcheck-debug:16.1.2' 
    implementation 'com.google.android.gms:play-services-ads:21.5.0' 
    implementation 'com.google.firebase:firebase-analytics-ktx'
}

安卓系统\内部版本.gradle:

buildscript {
    ext.kotlin_version = '1.6.21' //1.5.10
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2' //7.2.1
        classpath "org.jetbrains.kotlin:kotlin-gradleplugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

gradle.projectsEvaluated {
    tasks.withType(JavaCompile){
        options.compilerArgs << "-Xlint:deprecation"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

发布规范.yaml文件:

name: name_app
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+11

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  get: ^4.6.5
  firebase_core: ^2.7.1
  firebase_auth: ^4.2.10
  cloud_firestore: ^4.4.4
  emoji_picker_flutter: ^1.5.2
  uuid: ^3.0.7
  image_picker: ^0.8.6+4
  image_cropper: ^1.4.1
  firebase_storage: ^11.0.15
  cupertino_icons: ^1.0.5
  firebase_app_check: ^0.1.1+13
  fluttertoast: ^8.2.1
  path: ^1.8.2
  file_picker: ^5.2.5
  rename: ^2.1.1
  permission_handler: ^10.2.0
  video_player: ^2.5.3
  just_audio: ^0.9.31
  record_mp3: ^3.0.0
  stream_chat_flutter: ^4.4.1
  audio_video_progress_bar: ^1.0.0
  chat_bubbles: ^1.3.1
  firebase_analytics: ^10.1.5
  connectivity_plus: ^2.3.6+1
  flutter_linkify: ^5.0.2
  google_mobile_ads: ^2.3.0
  swipe_to: ^1.0.2
  chewie: ^1.4.0
  flutter_pdfview: ^1.2.5
  http: ^0.13.5
  path_provider: ^2.0.13
  giphy_picker: ^3.0.1
  gallery_saver: ^2.3.2
  dio: ^4.0.6
  qr_flutter: ^4.0.0
  flutter_speed_dial: ^6.2.0
  flutter_chat_bubble: ^2.0.2
  geolocator: ^9.0.2
  cached_network_image: ^3.2.3
  video_thumbnail: ^0.5.3
  voice_message_package: ^0.0.74
  external_path: ^1.0.3
  photo_view: ^0.14.0
  flutter_barcode_scanner: ^2.0.0
  change_app_package_name: ^1.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.12.0

flutter_icons:
  android: true
  ios: true
  image_path: "assets/logo.png"

  flutter_lints: ^2.0.1

flutter:

  uses-material-design: true

  assets:
    - assets/verify.gif
    - assets/search.gif
    - assets/search2.gif

  fonts:
     - family: Schyler
       fonts:
         - asset: assets/DancingScript.ttf

机器人清单.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.appname">
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
....

    <application
       android:requestLegacyExternalStorage="true"
       android:usesCleartextTraffic="true"
        android:label="AppName"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:exported="true">
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
       <activity
           android:name="com.yalantis.ucrop.UCropActivity"
           android:screenOrientation="portrait"
           android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

主活动.kt上有一条消息:

我正在从android/app/release获取.aab文件,这是否与此问题相关?.
请帮助我尝试了7天来解决该问题。

uinbv5nw

uinbv5nw1#

我通过创建一个新项目解决了这个问题,我的代码在以前的项目!.

相关问题