I am pretty new to react-native development, I have a project which run properly with iOS simulator, while on android (Emulator and device) it gives Unexpected token '>' error
Try to change "android" folder name to "android-backup"
And run following in the terminal:
$cd MyProjectFolder
$npm start
$react-native start
this work refresh your android project.
also you can clean gradlew with:
$cd android
$gradlew clean
try this
Open Terminal
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
Related
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
I built a new APK after I added react-redux and persist. The debug build is working perfect but the release one seems it didn't get the new code cause its working like before.
I'm not sure, why it's happening?. I tried ./gradlew clean too but it didn't help.
Delete the build folder from the android/app directory. Delete Node Modules and do a fresh install. If this does not work then run metro bundler using the below command.
react-native start --reset-cache
The solution was to run 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/ and then building the apk again
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.
I created AwesomeProject and run react-native run-android in root directly of my project, message in android simulator is as follows:
Unable to load script.Make sure you are either running a Metro server or that your bundle 'index.android.bundle' is packaged correctly for release.
To fix this err i try to run :
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/
but it didn't work.message in android simulator
You have to start the bundler first, run
npm start
or
react-native start
in the root of your project.
I perform offline bundling of my react-native project using CMD
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/
As bundinling is done offline i dont want JS server to start each time after running the command react-native run-android.
Is there any way out to avoid starting JS server
Internally, react-native run-android starts the packager and run installDebug task on gradlew.
To just run installDebug, on your project root directory run:
cd android && ./gradlew installDebug