I tried to get an unsigned APK. I used the following steps
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug
and then
cd android
assembleDebug
and I also tried
cd android
assembleRelease
I get two APKs. the debug APK get an error that the developement server is not found.
So I used the release APK to install on my device but that doesnt work either. I can install the app.
I dont need an sigend APK just a usignes APK for testings.
EDIT: forgot to say that I'm working on Windows.
Related
I'm struggling with this issue where I can't generate a APK locally with my coded changes in a React Native 0.67.2 project.
I already did run some of those commands down below to generate a new updated bundle:
npx react-native bundle --entry-file index.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res
But everytime after running npx react-native run-android --variant=release, it installs an older version of my project.
If I just run it as default npx react-native run-android, which is as debug it works perfectly and install the updated version on my emulator.
It doesn't makes any sense to me, what am I doing wrong?
Try using this command to generate a new APK :
cd android && ./gradlew clean assembleRelease -PMYAPP_UPLOAD_STORE_PASSWORD=foo -PMYAPP_UPLOAD_KEY_PASSWORD=foo
And you'll find it in
yourProject/android/app/build/outputs/apk/debug/app-debug.apk
i have a react native app and im able to run it when i connect my phone and run the command react-native run-android but when i go to github and download the apk file from android/app/build/outputs/apk/debug/app-debug.apk and install the app i get this
i have android:usesCleartextTraffic="true" but i dont know what else to do
use below commands to create debug apk
1.
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
cd android && ./gradlew assembleDebug
Android Studio is generating very old apk for react-native project like 3 months old. But running perfectly in emulator while running this command "react-native run-android"
Process -
* Open file location
* Build => Build Bundles => Build APK
Tried re-installing android studio but still getting old APK
In the old react-native version, when we generate the android APK, sometimes the bundle is old, we have to generate it by ourself.
In the react-native 0.61, I find the problem is dismissed.
In the old version, firstly you should add the following script to the package.json
"scripts":{
...
"bundle-android": "react-native bundle --entry-file index.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res",
...
}
the when you generate the apk , you firstly run the follwing script in the termail to generate the new bundle
npm run bundle-android
when the bundle outputs successfully, then go into the android directory and assemble the APK
cd android
./gradlew assembleRelease
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/
If you get an error of duplicate resources than go to res folder and delete the drawable-hdpi,drawable-mdpi,drawable-xhdpi,drawable-xxhdpi,drawable-xxxhdpi folder only and try to rebuild the project. It will work.
It is because, you have old index.android.bundle file. Follow these steps to update this file and create a new apk:
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
curl "http://localhost:8081/index.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
cd android && ./gradlew clean assembleDebug
Can't generate signed apk that can be installed directly on device without connecting to the server.The command given in new documentation is
cd android
$ ./gradlew bundleRelease
which will generate .aab file and app-debug.apk only.
can I use the below command to generate apk in react native 0.60-RC? Can't find that command in their updated document.
$ ./gradlew assembleRelease
.aab is a bundle file which can replace release .apk, anw, you can open Android Studio, build a release APK follow Build/Generate Signed Bundle(s)/ APK and tick on APK checkbox
UPDATE
.aab cannot install directly, but if you want to install the app on a real device without a server (node), you can using below way
Step 1:
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
Step 2:
cd android
$ ./gradlew assembleDebug
now the debug APK file includes the bundle server, so you can install it on your real device independently.
I think title explains itself my problem, on emulator everything works as it should be, when apk builded I have transfered it on my smartphone and there's errors:
https://imgur.com/a/pSEKXHx
I was have the same issue when i assemble Release/Debug apk and install it on my physical smartPhone
Do this commands in your Project Directory :
mkdir android/app/src/main/assets
(if you have the assets folder you will see error like directory is already exist ... no problem! go to next 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
react-native run-android or assemble the apk
it should work GOOD LUCK