I'm working on an Android app with React Native.
For testing and developing I just follow the regular dev workflow with a server on my dev machine, reload JS, etc.
Now I want to pass the APK to other people in my company so that they can test the app on their device.
I've been looking into the android folder on my React Native project but I can't find an APK ready to send to other people. It seems the only APK was built when I created the project a few weeks ago, and I'm assuming this APK does not contain any JS code.
I've found these instructions for building a signed app for the Play Store, but I don't need to distribute this APK on the Play Store.
So, how do I create a self contained APK with the JS files and assets that I can easily pass to other people for testing?
From the link you already had in the question, you can skip over the signing details, and just go to "Generating the release APK"
Simply run the following in a terminal:
$ cd android && ./gradlew assembleRelease
Gradle's assembleRelease will bundle all the JavaScript needed to run your app into the APK.
...
The generated APK can be found under android/app/build/outputs/apk/app-release.apk, and is ready to be distributed.
Related
It's been so long since I develop a mobile app in react native, when I'm developing before, I usually generate a release apk and send it to my clients so that they can test it and have experienced it, but now when I build a release in react native, it returns a .aab instead of .apk, how can I send my application to the clients when I only get .aab format on my project?
It using for different android devices installation by google play store. that's why you can use apk build for manual installation.
You must use the below command for the testing build.
$ cd android
$ ./gradlew assembleRelease
As mentioned repeatedly in many places .aab file is efficient. But we need .apk for regular task (except PlayStore).
So:-
Create signed output of Android project Link
Use command $ npx react-native run-android for debugging.
Finally $ npx react-native run-android --variant=release Link, to create release version, which is created at android/app/build/outputs/bundle/release/app.apk
Go crazy
Just for the information. If you upload the AAB to Google Play instead of the APK, it will lead to smaller download sizes. AAB lets Google Play create different APKs to different devices, based on the device screen density, language, and CPU architecture. So, if you're able to create AAB's, use them over APK's.
cd android
./gradlew bundleRelease
The generated AAB can be found under
android/app/build/outputs/bundle/release/app-release.aab
, and is ready to be uploaded to Google Play
I'm developing an android application with react-native (0.59), and I want to test it on different devices. My goal is to create an .apk file that can be installed by simply transferring the file, without any requirement for development server running, usb cables, etc..
I have looked at different reply on previous questions about the subject but so far nothing as worked.
This reply still needs a dev-server to run: How to generate dev APK file without asking for dev settings server ip in react native
This reply generate an apk that won't install on the device with the error "app not installed": Build and Install unsigned apk on device without the development server?
I have tried the publish method from the react-native docs (ref: https://facebook.github.io/react-native/docs/signed-apk-android), I generated the .aab file, then I use bundletools to convert it with apks, as explained here: Generate Apk file from aab file (android app bundle) in this answer:
So far nobody has provided the solution to get the APK from an AAB.
This solution will generate a universal binary as an apk.
Add --mode=universal to your bundletool command (if you need a signed
app, use the --ks parameters as required).
bundletool build-apks --bundle=/MyApp/my_app.aab
--output=/MyApp/my_app.apks
--mode=universal Change the output file name from .apks to .zip
Unzip and explore
The file universal.apk is your app
This universal binary will likely be quite big but is a great solution
for sending to the QA department or distributing the App anywhere
other than the Google Play store.
But unfortunately in my case, when I open the .zip file, there's no file called universal.apk:
All the .apk are pretty small in size (around 10mb, while the .aab file is 300).
Is there any other solution?
After you go through https://facebook.github.io/react-native/docs/signed-apk-android you can simply run
// for build and run
react-native run-android --variant=release
and take apk in
<rn_project_dir>/android/app/build/outputs/apk/release/app-release.apk
I'm trying to build a Singed apk using android studio. I'm using react-native. As new to this field I actually can not find how to make it. I just run it from terminal and it just builds from there.
What are the process for building a Signed apk using react-native.
The React Native Documentation for Generating a Signed APK is fairly comprehensive and should answer your question.
Be careful when generating your keystore - if you lose this you won't be able to upload updates to Google Play.
Follow this guide to sign your APK: https://facebook.github.io/react-native/docs/signed-apk-android.html#adding-signing-config-to-your-app-s-gradle-config
Run ./gradlew assembleRelease on android folder and your signed APK will be compiled in android/app/build/outputs/apk.
I am developing an android application. All the things is going well when I run the application into genymotion virtual device.And Since the apk is stored in F:...\app\build\outputs\apk location. So I just want to collect it from this location and download it to install in a android phone.As I simultaneously updating the application with code but this apk doesn't provide me the updated apk file according to the updated code .They just give me the old apk file even if i run my application again and again from the android studio. Can anyone suggest me why this is happening ??? I just want to run this apk into phone or download this apk file for another purpose.
This three steps will do Go build->Build apk
Go to Build > Build APK to generate a normal APK.
Go to Build > Generate Signed APK to generate signed APK.
Signed APK are those which we generate to release our application. Here it is, why is it necessary to generate signed APKs: Why should I Sign my Application APK before release
If you build a debug APK, it will still work on all devices but you cannot release it.
From terminal run the following command to make sure that you get the updated apk.
1. gradle clean (from windows )
-or-
./gradlew clean (from linux) -
Above command deletes the build folder.
2. gradle build (from windows)
-or-
./gradlew build(from linux)
Above command builds all the flavor for your application.
Edit: Original answer
Signed apk is needed to install in any other non debug device. This will be same as the debug app that runs in your test device/emulator.
Build -> Generate signed apk
Have looked around and I cannot see a clear answer to this question. I can see that the Phonegap Build service can assist with signing and Android APK file for submission into Google Play Store.
I am using Apache cordova locally with CLI to build, test and run my Android/iOS apps. My question is, how do I sign the APK file using Cordova CLI, not PGB? My app is too big for PGB.
Would I have to move the project into Eclipse IDE and do it there?
You do not sign an app with Cordova CLI. Cordova CLI has limited support for platform specific operations, and Android app signing is definitely one of those.
To sign the app (full instructions here: http://developer.android.com/tools/publishing/app-signing.html):
Create a keystore (only need to do this once)
cd [appname]/platforms/android/
edit ant.properties and add these values
key.store=[location of keystore]/android-release-key.keystore
key.alias=[name of your key]
Remove android:debuggable="true" from the AndroidManifest.xml before you run 'ant release'
run ant release and enter the passwords as needed
At the end, you should have a signed app ready for upload to Google Play.
with eclipse you can sign you apk very easily.
Just right click on project and got to Android Tools-> Export Signed Application Package-> click Next-> Select Create new keystore-> browse location and enter passowrd for keystore -> click Next->fill all information and finish the process.
Now you have a signed apk which you can install on any android device.
Hope this helps..
Thanks