I posted a question previously: 'No args constructor for class does not exist', but it does and received an answer that worked when I tested it using the USB debug mode on my phone via Android Studio. However, when I pushed the app to Google Play, it ceases to work and causes the same error that I described in that question. I repeated the test today and the same thing happens.
To clarify, I am testing the:
Is there any reason why the Google Play APK would behave differently from the Android Studio APK? Or am I missing something?
To start debugging an APK, click Profile or debug APK from the Android Studio Welcome screen. Or, if you already have a project open, click File > Profile or Debug APK from the menu bar. In the next dialog window, select the APK you want to import into Android Studio and click OK.
Drag an APK or app bundle into the Editor window of Android Studio. Switch to the Project perspective in the Project window and then double-click the APK in the default build/output/apks/ directory.
Depending on your build.gradle
config, release
versions usually run ProGuard
on your code.
debug
versions usually don't run such tools on the code.
So what might have happened is that ProGuard
ran over your code, found that MwVolleyApi$Page
is not used anywhere, and deleted it.
To test this theory, in your build.gradle
turn off minifyEnabled
:
release {
minifyEnabled false
...
}
Then build a release-apk, and test it.
BTW, you should always test release apks on your device before uploading them to Google Play, you can install them via adb install
or copy them to the sd card and install them from the Downloads
app on your phone.
If this indeed fixed the problem, you can add rules to your proguard.cfg
file to save the Page
class from deletion, something like:
-keep class fr.free.nrw.commons.upload.MwVolleyApi$Page {*;}
Then you can turn minifyEnabled
back to true, and test again
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With