Flutter app freezes at splash screen (java.lang.RuntimeException: Unable to start activity ComponentInfo)

huangapple go评论52阅读模式
英文:

Flutter app freezes at splash screen (java.lang.RuntimeException: Unable to start activity ComponentInfo)

问题

I am currently releasing my APKs to the stores and I've encountered a problem where my app wouldn't go further than the splash screen. I initially thought that problems is in how overloaded main() function is but then i got logcat.txt from play market.

The problem:

03-30 10:55:19.813: E/AndroidRuntime(6738): FATAL EXCEPTION: main
03-30 10:55:19.813: E/AndroidRuntime(6738): Process: com.portalapp.portal, PID: 6738
03-30 10:55:19.813: E/AndroidRuntime(6738): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.portalapp.portal/com.portalapp.portal.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-0JLHc7wgxFmUsfRw2mmkng==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/lib/x86, /data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.servertransaction.TransactionExecutor executeCallbacks(TransactionExecutor.java:108)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.os.Looper loop(Looper.java:193)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at android.app.ActivityThread main(ActivityThread.java:6669)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at java.lang.reflect Method invoke(Native Method)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller run(RuntimeInit.java:493)
03-30 10:55:19.813: E/AndroidRuntime(6738): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
03-30 10:55:19.813: E/AndroidRuntime(6738): 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-0JLHc7wgxFmUsfRw2mmkng==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/lib/x86, /data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk!/lib/x86, /data/app/com.portalapp

<details>
<summary>英文:</summary>

I am currently releasing my APKs to the stores and I&#39;ve encountered a problem where my app wouldn&#39;t go further than the splash screen. I initially thought that problems is in how overloaded **main()** function is but then i got *logcat.txt* from play market. 

The problem: 

