我将一个签名的apk安装到手机上有一些奇怪的问题。应用程序安装没有任何问题由Android工作室也在我上传生成的apk文件到谷歌商店我可以从那里安装此应用程序。但我上传到谷歌商店的同样的apk我无法通过手机安装。所有手机都不会出现此问题。在手机huawei 5.1上,htc 4.4没有安装,但在xiaomi 5.1上没有任何问题。
这是我的build.gradle文件:
android {
signingConfigs {
config {
keyAlias 'com.package.app'
keyPassword 'keyPassword'
storePassword 'storePassword'
storeFile file('../android.jks')
}
}
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.package.app"
minSdkVersion 16
targetSdkVersion 23
versionCode 23
versionName '1.1.5'
multiDexEnabled true
}
buildTypes {
release {
signingConfig signingConfigs.config
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:design:23.4.0'
force 'com.android.support:support-v4:23.4.0'
force 'com.android.support:appcompat-v7:23.4.0'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:support-v13:23.4.0'
...
}
如果有人能提供帮助我真的很感激。此致!
修改
在logcat崩溃后,我看到了异常:
Process: com.android.packageinstaller, PID: 7426
java.lang.OutOfMemoryError: Failed to allocate a 65351068 byte allocation with 16777120 free bytes and 57MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:679)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:500)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:993)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2744)
at android.content.res.Resources.loadDrawable(Resources.java:2633)
at android.content.res.Resources.getDrawable(Resources.java:913)
at android.content.res.Resources.getDrawable(Resources.java:872)
at com.android.packageinstaller.PackageUtil.getAppSnippet(PackageUtil.java:205)
at com.android.packageinstaller.InstallAppProgress.initView(InstallAppProgress.java:495)
at com.android.packageinstaller.InstallAppProgress.onCreate(InstallAppProgress.java:401)
at android.app.Activity.performCreate(Activity.java:6151)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2595)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2728)
at android.app.ActivityThread.access$1200(ActivityThread.java:188)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1539)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5938)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:987)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
我已尝试添加android:largeHeap="true"
和android:hardwareAccelerated="false"
。同样在build.gradle中我尝试了
dexOptions {
javaMaxHeapSize "2048M"
}
但仍然没有结果。我不知道为什么会这样。在我的代码中,我没有使用BitmapFactory,即使我从项目中删除了所有大图像,它仍然会崩溃。