We have use case where one code base is used to create multiple apps,so we have used flavours approach and in each flavour we have three different build variants.Each flavor has a particular package name and we are adding applicationSuffixId to each variant in individual flavor.For example as below
defaultConfig {
versionCode 1
versionName "1.0.0"
applicationId "com.mycompany.app"
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
}
playstore {
applicationIdSuffix = ".playstore"
signingConfig signingConfigs.release
}
appcenter {
applicationIdSuffix = ".appcenter"
signingConfig signingConfigs.release
}
}
We are able to generate apk through gradle and also build apk window.The generated apk is working fine with the correct package name.
But when i run the application from the android studio it builds and installs the app but fails to launch it and throws the following error
$ adb shell am start -n "com.mycompany.app/debug.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -W
Error while executing: am start -n "com.mycompany.app/debug.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -W
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mycompany.app/debug.MainActivity }
Error type 3
Error: Activity class {com.mycompany.app/debug.MainActivity} does not exist.
Error while Launching activity
Failed to launch an application on all devices
Manually launching the application works fine.I tried clean,invalidate caches and everything but no luck..Any solution is appreciated