I am developing an Android application that targets two different app stores: Google Play Store and Baidu App Store. To configure the application properly for both stores, I've created two separate custom Application classes, both of which extend an abstract class named BaseApp
. These custom Application classes are annotated with @HiltAndroidApp
.
While the configuration works fine in the debug build, I am encountering an issue when building the release version with minifyEnabled
set to true
. The error message is as follows:
App must extend android.app.Application [Instantiatable]
<application android:name=".GooglePlayApp">
This error suggests that the Application class extending BaseApp
for the Google Play Store version is not recognized as extending android.app.Application
.
I need help resolving this issue while keeping minifyEnabled
set to true
for release builds to optimize APK size and enhance security. Has anyone encountered a similar situation or have insights on how to address this issue with minification enabled?
try to exclude the GoogleApp BiduApp and BaseApp classes from the proguard obfuscation. following is an example on how to exclude:
place this rules in proguard-rules.pro file