Reputation: 7920
I am trying to create different APKs using flavors in an Android app written with React Native but I am getting the following error while running the .gradlew assembleRelease
or any other combination:
Could not find method applicationIdSuffix() for arguments [.free] on ProductFlavor_Decorated{name=free, dimension=null, minSdkVersion=null, targetSdkVersion=null, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId=null, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}.
When I remove the productFlavors
build process works correct.
build.gradle
file looks like the following:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 27
versionName "3.3.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
productFlavors {
free {
applicationIdSuffix ".free"
}
pro {
applicationIdSuffix ".pro"
}
}
...
}
The content of the gradle-wrapper.properties
is as following:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
Don't have any any clue what's wrong. Any idea what I am missing? Also I am using Webstorm
as IDE cause I am working on a ReactNative Project and I mostly work on JS code, would things get easier especially about android configuration if I work with AndroidStudio
Thanks
Upvotes: 1
Views: 3683
Reputation: 205
you can just run
.gradlew assemblefreeRelease
it follows 'assemble[flavorsName]Release' pattern
Upvotes: 0
Reputation: 1
Add resValue line to your "free" flavor
productFlavors {
free {
applicationIdSuffix ".free"
resValue "string", "build_config_package", "com.your_package" // the package of your Android app
}
pro {
applicationIdSuffix ".pro"
}
}
...
Upvotes: 0