Provash
Provash

Reputation: 2002

React Native - No app-release.apk

I'm trying to generate release apk for my react native app. I'm using react native 0.29. I'm following the instructions in https://facebook.github.io/react-native/docs/signed-apk-android.html

Here is the output of my terminal:

→ cd android && ./gradlew assembleRelease
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0291Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources
AAPT: /home/shoumma/Workspace/ReactNativeWorkspace/notesApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /home/shoumma/Workspace/ReactNativeWorkspace/notesApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /home/shoumma/Workspace/ReactNativeWorkspace/notesApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT: /home/shoumma/Workspace/ReactNativeWorkspace/notesApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
:app:bundleReleaseJsAndAssets
[11:36:55 AM] <START> Building Dependency Graph
[11:36:55 AM] <START> Crawling File System
[11:36:56 AM] <START> find dependencies
[11:36:59 AM] <END>   Crawling File System (4208ms)
[11:36:59 AM] <START> Building in-memory fs for JavaScript
[11:37:00 AM] <END>   Building in-memory fs for JavaScript (350ms)
[11:37:00 AM] <START> Building in-memory fs for Assets
[11:37:00 AM] <END>   Building in-memory fs for Assets (251ms)
[11:37:00 AM] <START> Building Haste Map
[11:37:00 AM] <START> Building (deprecated) Asset Map
[11:37:00 AM] <END>   Building (deprecated) Asset Map (123ms)
[11:37:00 AM] <END>   Building Haste Map (485ms)
[11:37:00 AM] <END>   Building Dependency Graph (5337ms)
[11:37:24 AM] <END>   find dependencies (28446ms)
bundle: start
bundle: finish
bundle: Writing bundle output to: /home/shoumma/Workspace/ReactNativeWorkspace/notesApp/android/app/build/intermediates/assets/release/index.android.bundle
bundle: Done writing bundle output
bundle: Copying 5 asset files
bundle: Done copying assets
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:compileReleaseJavaWithJavac UP-TO-DATE
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources UP-TO-DATE
:app:lintVitalRelease
:app:preDexRelease UP-TO-DATE
:app:dexRelease UP-TO-DATE
:app:packageRelease UP-TO-DATE
:app:assembleRelease

BUILD SUCCESSFUL

Total time: 57.742 secs

But there is no app-release.apk in android/app/build/outputs/apk/app-release.apk

I have generated the my-release-key.keystore and placed it in android/app. Then I add the global variables ~/.gradle/gradle.properties:

MYAPP_RELEASE_STORE_FILE="my-release-key.keystore" [i also tried without double-quotes]
MYAPP_RELEASE_KEY_ALIAS="my-store-alias"
MYAPP_RELEASE_STORE_PASSWORD="******" [added my password]
MYAPP_RELEASE_KEY_PASSWORD="******" [added my password]

Then I have added singingConfigs in android/app/build.gradle:

signingConfigs {
    release {
        storeFile file(MYAPP_RELEASE_STORE_FILE)
        storePassword MYAPP_RELEASE_STORE_PASSWORD
        keyAlias MYAPP_RELEASE_KEY_ALIAS
        keyPassword MYAPP_RELEASE_KEY_PASSWORD
    }
} 

Then I run the command cd android && ./gradlew assembleRelease from my project folder. But no luck, I don't have any app-realease.apk. Is there any point am I missing?

Upvotes: 2

Views: 2566

Answers (2)

arslan
arslan

Reputation: 1144

If you have successful build after official please run the below command

npx react-native run-android --variant=release

and after success you can find apk here android/app/build/outputs/apk/release

it works for me

Upvotes: 1

Provash
Provash

Reputation: 2002

I was such an idiot. I get so frustrated that I didn't notice, I had to add one more line to android/app/build.gradle. What I missed was to add the following line inside buildTypes:

buildTypes {
    release {
        ...
        signingConfig signingConfigs.release
    }
}

Also I had to remove double-quotes from ~/.gradle/gradle.properties:

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-store-alias
MYAPP_RELEASE_STORE_PASSWORD=******
MYAPP_RELEASE_KEY_PASSWORD=******

Yes, I got my app-realease.apk in the end!!! :-D

Upvotes: 7

Related Questions