03-30 10:55:19.813: E/AndroidRuntime(6738): FATAL EXCEPTION: main
03-30 10:55:19.813: E/AndroidRuntime(6738): Process: com.portalapp.portal, PID: 6738
03-30 10:55:19.813: E/AndroidRuntime(6738): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.portalapp.portal/com.portalapp.portal.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-0JLHc7wgxFmUsfRw2mmkng==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/lib/x86, /data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.os.Handler.dispatchMessage(Handler.java:106)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.os.Looper.loop(Looper.java:193)
03-30 10:55:19.813: E/AndroidRuntime(6738): at android.app.ActivityThread.main(ActivityThread.java:6669)
03-30 10:55:19.813: E/AndroidRuntime(6738): at java.lang.reflect.Method.invoke(Native Method)
03-30 10:55:19.813: E/AndroidRuntime(6738): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
03-30 10:55:19.813: E/AndroidRuntime(6738): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
03-30 10:55:19.813: E/AndroidRuntime(6738): 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-0JLHc7wgxFmUsfRw2mmkng==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk", zip file "/data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/lib/x86, /data/app/androidx.test.tools.crawler-0JLHc7wgxFmUsfRw2mmkng==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/base.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.en.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.x86.apk!/lib/x86, /data/app/com.portalapp.portal-2hUT7KMv3Ptgtpso_o2Pxw==/split_config.xxhdpi.apk!/lib/x86, /system/lib]]] couldn't find "libflutter.so"
03-30 10:55:19.813: E/AndroidRuntime(6738): at bb.f.g(Unknown Source:472)
03-30 10:55:19.813: E/AndroidRuntime(6738): at io.flutter.embedding.engine.a.<init>(Unknown Source:178)
03-30 10:55:19.813: E/AndroidRuntime(6738): at io.flutter.embedding.engine.a.<init>(Unknown Source:12)
03-30 10:55:19.814: E/AndroidRuntime(6738): at io.flutter.embedding.android.c.G(Unknown Source:106)
03-30 10:55:19.814: E/AndroidRuntime(6738): at io.flutter.embedding.android.c.p(Unknown Source:7)
03-30 10:55:19.814: E/AndroidRuntime(6738): at io.flutter.embedding.android.FlutterActivity.onCreate(Unknown Source:13)
03-30 10:55:19.814: E/AndroidRuntime(6738): at android.app.Activity.performCreate(Activity.java:7136)
03-30 10:55:19.814: E/AndroidRuntime(6738): at android.app.Activity.performCreate(Activity.java:7127)
03-30 10:55:19.814: E/AndroidRuntime(6738): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
03-30 10:55:19.814: E/AndroidRuntime(6738): at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:2)
03-30 10:55:19.814: E/AndroidRuntime(6738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
03-30 10:55:19.814: E/AndroidRuntime(6738): ... 11 more


full **logcat.txt** is available at my [google drive](https://drive.google.com/file/d/16-Nhqswg2JKecQDbNDhw18vk6PK-odDc/view?usp=share_link)


I tried searching for that exception and I found that this is caused by **webview_flutter** package on a newer flutter version, so I removed it from my project, removed **flutter_html** which depends on it, removed all packages that have some connection to a webview at all, but still no result. The up still freezes on a start in most cases. 

Here is the list of dependencies in my pubsec.yaml file: 

cupertino_icons: ^1.0.2
dynamic_height_grid_view: ^0.0.3
table_calendar: ^3.0.8
flutter_svg: ^2.0.0+1
rive: ^0.10.0
flutter_native_splash: ^2.2.16
flutter_slidable: ^2.0.0
keyboard_dismisser: ^3.0.0
flutter_bloc: ^8.1.1
equatable: ^2.0.5
dio: ^4.0.6
calendar_date_picker2: ^0.3.6
path_provider: ^2.0.11
cron: ^0.5.1
hydrated_bloc: ^9.0.0
blur: ^3.1.0
email_validator: ^2.1.17
flutter_launcher_icons: ^0.11.0
video_player: ^2.5.2
flutter_spinkit: ^5.1.0
audioplayers: ^3.0.1
image_picker: ^0.8.6+1
image_cropper: ^3.0.1
flutter_html: ^3.0.0-alpha.6
url_launcher: ^6.1.8
just_audio: ^0.9.31
audio_video_progress_bar: ^1.0.0
rxdart: ^0.27.7
just_audio_background: ^0.0.1-beta.9
photo_view: ^0.14.0
font_awesome_flutter: ^10.4.0
googleapis: ^10.1.0
googleapis_auth: ^1.3.1
mp3_info: ^0.2.0
fluttertoast: ^8.2.1
firebase_core: ^2.7.0
firebase_analytics: ^10.1.4
flick_video_player: ^0.5.0
webview_flutter: ^4.0.7
firebase_messaging: ^14.2.5
flutter_inappwebview: ^5.7.2+3
overlay_support: ^2.1.0
firebase_in_app_messaging: ^0.7.0+15
firebase_dynamic_links: ^5.0.16
huawei_push: ^6.7.0+300
huawei_analytics: ^6.9.0+302


Any ideas what causing the issue?

</details>


# 答案1
**得分**: 1

Freeze is gone now, here is how I solved this: &lt;br&gt;
解决方法如下:&lt;br&gt;
Turns out, **Firebase** wasn't set up correctly, if you have the same issue and have **Firebase**, you should check if it is set up correctly. &lt;br&gt;
原来,**Firebase** 没有正确设置,如果你遇到了相同的问题并且使用了 **Firebase**,你应该检查它是否正确设置。&lt;br&gt;
What was wrong: &lt;br&gt;
问题出在:&lt;br&gt;
For some reason (I'm not the only one working on the project), we had 

    apply plugin: 'com.google.gms.google-services'

inside *android/build.gradle*. So I moved it from there to *android/app/build.gradle* where we apply other plugins such as **'Kotlin-android'** &lt;br&gt;
由于某种原因(我不是唯一在项目上工作的人),我们在 *android/build.gradle* 中有以下代码:

    apply plugin: 'com.google.gms.google-services'

所以我将它从那里移到 *android/app/build.gradle*,在那里我们应用其他插件,比如 **'Kotlin-android'** &lt;br&gt;
And then inside *android/app/build.gradle* in the **signingConfigs**, I've added the following: 
然后在 *android/app/build.gradle* 的 **signingConfigs** 部分,我添加了以下内容:

    implementation platform('com.google.firebase:firebase-bom:31.3.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'

So it's like 3 lines of code... **Always** double check your setups in situations like this, or you might have a reputation hit from the client, like I did /:
所以这只是 3 行代码... **永远** 在这种情况下仔细检查你的设置,否则你可能会像我一样受到客户的声誉打击 /:

<details>
<summary>英文:</summary>

Freeze is gone now, here is how I solved this: &lt;br&gt;
Turns out, **Firebase** wasn&#39;t set up correctly, if you have same issue and have **Firebase** you should check if it is set up correctly. &lt;br&gt;
What was wrong: &lt;br&gt;
for some reason (i&#39;m not the only one working on the project) we had 

    apply plugin: &#39;com.google.gms.google-services&#39;
inside *android/build.gradle*. So I moved it from there to *android/app/build.gradle* where we apply other plugins such as **&#39;Kotlin-android&#39;** &lt;br&gt;
and then inside *android/app/build.gradle* in the **signingConfigs** I&#39;ve added following: 
  

       implementation platform(&#39;com.google.firebase:firebase-bom:31.3.0&#39;)
       implementation &#39;com.google.firebase:firebase-analytics-ktx&#39;

so it&#39;s like 3 lines of code... **Always** double check your set ups in situations like this or you might have reputation hit from client like I did /:

</details>



huangapple
  • 本文由 发表于 2023年3月31日 18:20:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897404.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定