Task :app:validateSigningRelease FAILED (not found for signing config 'release'.) using react native - react-native

what can i do when keystore is already available in my app but error is coming like this (not found for signing config 'release'.)????? using react native
Task :app:validateSigningRelease FAILED

If you followed the steps of the official docs for releasing signed APK's it should work correctly.
Without any code is hard, but off the top of my head I think your problem may be on your app/build.gradle (android -> app -> build.gradle
In this code section you should have the following if you are going to release:
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
Notice that in realease -> signingConfig the configuration is signingConfigs.release

Related

How to configure Proguard so that obfuscation works without code optimization?

Only obfuscation is needed. Settings in build.gradle:
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Found that the -dontoptimize parameter is responsible for optimization. Added it to proguard-rules.pro. just a line:
-dontoptimize
It didn’t work, maybe the flag was added incorrectly?

React Native CodePush different key for the 'Production' deployment

My app is linked with the 'Staging' deployment key 'sss'. It's defined at /android/app/src/main/res/values/strings.xml, under reactNativeCodePush_androidDeploymentKey.
Now when I actually release an APK, I'd like to use the 'Production' deployment key 'ppp'.
What's the best way to do that? How do I automate it, so it knows it should use the 'ppp' key? I use the ./gradlew assembleRelease command to build the APK.
The standard way to do this would be to use a build type resource override.
If your build types are debug and release, you would put a strings.xml file at /android/app/src/release/res/values/strings.xml with only the one key reactNativeCodePush_androidDeploymentKey with a value of ppp
Another possible way to do this, if you didn't want to commit your prod key to your repo would be to place it in an environment variable.
Your Gradle file would have to read the env var:
def codePushKey = System.getenv("CODEPUSH_KEY") ?: "sss"
Add the env var to your BuildConfig dynamically
buildTypes {
release {
minifyEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
buildConfigField "String", "CODEPUSH_KEY", codePushKey
}
Replace your CodePush instantiation with the BuildConfig var instead of a string resource.
In your ReactNativeHost implementation, in the getPackages() override, update the CodePush instantiation to:
new CodePush(BuildConfig.CODEPUSH_KEY, getApplicationContext(), BuildConfig.DEBUG)

Update a Mobilefirst 8.0 Proguard application

I want apply the latest fix, which resolves some crashes problems, on my server. After the fix is applied, how do I update my existing Mobilefirst 8.0 Proguard application?
When a new fix applied to server environment, the existing application should be updated following the steps below.
1.Update proguard-project-mfp.txt (ProGuard Rules) file with the property below.
-keepclassmembers class * implements
javax.net.ssl.SSLSocketFactory {
private javax.net.ssl.SSLSocketFactory delegate;
}
2.Enable Proguard in the build.gradle file of the app module.
To
enable Proguard include the following within the android {} tag of the build.gradle file
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
Further information: https://mobilefirstplatform.ibmcloud.com/blog/2016/09/19/mfp-80-obfuscating-android-code-with-proguard/

React-native --variant option

What are the possible values for --variant option except for release? Where is it documented? I couldn't find in react-native docs.
Should I specify this option with debug or devDebug value for debug build?
thanks
There are only two options. release and debug
The default variant is debug, so you don't need to set the --variant flag for it!
Important: variant is only available for Android (react-native run-android)
You could use react-native run-ios --configuration Release for iOS, or just change the XCode Scheme to Release
The variant option is available when you configure the flavor on the android.
sample
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
flavorDimensions "base"
productFlavors {
dev {
dimension "base"
applicationIdSuffix ".dev"
}
prod {
dimension "base"
applicationIdSuffix ".prod"
}
}
cli
react-native run-android --variant devDebug

React native run-ios run-android entry file

I know that in react-native bundle command you can bundle your application with a specified entry file using the --entry-file flag. Is there a similar flag or workaround for react-native run-ios or react-native run-android command where you can specify an entry file?
react-native run-android --help reveals some options but none to specify the entry point. However in android/app/build.gradle you will find:
project.ext.react = [
bundleAssetName: "index.android.bundle",
entryFile: "index.android.js",
bundleInRelease: true,
jsBundleDirRelease: "$buildDir/intermediates/assets/release",
resourcesDirRelease: "$buildDir/intermediates/res/merged/release"
]
You can then create different variants in the gradle build
buildTypes {
customVariant {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
debuggable false
jniDebuggable false
renderscriptDebuggable false
zipAlignEnabled true
project.ext.react.entryFile "custom.android.js"
}
}
and would then be able to do react-native run-android --variant=customVariant