3

I have always built signed APK from my current laptop with no problem. However, the last signed APK was built from another PC and every signed apk from my PC now works but crashes using "assertionError: impossible" being thrown by different libraries I'm using in the application.

Now, whenever I build a signed apk, it crashes when opening the app. However, when it's built on the other PC, it works perfectly. We're both using V1/V2 signing and the release version of the app.

We are using git and the other PC is just pulling, so there is no code difference between the 2 machines. The only difference might be the configuartion, however, we're using the same ones when signing an APK.

Please note that the proguard rules are working fine when the app is signed from the other machine but it seems they are being ignored (maybe) when building from my machine, even though I'm using the correct flavor and build type and that this only started to happen when the other machine signed an APK, without any code changes.

EDIT: Here's an example of the stack trace of the crashes I'm getting: (Please note that the crashes are not always from glide. Sometimes quickblox, sometimes even the support library would throw this exception)

Fatal Exception: java.lang.AssertionError: impossible
       at java.lang.Enum$1.create(Enum.java:45)
       at java.lang.Enum$1.create(Enum.java:36)
       at libcore.util.BasicLruCache.get(BasicLruCache.java:54)
       at java.lang.Enum.getSharedConstants(Enum.java:211)
       at java.util.EnumSet.noneOf(EnumSet.java:48)
       at java.util.EnumSet.of(EnumSet.java:152)
       at java.util.EnumSet.of(EnumSet.java:172)
       at java.util.EnumSet.of(EnumSet.java:194)
       at com.bumptech.glide.load.resource.bitmap.Downsampler.(Downsampler.java)
       at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.(StreamBitmapDecoder.java)
       at com.bumptech.glide.load.resource.bitmap.StreamBitmapDataLoadProvider.(StreamBitmapDataLoadProvider.java)
       at com.bumptech.glide.Glide.(Glide.java)
       at com.bumptech.glide.GlideBuilder.createGlide(GlideBuilder.java:203)
       at com.bumptech.glide.Glide.get(Glide.java:155)
       at com.bumptech.glide.RequestManager.(RequestManager.java)
       at com.bumptech.glide.RequestManager.(RequestManager.java)
       at com.bumptech.glide.manager.RequestManagerRetriever.supportFragmentGet(RequestManagerRetriever.java:198)
       at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:104)
       at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:87)
       at com.bumptech.glide.Glide.with(Glide.java:629)
Roudi
  • 1,249
  • 2
  • 12
  • 26

1 Answers1

0

You should add the compileOptions under android inside the app-level build.gradle with source compatibility to JAVA 8.

This solved the issue for me. I had JAVA 11 installed on my machine and was getting the same above error but adding the compileOptions solved the issue.

android {

    compileSdkVersion...
    ...

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
Deepak Goyal
  • 4,747
  • 2
  • 21
  • 46