Instruction set mismatch, PackageSetting搞出的幺蛾子

最近发现,项目在刷完机后有概率无法正常启动,会卡在开机log后的黑屏界面。连接adb抓log发现满满的Shutting down VM。


01-27 13:51:00.761 E/AndroidRuntime( 1785): FATAL EXCEPTION: main
01-27 13:51:00.761 E/AndroidRuntime( 1785): Process: com.android.settings:CryptKeeper, PID: 1785
01-27 13:51:00.761 E/AndroidRuntime( 1785): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.settings/com.android.settings.CryptKeeper}:java.lang.ClassNotFoundException: Didn't find class "com.android.settings.CryptKeeper" on path: DexPathList[[zip file "/system/framework/com.qti.snapdragon.sdk.display.jar", zip file "/system/priv-app/Settings/Settings.apk"],nativeLibraryDirectories=[/system/priv-app/Settings/lib/arm64, /system/priv-app/Settings/Settings.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2548)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.-wrap12(ActivityThread.java)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.os.Handler.dispatchMessage(Handler.java:102)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.os.Looper.loop(Looper.java:154)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.main(ActivityThread.java:6077)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at java.lang.reflect.Method.invoke(Native Method)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
01-27 13:51:00.761 E/AndroidRuntime( 1785): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.settings.CryptKeeper" on path: DexPathList[[zip file "/system/framework/com.qti.snapdragon.sdk.display.jar", zip file "/system/priv-app/Settings/Settings.apk"],nativeLibraryDirectories=[/system/priv-app/Settings/lib/arm64, /system/priv-app/Settings/Settings.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/lib, /vendor/lib]]
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2538)
01-27 13:51:00.761 E/AndroidRuntime( 1785): ... 9 more
01-27 13:51:00.761 E/AndroidRuntime( 1785): Suppressed: java.io.IOException:No original dex files found for dex location /system/priv-app/Settings/Settings.apk
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexFile.openDexFileNative(Native Method)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexFile.openDexFile(DexFile.java:373)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexFile.(DexFile.java:113)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexFile.(DexFile.java:78)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.DexPathList.(DexPathList.java:126)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:48)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at dalvik.system.PathClassLoader.(PathClassLoader.java:64)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1847)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.LoadedApk.getResources(LoadedApk.java:766)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ContextImpl.(ContextImpl.java:2066)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ContextImpl.createAppContext(ContextImpl.java:2011)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5252)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread.-wrap2(ActivityThread.java)
01-27 13:51:00.761 E/AndroidRuntime( 1785): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
01-27 13:51:00.761 E/AndroidRuntime( 1785): ... 6 more
01-27 13:51:00.763 W/ActivityManager( 1246):   Force finishing activity com.android.settings/.CryptKeeper
01-27 13:51:00.764 D/ActivityTrigger( 1246): ActivityTrigger activityPauseTrigger 


去setting底下找了找,发现有odex文件。

再找找,发现了猫腻

W/PackageManager( 1246): Instruction set mismatch, PackageSetting{9d6d1c0 com.android.demo/1000} requires arm whereas PackageSetting{a7923df android/1000} requires arm64

一个32位的application导致很多的app全部adjusting to arm上了。

I/PackageManager( 1246): Adjusting ABI for com.dsi.ant.server to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)
01-27 13:50:55.297 I/PackageManager( 1246): Adjusting ABI for com.qualcomm.qti.appnetaccess to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)
01-27 13:50:55.297 I/PackageManager( 1246): Adjusting ABI for com.qualcomm.location.XT to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)
01-27 13:50:55.297 I/PackageManager( 1246): Adjusting ABI for com.qualcomm.qti.auth.secureextauthservice to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)
01-27 13:50:55.297 I/PackageManager( 1246): Adjusting ABI for com.qti.launcherunreadservice to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)
01-27 13:50:55.298 I/PackageManager( 1246): Adjusting ABI for com.vr.bluetooth to armeabi-v7a (requirer=com.android.demo scannedPackage=null)
01-27 13:50:55.298 I/PackageManager( 1246): Adjusting ABI for com.android.inputdevices to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)
01-27 13:50:55.298 I/PackageManager( 1246): Adjusting ABI for com.qualcomm.qti.seemp.service to armeabi-v7a (requirer=com.android.demo, scannedPackage=null)



看到 com.android.demo/1000  1000 是android.uid.system 的, 然后找了下下面的这些包名,发现都是android.uid.system的。

看来同一个uid的应用不能32位和64位混着用啊。。


不过这个问题非必现。可以正常启动的log:

01-08 23:18:27.971 W/PackageManager( 1248): Instruction set mismatch, PackageSetting{3caff8 com.google.xxxx/1000} requires arm64 whereas PackageSetting{a028e2 com.android.demo/1000} requires arm


01-08 23:18:27.972 I/PackageManager( 1248): Adjusting ABI for com.qualcomm.qti.setupwizard to arm64-v8a (requirer=com.google.xxxx, scannedPackage=null)
01-08 23:18:27.972 I/PackageManager( 1248): Adjusting ABI for com.longcheertel.audioft to arm64-v8a (requirer=com.google.xxxx, scannedPackage=null)
01-08 23:18:27.972 I/PackageManager( 1248): Adjusting ABI for com.android.inputdevices to arm64-v8a (requirer=com.google.xxxx, scannedPackage=null)
01-08 23:18:27.973 I/PackageManager( 1248): Adjusting ABI for com.vr.bluetooth to arm64-v8a (requirer=com.google.xxxx, scannedPackage=null)
01-08 23:18:27.973 I/PackageManager( 1248): Adjusting ABI for com.qualcomm.qti.tetherservice to arm64-v8a (requirer=com.google.xxxx, scannedPackage=null)


原来是com.google.xxxx 把大家给带回正道了。


总结就是:同一个uid的app千万不要32位和64位混着装。这种坑太深,不好往上爬


修改方法:

 /device/qcom/msmxxxx/BoardConfig.mk,  set 
DEX_PREOPT_DEFAULT := nostripping 

你可能感兴趣的:(运行报错)