当前位置: 首页 > 工具软件 > runtime > 使用案例 >

【解决方法】A/art: art/runtime/runtime.cc:366]

有品
2023-12-01

初次遇到这个bug,编译运行的APP直接闪退。

看了多遍代码以及网上解法都没解决,只好自己贴出来一篇仅供参考:

我在Logcat查看到的错误提示如下面所示:

A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0xa8
A/art: art/runtime/java_vm_ext.cc:410]     string: 'com.fyang21117.yyapp_5.3.0_1574926952.tx�'
A/art: art/runtime/java_vm_ext.cc:410]     in call to NewStringUTF
A/art: art/runtime/java_vm_ext.cc:410]     from java.lang.String[] java.io.File.listImpl(java.lang.String)
A/art: art/runtime/java_vm_ext.cc:410] "Thread-928" prio=5 tid=10 Runnable
A/art: art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x12d2e340 self=0x557e5b28f0
A/art: art/runtime/java_vm_ext.cc:410]   | sysTid=22679 nice=0 cgrp=top_visible sched=0/0 handle=0x7faca32450
A/art: art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 1022605 66199 24 ) utm=0 stm=0 core=0 HZ=100
A/art: art/runtime/java_vm_ext.cc:410]   | stack=0x7fac930000-0x7fac932000 stackSize=1037KB
A/art: art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
A/art: art/runtime/java_vm_ext.cc:410]   at java.io.File.listImpl(Native method)
A/art: art/runtime/java_vm_ext.cc:410]   at java.io.File.list(File.java:743)
A/art: art/runtime/java_vm_ext.cc:410]   at java.io.File.listFiles(File.java:785)
A/art: art/runtime/java_vm_ext.cc:410]   at com.baidu.mapsdkplatform.comapi.b.a.b.run(unavailable:-1)
A/art: art/runtime/java_vm_ext.cc:410]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/java_vm_ext.cc:410] 
A/art: art/runtime/runtime.cc:366] Runtime aborting...
A/art: art/runtime/runtime.cc:366] Aborting thread:
A/art: art/runtime/runtime.cc:366] "Thread-928" prio=5 tid=10 Native
A/art: art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x12d2e340 self=0x557e5b28f0
A/art: art/runtime/runtime.cc:366]   | sysTid=22679 nice=0 cgrp=top_visible sched=0/0 handle=0x7faca32450
A/art: art/runtime/runtime.cc:366]   | state=R schedstat=( 1112240 66199 27 ) utm=0 stm=0 core=0 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fac930000-0x7fac932000 stackSize=1037KB
A/art: art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
A/art: art/runtime/runtime.cc:366]   at java.io.File.listImpl(Native method)
A/art: art/runtime/runtime.cc:366]   at java.io.File.list(File.java:743)
A/art: art/runtime/runtime.cc:366]   at java.io.File.listFiles(File.java:785)
A/art: art/runtime/runtime.cc:366]   at com.baidu.mapsdkplatform.comapi.b.a.b.run(unavailable:-1)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/runtime.cc:366] Dumping all threads without appropriate locks held: thread list lock mutator lock
A/art: art/runtime/runtime.cc:366] All threads:
A/art: art/runtime/runtime.cc:366] DALVIK THREADS (10):
A/art: art/runtime/runtime.cc:366] "Thread-928" prio=5 tid=10 Runnable
A/art: art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x12d2e340 self=0x557e5b28f0
A/art: art/runtime/runtime.cc:366]   | sysTid=22679 nice=0 cgrp=top_visible sched=0/0 handle=0x7faca32450
A/art: art/runtime/runtime.cc:366]   | state=R schedstat=( 1112240 66199 27 ) utm=0 stm=0 core=0 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fac930000-0x7fac932000 stackSize=1037KB
A/art: art/runtime/runtime.cc:366]   | held mutexes= "abort lock" "mutator lock"(shared held)
A/art: art/runtime/runtime.cc:366]   at java.io.File.listImpl(Native method)
A/art: art/runtime/runtime.cc:366]   at java.io.File.list(File.java:743)
A/art: art/runtime/runtime.cc:366]   at java.io.File.listFiles(File.java:785)
A/art: art/runtime/runtime.cc:366]   at com.baidu.mapsdkplatform.comapi.b.a.b.run(unavailable:-1)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "Signal Catcher" prio=5 tid=2 WaitingInMainSignalCatcherLoop
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d2b0a0 self=0x557e5675e0
A/art: art/runtime/runtime.cc:366]   | sysTid=22662 nice=0 cgrp=top_visible sched=0/0 handle=0x7fad4a3450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 728803 0 1 ) utm=0 stm=0 core=1 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fad3a7000-0x7fad3a9000 stackSize=1013KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: do_sigtimedwait+0xec/0x1d8
A/art: art/runtime/runtime.cc:366]   kernel: SyS_rt_sigtimedwait+0xd0/0x124
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "main" prio=6 tid=1 Runnable
A/art: art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x75927fb8 self=0x557c9170e0
A/art: art/runtime/runtime.cc:366]   | sysTid=22657 nice=-1 cgrp=top_visible sched=0/0 handle=0x7fb2442000
A/art: art/runtime/runtime.cc:366]   | state=R schedstat=( 82498861 12428431 239 ) utm=4 stm=4 core=1 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fddec1000-0x7fddec3000 stackSize=8MB
A/art: art/runtime/runtime.cc:366]   | held mutexes= "mutator lock"(shared held)
A/art: art/runtime/runtime.cc:366]   at java.lang.VMClassLoader.findLoadedClass!(Native method)
A/art: art/runtime/runtime.cc:366]   at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:362)
A/art: art/runtime/runtime.cc:366]   at java.lang.ClassLoader.loadClass(ClassLoader.java:499)
A/art: art/runtime/runtime.cc:366]   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
A/art: art/runtime/runtime.cc:366]   at android.app.Instrumentation.newActivity(Instrumentation.java:1070)
A/art: art/runtime/runtime.cc:366]   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
A/art: art/runtime/runtime.cc:366]   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
A/art: art/runtime/runtime.cc:366]   at android.app.ActivityThread.access$900(ActivityThread.java:168)
A/art: art/runtime/runtime.cc:366]   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
A/art: art/runtime/runtime.cc:366]   at android.os.Handler.dispatchMessage(Handler.java:102)
A/art: art/runtime/runtime.cc:366]   at android.os.Looper.loop(Looper.java:150)
A/art: art/runtime/runtime.cc:366]   at android.app.ActivityThread.main(ActivityThread.java:5659)
A/art: art/runtime/runtime.cc:366]   at java.lang.reflect.Method.invoke!(Native method)
A/art: art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
A/art: art/runtime/runtime.cc:366]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "JDWP" prio=5 tid=3 WaitingInMainDebuggerLoop
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d2e0a0 self=0x557e5a52b0
A/art: art/runtime/runtime.cc:366]   | sysTid=22663 nice=0 cgrp=top_visible sched=0/0 handle=0x7fad39d450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 470625 0 2 ) utm=0 stm=0 core=1 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fad2a1000-0x7fad2a3000 stackSize=1013KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: unix_stream_recvmsg+0x264/0x6d4
A/art: art/runtime/runtime.cc:366]   kernel: sock_recvmsg+0xa8/0xe4
A/art: art/runtime/runtime.cc:366]   kernel: ___sys_recvmsg+0x128/0x220
A/art: art/runtime/runtime.cc:366]   kernel: __sys_recvmsg+0x4c/0x8c
A/art: art/runtime/runtime.cc:366]   kernel: SyS_recvmsg+0x18/0x24
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "ReferenceQueueDaemon" prio=5 tid=4 Waiting
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d26c40 self=0x557e5a5b10
A/art: art/runtime/runtime.cc:366]   | sysTid=22664 nice=0 cgrp=top_visible sched=0/0 handle=0x7fad295450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 415365 0 9 ) utm=0 stm=0 core=1 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fad193000-0x7fad195000 stackSize=1037KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xe0/0x144
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xf8/0x208
A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xd8/0x8c4
A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0x118/0x1a8
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   at java.lang.Object.wait!(Native method)
A/art: art/runtime/runtime.cc:366]   - waiting on <0x052f6ce0> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:147)
A/art: art/runtime/runtime.cc:366]   - locked <0x052f6ce0> (a java.lang.Class<java.lang.ref.ReferenceQueue>)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "FinalizerDaemon" prio=5 tid=5 Waiting
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d26ca0 self=0x557e5a6370
A/art: art/runtime/runtime.cc:366]   | sysTid=22665 nice=0 cgrp=top_visible sched=0/0 handle=0x7fad189450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 614009 0 6 ) utm=0 stm=0 core=4 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7fad087000-0x7fad089000 stackSize=1037KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xe0/0x144
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xf8/0x208
A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xd8/0x8c4
A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0x118/0x1a8
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   at java.lang.Object.wait!(Native method)
A/art: art/runtime/runtime.cc:366]   - waiting on <0x0d9dcb99> (a java.lang.ref.ReferenceQueue)
A/art: art/runtime/runtime.cc:366]   at java.lang.Object.wait(Object.java:423)
A/art: art/runtime/runtime.cc:366]   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:101)
A/art: art/runtime/runtime.cc:366]   - locked <0x0d9dcb99> (a java.lang.ref.ReferenceQueue)
A/art: art/runtime/runtime.cc:366]   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:72)
A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "FinalizerWatchdogDaemon" prio=5 tid=6 Sleeping
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d26d00 self=0x557e5a6bd0
A/art: art/runtime/runtime.cc:366]   | sysTid=22666 nice=0 cgrp=top_visible sched=0/0 handle=0x7fad07d450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 323177 0 6 ) utm=0 stm=0 core=0 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7facf7b000-0x7facf7d000 stackSize=1037KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xe0/0x144
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xf8/0x208
A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xd8/0x8c4
A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0x118/0x1a8
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.sleep!(Native method)
A/art: art/runtime/runtime.cc:366]   - sleeping on <0x018e7e5e> (a java.lang.Object)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.sleep(Thread.java:1046)
A/art: art/runtime/runtime.cc:366]   - locked <0x018e7e5e> (a java.lang.Object)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.sleep(Thread.java:1000)
A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.sleepFor(Daemons.java:273)
A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:284)
A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:232)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "HeapTaskDaemon" prio=5 tid=7 Blocked
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d26d60 self=0x557e5a7430
A/art: art/runtime/runtime.cc:366]   | sysTid=22667 nice=0 cgrp=top_visible sched=0/0 handle=0x7facf71450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 17480622 228699 56 ) utm=1 stm=0 core=0 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7face6f000-0x7face71000 stackSize=1037KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait_queue_me+0xe0/0x144
A/art: art/runtime/runtime.cc:366]   kernel: futex_wait+0xf8/0x208
A/art: art/runtime/runtime.cc:366]   kernel: do_futex+0xd8/0x8c4
A/art: art/runtime/runtime.cc:366]   kernel: SyS_futex+0x118/0x1a8
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   at dalvik.system.VMRuntime.runHeapTasks(Native method)
A/art: art/runtime/runtime.cc:366]   - waiting to lock an unknown object
A/art: art/runtime/runtime.cc:366]   at java.lang.Daemons$HeapTaskDaemon.run(Daemons.java:355)
A/art: art/runtime/runtime.cc:366]   at java.lang.Thread.run(Thread.java:833)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "Binder_1" prio=5 tid=8 Native
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d380a0 self=0x557e5a7c90
A/art: art/runtime/runtime.cc:366]   | sysTid=22668 nice=0 cgrp=top_visible sched=0/0 handle=0x7facd69450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 2040261 57396 10 ) utm=0 stm=0 core=1 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7facc6d000-0x7facc6f000 stackSize=1013KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: binder_thread_read+0xde4/0xf54
A/art: art/runtime/runtime.cc:366]   kernel: binder_ioctl_write_read+0x1b4/0x2d0
A/art: art/runtime/runtime.cc:366]   kernel: binder_ioctl+0x29c/0x634
A/art: art/runtime/runtime.cc:366]   kernel: do_vfs_ioctl+0x4d0/0x5c8
A/art: art/runtime/runtime.cc:366]   kernel: SyS_ioctl+0x5c/0x88
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] "Binder_2" prio=5 tid=9 Native
A/art: art/runtime/runtime.cc:366]   | group="" sCount=1 dsCount=0 obj=0x12d3c0a0 self=0x557e5a84f0
A/art: art/runtime/runtime.cc:366]   | sysTid=22669 nice=0 cgrp=top_visible sched=0/0 handle=0x7facc63450
A/art: art/runtime/runtime.cc:366]   | state=S schedstat=( 667657 187032 5 ) utm=0 stm=0 core=2 HZ=100
A/art: art/runtime/runtime.cc:366]   | stack=0x7facb67000-0x7facb69000 stackSize=1013KB
A/art: art/runtime/runtime.cc:366]   | held mutexes=
A/art: art/runtime/runtime.cc:366]   kernel: __switch_to+0x70/0x7c
A/art: art/runtime/runtime.cc:366]   kernel: binder_thread_read+0xde4/0xf54
A/art: art/runtime/runtime.cc:366]   kernel: binder_ioctl_write_read+0x1b4/0x2d0
A/art: art/runtime/runtime.cc:366]   kernel: binder_ioctl+0x29c/0x634
A/art: art/runtime/runtime.cc:366]   kernel: do_vfs_ioctl+0x4d0/0x5c8
A/art: art/runtime/runtime.cc:366]   kernel: SyS_ioctl+0x5c/0x88
A/art: art/runtime/runtime.cc:366]   kernel: el0_svc_naked+0x20/0x28
A/art: art/runtime/runtime.cc:366]   (no managed stack frames)
A/art: art/runtime/runtime.cc:366] 
A/art: art/runtime/runtime.cc:366] 
E/tee_get_app_cert: cannot find package:system_server

 

后来经过调试发现是申请权限的时候出现了问题,做了修改:

剔除了一些无关权限及危险权限如:

Manifest.permission.READ_EXTERNAL_STORAGE;
Manifest.permission.WRITE_APN_SETTINGS;等等,

留下APP所必要的权限(如下),再次编译通过。

private void requestPermissions() {
        String[] permissions = new String[]{
                Manifest.permission.ACCESS_COARSE_LOCATION,
                Manifest.permission.ACCESS_FINE_LOCATION,
                Manifest.permission.CALL_PHONE,
                Manifest.permission.CAMERA,
                Manifest.permission.INTERNET,
                Manifest.permission.RECORD_AUDIO,
                Manifest.permission.READ_CONTACTS,
                Manifest.permission.READ_PHONE_STATE,
                Manifest.permission.SEND_SMS,
                Manifest.permission.SYSTEM_ALERT_WINDOW,
                Manifest.permission.VIBRATE,
                Manifest.permission.WAKE_LOCK,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
        };

.......

}

 

 类似资料: