Search code examples
androidandroid-app-bundle

ClassNotFoundException only when downloading from Google Play, using Android Studio 4.1.2 and Android Application Bundle


I have written an app, and have uploaded it to internal testing on Google Play. Following Google's recommendation, this time I have gone with an Android Application Bundle instead of an APK.

When I download it from the Play store, it crashes immediately with java.lang.ClassNotFoundException

If I run the app through Android Studio as a Default APK, it works fine. If I run the app through Android Studio as "APK from app bundle", it also works fine.

My app has three modules. "app" is the main bit. I have a 3d engine module named bulletspeed. The missing class is from the bulletspeed module. I don't know if the third module is missing classes yet, as the program hasn't advanced that far before crashing.

Is there some sort of module setting that I am missing?

Thanks for any help!


Solution

  • As it turns out, my issue was was with proguard. The classes were there all along, just renamed to c.c.b.a.wtf.etc

    • During the build process, I serialize some 3D scenes into a Java ObjectOutputStream.
    • In my program, I deserialize the scenes from OOS resources back into Objects
    • Deserialization could not find the classes by name as the names were obfuscated

    Following this guide, I was able to configure proguard rules so that I could deserialize normally: https://medium.com/androiddevelopers/practical-proguard-rules-examples-5640a3907dc9