有时编译完后安装后会自已闪退

有时编译完后安装后会自已闪退

# 具体遇到的问题
有时编译完后安装后会自已闪退,有时又不会,以前也不会,就是现在WebView的课程里才出现这个错误,老师帮忙看看是什么错?

# 报错信息的截图

2020-12-05 22:53:27.071 1942-1942/? E/LoadedApk: Unable to instantiate appComponentFactory

    java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[[],nativeLibraryDirectories=[/system/priv-app/GoogleSdkSetup/lib/x86, /system/lib, /system/lib]]

        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

        at android.app.LoadedApk.createAppFactory(LoadedApk.java:226)

        at android.app.LoadedApk.updateApplicationInfo(LoadedApk.java:338)

        at android.app.ActivityThread.handleDispatchPackageBroadcast(ActivityThread.java:5388)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1733)

        at android.os.Handler.dispatchMessage(Handler.java:106)

        at android.os.Looper.loop(Looper.java:193)

        at com.android.server.SystemServer.run(SystemServer.java:454)

        at com.android.server.SystemServer.main(SystemServer.java:294)

        at java.lang.reflect.Method.invoke(Native Method)

        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)

2020-12-05 22:53:27.103 1942-4509/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.testapp.webviewdemo flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy

2020-12-05 22:53:27.127 1942-1959/? W/ActivityManager: Slow operation: 53ms so far, now at startProcess: asking zygote to start proc

2020-12-05 22:53:27.159 3740-6395/? W/RcsProvisioning: Failed to read configuration: /data/user/0/com.google.android.apps.messaging/files/rcsconfig (No such file or directory)

2020-12-05 22:53:27.160 3740-6395/? W/RcsProvisioning: java.io.FileNotFoundException: /data/user/0/com.google.android.apps.messaging/files/rcsconfig (No such file or directory)

        at java.io.FileInputStream.open0(Native Method)

        at java.io.FileInputStream.open(FileInputStream.java:231)

        at java.io.FileInputStream.<init>(FileInputStream.java:165)

        at android.app.ContextImpl.openFileInput(ContextImpl.java:560)

        at android.content.ContextWrapper.openFileInput(ContextWrapper.java:202)

        at ion.a(SourceFile:2)

        at idl.a(SourceFile:4)

        at idm.a(SourceFile:7)

        at com.google.android.apps.messaging.rcsmigration.RcsStateProvider.buildRcsState(SourceFile:81)

        at com.google.android.apps.messaging.rcsmigration.RcsStateProvider.getRcsState(SourceFile:6)

        at com.google.android.ims.rcsmigration.IRcsStateProvider$Stub.dispatchTransaction(SourceFile:10)

        at com.google.android.aidl.BaseStub.onTransact(SourceFile:18)

        at android.os.Binder.execTransact(Binder.java:731)

2020-12-05 22:53:27.392 1942-1957/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.testapp.webviewdemo flg=0x4000010 (has extras) } to com.google.android.gms/.photos.autobackup.PhotosAppUninstalledReceiver

2020-12-05 22:53:27.392 1942-1957/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.testapp.webviewdemo flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver

2020-12-05 22:53:27.469 1942-1957/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.testapp.webviewdemo flg=0x4000010 (has extras) } to com.google.android.googlequicksearchbox/com.google.android.apps.gsa.googlequicksearchbox.GelStubAppWatcher

2020-12-05 22:53:27.469 1942-1957/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.testapp.webviewdemo flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver

2020-12-05 22:53:27.482 1942-1959/? W/ActivityManager: Slow operation: 409ms so far, now at startProcess: returned from zygote!

2020-12-05 22:53:27.556 1942-1959/? W/ActivityManager: Slow operation: 482ms so far, now at startProcess: done updating battery stats

2020-12-05 22:53:27.556 1942-1959/? W/ActivityManager: Slow operation: 483ms so far, now at startProcess: building log message

2020-12-05 22:53:27.556 1942-1959/? W/ActivityManager: Slow operation: 483ms so far, now at startProcess: starting to update pids map

2020-12-05 22:53:27.557 1942-1959/? W/ActivityManager: Slow operation: 483ms so far, now at startProcess: done updating pids map

2020-12-05 22:53:27.588 3740-6395/? W/RcsProvisioning: Failed to read configuration: /data/user/0/com.google.android.apps.messaging/files/rcsconfig (No such file or directory)

