After run thisin cmd
react-native bundle --platform android --dev false--entry-file index.js--bundle-output android/app/src/main/assets/index.android.bundle--assets-dest android/app/src/main/res/
cd android &&./gradlew assembleDebug
then you can get apk app/build/outputs/apk/debug/app-debug.apk
Before uploading the release build to the PlayStore,
make sure you test it thoroughly.mkdir-p android/app/src/main/assets
react-native bundle --platform android --dev false--entry-file index.js--bundle-output android/app/src/main/assets/index.android.bundle--assets-dest android/app/src/main/res
react-native run-android --variant=release
ExportApk-
cd android &&./gradlew bundleRelease -x bundleReleaseJsAndAssets
-YourAABBUNDLE will be present in the folder
<project>/android/app/build/outputs/bundle/release
DebugAPKHow to generate one in3 steps?Step1:Go to the root of the project in the terminal and run the below command:
react-native bundle --platform android --dev false--entry-file index.js--bundle-output android/app/src/main/assets/index.android.bundle--assets-dest android/app/src/main/res
Step2:Go to android directory:
cd android
Step3:Nowinthis android folder, run this command
./gradlew assembleDebug
There! you’ll find the apk file in the following path:
yourProject/android/app/build/outputs/apk/debug/app-debug.apkReleaseAPKStep1.Generate a keystore
You can create one using the keytool in the terminal with the following command:
keytool -genkey -v -keystore your_key_name.keystore-alias your_key_alias -keyalg RSA-keysize 2048-validity 10000Once you run the keytool utility, you’ll be prompted to type in a password.*Make sure you remember the password
Step2.AddingKeystore to your project
Copy the file your_key_name.keystore and paste it under the android/app
directory in your ReactNative project folder.OnTerminal:
mv my-release-key.keystore/android/app
ReleaseAPKGenerationPlace your terminal directory to android using:
cd android
ForWindows,
gradlew assembleRelease
ForLinux and MacOSX:./gradlew assembleRelease
As a result, the APK creation process is done.You can find the generated APK at
android/app/build/outputs/apk/app-release.apk.
ReactVersion0.62.1In your root project directory
Make sure you have already directory=> android/app/src/main/assets/,if not create directory, after that
create newfile and save as index.android.bundle
and put your file like this android/app/src/main/assets/index.android.bundle///////////////////////// building bundles ////////////////////////
npx react-native bundle --platform android --dev false--entry-file index.js--bundle-output android/app/src/main/assets/index.android.bundle--assets-dest android/app/src/main/res////////////////////////// building Debug Apk ////////////////////////
cd android &&./gradlew assembleDebug
////////////////////////////Get the Apk///////////////////////////
cd app/build/outputs/apk////////////////////////// building Release Apk ////////////////////////
cd android &&./gradlew assembleRelease
Place your terminal directory to android using:
cd android
)================ForWindows,
gradlew assembleRelease
)=================)=================ForLinux and MacOSX:./gradlew assembleRelease
)==================
cd android
./gradlew assemble
</----ifthis error shows up
Could not open settings generic classcachefor settings file
>BUG! exception in phase 'semantic analysis'in source unit '_BuildScript_'Unsupportedclassfile major version 60ChangeJava version to the 8 or 11 and execute ./gradlew assembleRelease
-----/>
java -version
/usr/libexec/java_home -v 1.8.0_311--exec javac -version