s develop
s develop

Reputation: 115

React Native Android build apk error- ':app:packageRelease'

I'm trying to create apk for RN project by following the steps from RN official docs. But I'm getting error:

Execution failed for task ':app:packageRelease'.

com.android.ide.common.signing.KeytoolException: Failed to read key my-key-alias from store "F:\project\myProject\android\app\my-release-key.keystore": No key with alias 'my-key-alias' found in keystore F:\project\myProject\android\my-release-key.keystore

I did:

  1. Created my-release-key.keystore
  2. Placed it in myProject\android\app folder
  3. In C:\Users\Username\.gradle\gradle.properties (Win): (UPDATE)

      MYAPP_RELEASE_STORE_FILE=my-release-key.keystore 
      MYAPP_RELEASE_KEY_ALIAS=my-key-alias 
      MYAPP_RELEASE_STORE_PASSWORD=***** (actual pwd)
      MYAPP_RELEASE_KEY_PASSWORD=***** (actual pwd)
    
  4. In myProject\android\app\build.gradle, added

    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
            }
         }
    }
    
  5. And finally cd android && ./gradlew assembleRelease - where error occurs.

I also tried cd android &&./gradlew assembleRelease which displays same error

I double checked all the values and files, but no luck. It would be a really great if someone would help

Upvotes: 2

Views: 5177

Answers (1)

digit
digit

Reputation: 4565

From the error on the last line. It says that no key alias found in the ..\android\my-release-key.keystore not in the ..\android\app\my-release-key.keystore where you keystore is reside.

No key with alias 'my-key-alias' found in keystore F:\project\myProject\android\my-release-key.keystore

From RN site,

Edit the file ~/.gradle/gradle.properties and add the following (replace ***** with the correct keystore password, alias and key password),

Transfer this code from C:\Users\Username\.gradle into ~/.gradle/gradle.properties file

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore 
MYAPP_RELEASE_KEY_ALIAS=my-key-alias 
MYAPP_RELEASE_STORE_PASSWORD=***** (actual pwd)
MYAPP_RELEASE_KEY_PASSWORD=***** (actual pwd)

Upvotes: 1

Related Questions