2020-12-05 22:53:27.625 3740-6395/? W/RcsProvisioning: java.io.FileNotFoundException: /data/user/0/com.google.android.apps.messaging/files/rcsconfig (No such file or directory)

        at java.io.FileInputStream.open0(Native Method)

        at java.io.FileInputStream.open(FileInputStream.java:231)

        at java.io.FileInputStream.<init>(FileInputStream.java:165)

        at android.app.ContextImpl.openFileInput(ContextImpl.java:560)

        at android.content.ContextWrapper.openFileInput(ContextWrapper.java:202)

        at ion.a(SourceFile:2)

        at idl.a(SourceFile:4)

        at idm.a(SourceFile:7)

        at iez.buildConferencesFileName(SourceFile:30)

        at com.google.android.apps.messaging.rcsmigration.RcsStateProvider.buildRcsState(SourceFile:129)

        at com.google.android.apps.messaging.rcsmigration.RcsStateProvider.getRcsState(SourceFile:6)

        at com.google.android.ims.rcsmigration.IRcsStateProvider$Stub.dispatchTransaction(SourceFile:10)

        at com.google.android.aidl.BaseStub.onTransact(SourceFile:18)

        at android.os.Binder.execTransact(Binder.java:731)

2020-12-05 22:53:27.626 16257-16257/? W/app.webviewdem: Unexpected CPU variant for X86 using defaults: x86

2020-12-05 22:53:27.763 3740-6395/? E/CarrierServices: [348] iez.getFile: File not found.: /data/user/0/com.google.android.apps.messaging/files/httpft_pending (No such file or directory)

    java.io.FileInputStream.open0(Native Method)

    java.io.FileInputStream.open(FileInputStream.java:231)

    java.io.FileInputStream.<init>(FileInputStream.java:165)

    android.app.ContextImpl.openFileInput(ContextImpl.java:560)

    android.content.ContextWrapper.openFileInput(ContextWrapper.java:202)

    iez.getFile(SourceFile:20)

    com.google.android.apps.messaging.rcsmigration.RcsStateProvider.buildRcsState(SourceFile:136)

    com.google.android.apps.messaging.rcsmigration.RcsStateProvider.getRcsState(SourceFile:6)

    com.google.android.ims.rcsmigration.IRcsStateProvider$Stub.dispatchTransaction(SourceFile:10)

    com.google.android.aidl.BaseStub.onTransact(SourceFile:18)

    android.os.Binder.execTransact(Binder.java:731)

2020-12-05 22:53:27.768 1942-3003/? W/system_server: JNI critical lock held for 35.971ms on Thread[111,tid=3003,Runnable,Thread*=0xc3351a00,peer=0x1341e580,"Binder:1942_13"]

2020-12-05 22:53:27.773 1942-1942/? W/Looper: Slow dispatch took 702ms main h=com.android.server.job.JobSchedulerService$JobHandler c=null m=4

2020-12-05 22:53:27.868 1942-4509/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.testapp.webviewdemo flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy

2020-12-05 22:53:27.932 1942-7311/? W/ActivityManager: Slow operation: 53ms so far, now at attachApplicationLocked: after mServices.attachApplicationLocked

2020-12-05 22:53:28.002 1942-1942/? W/Looper: Slow dispatch took 228ms main h=com.android.server.notification.NotificationManagerService$WorkerHandler c=null m=3

2020-12-05 22:53:28.006 1942-1958/? W/Looper: Slow dispatch took 123ms android.ui h=com.android.server.am.ActivityManagerService$UiHandler c=null m=53

2020-12-05 22:53:28.012 1942-1942/? W/Looper: Drained

http://img1.sycdn.imooc.com//climg/5fcba78309717e6811530639.jpg

# 相关课程内容截图

# 尝试过的解决思路和结果

# 粘贴全部相关代码,切记添加代码注释(请勿截图)

在这里输入代码,可通过选择【代码语言】突出显示

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕雪 2020-12-06 16:18:10

同学,你好,这应该是JDK不兼容的问题,在build.gradle中增加

http://img1.sycdn.imooc.com//climg/5fcc91d8092be54f04130083.jpg

再进行测试一下。祝学习愉快

  • 提问者 Charles_hzr #1

    这个JDK版本已经有加了,还是不行。就是编译后第一次运行有时会闪退,再直接点图标可以正常运行。有时又不会闪退,我这是这个project里的这个WebViewDemo的module里第一次遇到这种情况,以前这个project的其它module没有出现过。

    2020-12-06 16:30:18
  • 提问者 Charles_hzr #2

    我试过,如果页面停留在MainActivity, 那试10次10次都是安装后成功运行的。如果页面停留在WebViewActivity, 那试10次有7次不成功。这是为啥?

    2020-12-06 17:03:23
  • 好帮手慕雪 回复 提问者 Charles_hzr #3

    这应该与你的APP没有关系,这是系统的log,你把APP,手动的删除,再运行安装试试

    2020-12-06 17:11:23
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
2.Android 网络操作与流行框架
  • 参与学习           人
  • 提交作业       220    份
  • 解答问题       1800    个

本阶段是联网及数据处理的必备技能。课程从网络基础知识到线程间协同工作、异步下载处理;从文件存储、到轻量级数据库SQLite的使用;最后利用最流程的第三方框架助你快速开发企业级APP。

了解课程
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师