5

I am getting parse error while installing apk in marshmallow devices.
its working fine in nougat devices.

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

}

and its showing following error in logs

/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)
Uma Achanta
  • 3,669
  • 4
  • 22
  • 49

3 Answers3

3

When you generate signed apk check both V1 and V2 change both compile and target sdk versions to 27

edit: enter image description here

check both jar signature and signed apk signature

Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85
2

You should make both same compileSdkVersion or 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

}
mehul chauhan
  • 1,792
  • 11
  • 26
  • 1
    It's perfectly fine to have different values for `targetSdkVersion` and `compileSdkVersion`, though it would usually be `targetSdkVersion` that has the higher value (i.e. _"I've verified that my app works on devices running Android Y but I'm only using features up to API level X"_ (where Y>X)). Having `compileSdkVersion` > `targetSdkVersion` like OP does seems a bit strange. – Michael Jan 05 '18 at 11:27
  • I tried this, its showing me app not installed error – Uma Achanta Jan 05 '18 at 11:32
1

There is also an issue of download place In my case in marshmallow i download the apk in getFilsDir() then it says parse error But if i download it in

File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)

it works fine, no parse error.

filesDir works fine in above Marshmallow

Jahangir Kabir
  • 1,783
  • 13
  • 17