How to build an Android sourcemap with React Native 0.69 - react-native

I'm using Instabug for crash reports for my React Native project. I need to upload an Android sourcemap so the logs can be useful. I'm using React Native 0.69.1 and did my install via the react native docs.
Instabug says to run this command:
react-native bundle --platform android \
--entry-file index.js \
--dev false \
--bundle-output ./android/index.android.bundle \
--sourcemap-output ./android-sourcemap.json &&
zip ./android-sourcemap.zip ./android-sourcemap.json
Note, I had to replace react-native with npx. Here's the result:
zsh: command not found: react-native
zsh: command not found: --entry-file
zsh: command not found: --dev
zsh: command not found: --bundle-output
zsh: command not found: --sourcemap-output
I tried some of things mentioned in How to add sourcemap in React Native for Production? but was not able get anything to work.
Any help would be appreciated.

Related

How To create debug apk file in react native

I have a react native project. it works fine on android. but can not create debug apk file of this project.
first run this command in your terminal
npm run 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/
after this go inside your android folder by running this command
cd android && ./gradlew assembleDebug
then you can get your apk from this location
app/build/outputs/apk/debug/app-debug.apk

App being crashed after adding the react-native-jitsi-meet library

I'm trying to implement the video conference functionality by using the react-native-jitsi-meet library. But app is being crashed without showing any issue.
I have used added the package and implemented the android process for the react version > 0.60 as mentioned in the document(https://github.com/skrafft/react-native-jitsi-meet) unable to find the issue. Haven't added any code in the JS file too.
I have tried react-native-jitsi-meet module not found also but still the issue continues.
As it is specified in documentation we already changed the app.bundle as rename and it is bundling incorrectly so do this changes.
Remove the following file
android/app/src/main/assets/index.android.bundle
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/app.bundle --assets-dest android/app/src/main/res/ && cd android && ./gradlew assembleDebug

Unable to load script.Make sure you're either running a Metro server

i stuck with this error when i try npx npx react-native run-android
I got fixed this problem using the below steps.
cd MyApp
I was getting some blacklist.js some character issue. For that I referred this link and replaced sharedBlacklist character set.
(How to resolve the error on 'react-native start')
Next, I ran the below code snippet to address the bundle issue.( Ref Link :
https://medium.com/#adityasingh_32512/solved-unable-to-load-script-from-assets-index-android-bundle-bdc5e3a3d5ff)
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
Then, it started working.
Hope this helps.

How to generate the unsigned apk for android - reac-native

I tried to generate an unsigned apk to install on my other device.
I tried
cd android
then
gradlew assembleRelease
I got an "app-release-unsigned.apk" at android\app\build\outputs\apk\release
I transfered this "app-release-unsigned.apk" to my other android device. Turned on the "install unknown apps". Then installed the "app-release-unsigned.apk", but I got error
App not installed.
Did I missed any steps? Why can't I install this app? I thought for a release, the apk should have everything it need to run my app.
Try this and make sure you have created assets folder :
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 clean\
&& ./gradlew assembleDebug
After this you can find your debug apk in
/android/app/build/outputs/apk/debug
Hope it will work .

Tterm 'react-native' is not recognized when running react-native run android

I need help in building my react-native project. I have tried react-native run-android but I get the following error:
react-native : The term 'react-native' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ react-native run android
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (react-native:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Iyayi Kelvin
You will need Node, the React Native command line interface, a JDK, and Android Studio.
I assumed you have,
Development OS: Linux, Target OS: Android
Node
https://nodejs.org/en/download/package-manager/
The React Native CLI
npm install -g react-native-cli
Java Development Kit
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Android development environment
https://developer.android.com/studio/index.html
Watchman (optional)
https://facebook.github.io/watchman/docs/install.html#buildinstall
Creating a new application
$ react-native init AwesomeProject
$ cd AwesomeProject
$ react-native run-android
Note :
if you get an error as follow:
"unable to load scripts from assets 'index.android.bundle' on real device"
Then,
(If not created then) create dir as android/app/src/main/assets
Old react native version below < 0.46
$ react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
or
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
Then,
$ react-native run-android
run this command
npm install -g react-native-cli
after that just add your npm path to your system variables in environment variables
C:\Users\YOUR USERNAME\AppData\Roaming\npm