I'm trying to generate a Signed APK
for react native project. Followed steps from android and react-native documentation.
my Build.gradle
file
android { compileSdkVersion 23 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.appmobile" minSdkVersion 16 targetSdkVersion 22 versionCode 1 versionName "1.0" ndk { abiFilters "armeabi-v7a", "x86" } } signingConfigs { release { if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } } buildTypes { release { signingConfig signingConfigs.release // minifyEnabled enableProguardInReleaseBuilds // proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86" } } // buildTypes { // release { // minifyEnabled enableProguardInReleaseBuilds // proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" // } // } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits def versionCodes = ["armeabi-v7a":1, "x86":2] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } }
}
I have placed keystore file in Android/app
directory
my grade.properties
android.useDeprecatedNdk=true MYAPP_RELEASE_STORE_FILE=sampleReleasekeyStore.jks MYAPP_RELEASE_KEY_ALIAS=***** MYAPP_RELEASE_STORE_PASSWORD=***** MYAPP_RELEASE_KEY_PASSWORD=*****
when executing cd android && ./gradlew assembleRelease
.
Its throwing Build failed
Execution failed for task ':app:validateSigningRelease'. Keystore file /Users/username/Projects/appMobile/android/app/sampleReleasekeyStore.jks not found for signing config 'release'.
I'm using a Mac environment. Please let me know where I'm going wrong.
On Windows this would usually be C:\Program Files\Java\jre7\bin . Keytool prompts you to provide passwords for the keystore, provide the Distinguished Name fields and then the password for your key. It then generates the keystore as a file called my-release-key. keystore in the directory you're in.
In the menu bar, click Build > Generate Signed Bundle/APK. In the Generate Signed Bundle or APK dialog, select Android App Bundle or APK and click Next. Below the field for Key store path, click Create new. On the New Key Store window, provide the following information for your keystore and key, as shown in figure 2.
Inside Tasks, navigate to “android” and double click on the signing report option. After clicking on this option you will get to see the path for your debug. keystore file.
The problem in this case is the path. As you have already mentioned above, enter the key in the app folder. Then in your .properties, don't name the whole path, because you are already in your project / app .. you just have to enter the name of the key:
storePassword=my_password keyPassword=my_password keyAlias=key storeFile=key.jks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With