Android之部分手机(oppo r9s)安装app出现崩溃问题解决办法

1、问题现象

部分手机(oppo r9s)安装release版本的apk出现了崩溃,但是部分手机安装正常



2、崩溃日志

01-15 09:42:37.239  5889  5889 E AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 66064396 byte allocation with 16777216 free bytes and 50MB until OOM
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.graphics.Bitmap.nativeCreate(Native Method)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.graphics.Bitmap.createBitmap(Bitmap.java:843)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.graphics.Bitmap.createBitmap(Bitmap.java:820)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.graphics.Bitmap.createBitmap(Bitmap.java:740)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.graphics.Bitmap.createBitmap(Bitmap.java:665)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.oppo.theme.OppoMaskBitmapUtilities.scaleAndMaskBitmap(Native Method)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.oppo.theme.OppoConvertIcon.maskBitmap(OppoConvertIcon.java:300)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.oppo.theme.OppoConvertIcon.convertIconBitmap(OppoConvertIcon.java:170)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.oppo.theme.OppoConvertIcon.convertIconBitmap(OppoConvertIcon.java:104)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.OppoThemeHelper.getDrawable(OppoThemeHelper.java:179)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2599)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:374)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:165)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.android.packageinstaller.utils.PackageUtil.parseApkInfo(PackageUtil.java:395)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.android.packageinstaller.InstallAppProgress.initView(InstallAppProgress.java:734)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.android.packageinstaller.InstallAppProgress.onCreate(InstallAppProgress.java:475)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:6497)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2507)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2614)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.ActivityThread.access$1100(ActivityThread.java:165)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:102)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:179)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5739)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-15 09:42:37.239  5889  5889 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
01-15 09:42:37.257  1508  2578 W ActivityManager:   Force finishing activity com.android.packageinstaller/.InstallAppProgress



3、解决办法

看到是手机安装器直接崩溃了

java.lang.OutOfMemoryError
当时就想是不是我程序写的代码导致内存溢出了,但是一想不应该,特码还没运行就这崩溃了。

我一眼也看不出啥问题,后面请教了同事,一看就看出来了

at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:374)
loadIcon就是加载桌面图标呀,内存溢出肯定是app自己加载的桌面图标出了问题,mmp,果然是这个原因,后面改了桌面图标的分辨率,当出现了崩溃,我们应该静下心看下崩溃日志的提示是啥,就算是系统的,也需要从头到尾看。

你可能感兴趣的:(Andriod,积累)