after upgrading my react-native app to version 0.60.5, the application works just fine in debugging mode but when i try to get the android release files of my app by running this command:
react-native run-android --variant=release
the progress gets stuck at this line:
> :app:transformClassesAndResourcesWithR8ForRelease
and hangs on forever
note: i tried to delete the build and gradle folders and run ./gradlew clean but didn't work either
The command you want to use is a command to test APK, and you need to set it up to sign the app before that.
Note: that --variant=release is only available if you've set up
signing as described above.
See this official document to create a release app for signature and upload keys.
Related
Just rebuilt React Native app as the previous version failed in building on Android emulator. The React Native is upgraded from 0.66 to 0.67 and a few other modules, such as React Native gesture handler, were upgraded as well.
The app works fine on Android 2021.1.1 Patch 2 emulator. However after downloading the release package from the distribution server, the app installed on Android 10 device quits as soon as launching without giving any error.
What is the problem with the release package? Here is the build steps:
./gradlew bundleRelease
bundletool build-apks to build mypackage.apks with signature.
unzip it into mypackage.apk
Connecting android device to dev Mac using USB cable, the app was launched successfully on the real device. And the app can be launched successfully late as well. I notice that the size of the app is 77MB which is about twice as big as the app installed from the universal apk.
If you need to check apk on real device, follow this build steps:
Release APK Generation.
Place your terminal directory to Android using:
cd android
Then run the following command:
For Windows:
gradlew assembleRelease
For Linux and Mac OSX:
./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. This is the actual app, which you can send to your phone or upload to the Google Play Store. Congratulations, you’ve just generated a React Native Release Build APK for Android.
There are frequent errors that show up in this process sometimes, which is typical to a React Native app, given React Native is continuously evolving. We are laying out here the most frequent React Native build errors that we ran into, to save you time and headaches.
I recently started working with flutter. I have been making several test applications. They all work well on emulators.
But now I want to be able to use them on my cell phone.
I took the APK that is generated when I run the application in the emulator, indicated in this route:
But it always fails to install
So far, my applications are simple, Hello world, Add numbers, etc.
Any ideas?
How should I do it correctly?
First: Open your Terminal/Shell/Command Line and open the directory of the Flutter App in there (cd PATH_TO_YOUR_FILE)
You probably want to create a profile-mode apk for testing. This build still helps debugging while having the speed of the --release version:
This creates a single APK which works on all devices (x64, arm64 and arm), it's probably pretty big:
flutter build apk --profile
If the people who install your App know which devices they have, you can use the split-per-abi command which creates three different APKs for all architectures (x64, arm64 and arm)
flutter build apk --profile --split-per-abi
If you want to have a release build, you can use what #Niteesh commented:
flutter build apk --release --split-per-abi
Release-builds can be uploaded to Google-Play (also the internal testing)
Read more: https://flutter.dev/docs/testing/build-modes
the apk that is generated when you run the app is the debug-apk, it contains lots of overheads which helps in flutter hot reload and hot restart. The size of debug apk version is also a lot.
use this command to generate release version of apk
flutter build apk --split-per-abi
After execution of the command, you get the path of the apk, something like this
√ Built build\app\outputs\flutter-apk\app-armeabi-v7a-release.apk (7.0MB).
Then you can install that apk on your phone
I’m using react-native-push-notifications to send local notifications on my react native app. The app works perfectly on my android emulator and on any physical device while using react-native run-android. But when I signed my app and build an apk throw gradlew assemblerelease the apk builds without compiling react-native-push-notifications and the app does not send notifications. I think I should link the plugin with build.gradle but I’ve searched for a while and didn’t figure how.
So, I'm stuck with an error after generating APK with React-Native. I tried on multiple computers, 32-bit and 64-bit operating system and had no success.
How I got here
First, I created my app with
create-react-native-app suporteecontrole
Then I started developing my app, installing dependencies, and etc. After making sure that the APP was running without any errors, I ejected with the command line:
npm run eject
I've put my expo credentials and it worked without any errors too. I figured that it was going to work.
Generating APK's
To generate APK, i followed the instructions on this link:
React Native Build Signed APK
1 - I installed the JAVA 8 SDK, and all dependences too.
2 - I generated the Key by following the step one on the link.
3 - I changed all gradle files according to the link
4 - Then I runned this lines on cmd:
cd android
And
gradle assembleRelease
No errors popped up. I made it to the build successfully.
So, It generated some files: app-dev19-release.apk, app-dev-release.apk, app-devRemoteKernel-release.apk, app-prod-release.apk.
I installed app-prod-release.apk on my mobile, and returns an Expo error:
Could not load app
photo_2018-07-24_12-57-51
I searched Google for this, and found nothing.
Can anybody help me with this?
It is frustrating how the create-react-native does expo by default instead of normal react app. But you've already ejected from the expo app, and your code now wont be working on it.
Instead you'll see a new app on your phone with the name and icon you chose. Try to find the App and run it. And to assemble a release, you actually need to sign it too, so I hope you've done the signing right. Take a look at this https://facebook.github.io/react-native/docs/signed-apk-android.html for signing if you face that error.
when i built the APK with react native in windows with the debug version it worked fine (also in the emulator) and installed in the real device, but when i tried to build with the release version i saw the message ( app not installed ) , the problem is i have no way to trace or debug this problem (probably i don't know ), i tried to fix this problem for about one week ,so i ask for some help here , thanks
gradlew assembleDebug --- installed fine
gradlew assembleRelease --- app not installed
also i added this lines to gradle.properties file in my project
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=123456
MYAPP_RELEASE_KEY_PASSWORD=123456
other details
react native version 0.48 ---
my device android version 5.0
windwos version 8.1
the project is AwsomeProject --- the initial projects to test
NOTE : in all situations i see the message "BUILD SUCCESSFUL" and the file generated without any problem or any error message
$ cd android && gradlew assembleRelease creates a signed apk.
(Note: Don't forget to cd out of <MyProject>/android after creating a signed apk back the root of your directory)
$ react-native run-android --variant=release will install the signed apk onto your device
It is all about adding this line in the gradle.properties file
signingConfig signingConfigs.release
hope it help someone
You need to generate some certificates to be able to run your signed APK , in the RN docs that is documented.
Please check this out RN Docs