React-native: Signed apk not being generated

Created on 22 Jul 2016  路  13Comments  路  Source: facebook/react-native

I upgraded to 0.30 this morn but now when I run './gradlew assembleRelease' I am only getting the unsigned apk instead of both the signed and unsigned one.

All my files were correctly updated post upgrade, signingConfigs is there with the correct file names, keyfile is in android/app the build process is not reporting any errors or warning.

Here is the build outpu

`
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportRecyclerviewV72301Library
:app:prepareComAndroidSupportSupportV42321Library
:app:prepareComFacebookFrescoDrawee0110Library
:app:prepareComFacebookFrescoFbcore0110Library
:app:prepareComFacebookFrescoFresco0110Library
:app:prepareComFacebookFrescoImagepipeline0110Library
:app:prepareComFacebookFrescoImagepipelineBase0110Library
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library
:app:prepareComFacebookReactReactNative0300Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources
:app:mergeReleaseResources
:app:bundleReleaseJsAndAssets
[9:00:41 PM] Building Dependency Graph
[9:00:41 PM] Crawling File System
[9:00:41 PM] find dependencies
[9:00:48 PM] Crawling File System (7057ms)
[9:00:48 PM] Building in-memory fs for JavaScript
[9:00:49 PM] Building in-memory fs for JavaScript (197ms)
[9:00:49 PM] Building in-memory fs for Assets
[9:00:49 PM] Building in-memory fs for Assets (157ms)
[9:00:49 PM] Building Haste Map
[9:00:49 PM] Building (deprecated) Asset Map
[9:00:49 PM] Building (deprecated) Asset Map (88ms)
[9:00:49 PM] Building Haste Map (326ms)
[9:00:49 PM] Building Dependency Graph (7746ms)
[9:01:00 PM] find dependencies (18491ms)
bundle: start
bundle: finish
bundle: Writing bundle output to: D:\Documents\Projects\cycle-culture-app-reactandroidapp\buildintermediatesassetsreleaseindex.android.bundle
bundle: Copying 21 asset files
bundle: Done writing bundle output
bundle: Done copying assets
:app:processReleaseManifest
Warning: D:\Documents\Projects\cycle-culture-app-reactandroidapp\src\mainAndroidManifest.xml:9:5-100 Warning:
uses-permission#android.permission.READ_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:9 to remove other declarations but no other declaration present
Warning: D:\Documents\Projects\cycle-culture-app-reactandroidapp\src\mainAndroidManifest.xml:10:5-101 Warning:
uses-permission#android.permission.WRITE_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:10 to remove other declarations but no other declaration present
D:\Documents\Projects\cycle-culture-app-reactandroidapp\src\mainAndroidManifest.xml:9:5-100 Warning:
uses-permission#android.permission.READ_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:9 to remove other declarations but no other declaration present
D:\Documents\Projects\cycle-culture-app-reactandroidapp\src\mainAndroidManifest.xml:10:5-101 Warning:
uses-permission#android.permission.WRITE_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:10 to remove other declarations but no other declaration present
:app:processReleaseResources
:app:generateReleaseSources
:app:processReleaseJavaRes UP-TO-DATE
:app:compileReleaseJavaWithJavac
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:proguardRelease
:app:dexRelease
:app:packageRelease
:app:assembleRelease

BUILD SUCCESSFUL

Total time: 58.699 secs

`

Locked

Most helpful comment

I found a solution changing buildTypes like this:
buildTypes {
release {
signingConfig signingConfigs.release
}
}

All 13 comments

I am on windows 10 and I am facing the same problem. Unsigned apk generated!! :(

hack-ish solution is to run this command on your existing apk inside android/app folder to get your signed apk.

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore appkey.keystore app-release-unsigned.apk appkeyalias

@RemeJuan did u figure it out?

Mine is generating only: app-release-unsigned.apk inside android/app/build/outputs/apk

I'm getting this issue not too with RN0.40. Got a hanging question on stackoverflow: http://stackoverflow.com/questions/41727542/react-native-doesnt-assemble-signed-android-app.

my problem was that my keystore was wrong

I don't think it's the keystore file in android/app.

My android/app/build.gradle file has the following:

signingConfigs { release { if (project.hasProperty('MY_RELEASE_STORE_FILE')) { storeFile file(MY_RELEASE_STORE_FILE) storePassword MY_RELEASE_STORE_PASSWORD keyAlias MY_RELEASE_KEY_ALIAS keyPassword MY_RELEASE_KEY_PASSWORD } } }

my ./gradle/gradle.properties has

MY_RELEASE_STORE_FILE=*****.keystore MY_RELEASE_KEY_ALIAS=***** MY_RELEASE_STORE_PASSWORD=***** MY_RELEASE_KEY_PASSWORD=*****

where the STORE_FILE is the filename of the keystore in android/app.

I've used

keytool -list -v -keystore ****.keystore | grep "Alias name\|Creation date"

which asks me for my password and gives me the alias, those are all right.

Are there any other properties that need to line up with the keystore for it to work?

If it is the keystore itself that's broken somehow, how would I go about regenerating it? Is that even possible?

Ok. It's definitely not the keystore. I've gone through the Generating Signed APK steps from scratch: made a new signing key, updated my gradle properties, updated the gradle config, and tried to build a release APK.

Same result... nothing but an unsigned apk in my build outputs.

I found a solution changing buildTypes like this:
buildTypes {
release {
signingConfig signingConfigs.release
}
}

Why isn't this part of the docs?!

been scratching my head for an hour, @nicoschi has the solution there

THIS should be in the docs

In case somebody else tries the above and it still doesn't work:

My problem ended up being that I was that ~/.gradle/gradle.properties isn't referring to the file in your project directory but the one in the root directory of your operating system. Once I moved the variables to that location, I was able to generate a signed apk!

Its there in docs in buildTypes release : signingConfig signingConfigs.release
But it can be missed by any one. So there should be some special note for that. 馃憤

If you have this problem
Keystore file ... not found for signing config 'release'.

Try it:

signingConfigs {
release {
//if (project.hasProperty("key_tota.jks")) {
storeFile file("key_tota.keystore")
storePassword "@ndroid"
keyAlias "key_tota"
keyPassword "@ndroid"
//}
}
}

Was this page helpful?
0 / 5 - 0 ratings