Build android app error when added productFlavors
See original GitHub issueIs this a bug report?
Yes,
Have you read the [Contributing Guidelines]
Yes,
Environment
Environment: OS: macOS High Sierra 10.13.2 Node: 6.9.2 Yarn: 1.3.2 npm: 5.5.1 Watchman: 4.5.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: ^0.48.3 => 0.48.3
Target Platform: iOS (10.3)
Steps to Reproduce
- create android with multiple productFlavors (demo, full and etc)
- build different flavor app on android device by running this command,
react-native run-android --variant=demoDebug
orreact-native run-android --variant=fullDebug
flavorDimensions "app"
productFlavors {
demo {
dimension "app"
applicationId "com.demo"
resValue "string", "app_name", "demo"
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_demo"
]
versionCode 1
versionName "1.0"
}
full {
dimension "app"
applicationId "com.full"
resValue "string", "app_name", "full"
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_full"
]
versionCode 1
versionName "1.0"
}
}
Expected Behavior
expect different flavors of app will build on android device,
Actual Behavior
the build failed and i, i get this error
Error: Activity class {com.todo/com.todo.MainActivity} does not exist
,
but I’m able to build the app successfully if i remove the productFlavors {}
any advice will be appreciate.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:6
Top Results From Across the Web
adding productFlavors in build.grade(Module:app) giving error
Your build.gradle would end up being something like this: android { compileSdkVersion 25 buildToolsVersion "25.0.3" defaultConfig ...
Read more >Configure build variants | Android Developers
Each build variant represents a different version of your app that you can ... Add product flavors to the productFlavors block in your...
Read more >Android Build Types and Product Flavors - DigitalOcean
In this tutorial, we'll be discussing Android Build Types and Product Flavors. We'll see how they make our Android Development easier and ...
Read more >Build problem with multiple product flavours in new version ...
The specific error we're getting is: Cannot find a variant matching build type 'debug' and product flavors '[gms]' in :app. I've added ......
Read more >Product Flavors for Android Library | by Sahil Dave - Medium
In this post I would add product flavors to one of the libraries that I am ... To cope with this problem, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into this issue and found some way to make it work: I have two product flavors
prod
, with applicationId “com.yetno.yetnoapp” (which is the main app id)dev
, with applicationId “com.yetno.yetno_app”When building and running dev (
react-native run-android --variant=devDebug
) I was getting the error described in this issue. Then I noticed, if I build the prod variant first and have it installed on the device, building and installing the dev variant works fine. So the steps are:cd android && ./gradlew clean
cd ..
react-native run-android --variant=prodDebug
react-native run-android --variant=devDebug
So this is not really an answer, but it worked for me and maybe it can help some of you guys out 😃
I’m writing new versions of old apps, and thus I have inherited old app id’s.
My code have the package
com.common.package
(in source files andAndroidManifest.xml
).My
build.gradle
containsFirst the app can be installed with gradlew
The I can start it manually with
This is a bloody hassle. I would rather not have to mess with it like this.