我在marshmallow设备中安装apk时出现解析错误 它在牛轧糖设备上工作正常。
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.graymatic.gmind.mylook"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
及其在日志中显示以下错误
/PackageManager: Failed collect during installPackageLI
android.content.pm.PackageParser$PackageParserException: Package /data/app/vmdl1108144592.tmp/base.apk has no certificates at entry AndroidManifest.xml
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1176)
at android.content.pm.PackageParser.collectCertificates(PackageParser.java:1130)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:13205)
at com.android.server.pm.PackageManagerService.access$3600(PackageManagerService.java:327)
at com.android.server.pm.PackageManagerService$10.run(PackageManagerService.java:11017)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
答案 0 :(得分:3)
答案 1 :(得分:2)
你应该同时使用compileSdkVersion或targetSdkVersion
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.graymatic.gmind.mylook"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
答案 2 :(得分:1)
还有一个下载位置问题
以棉花糖为例,我在getFilsDir()
下载了apk,然后显示解析错误
但是,如果我将其下载到
File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
它工作正常,没有解析错误。
filesDir
在棉花糖上面的效果很好