Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native run-android do not updating modified code

I am using React native 0.52.0 and react-native-cli 2.0.1 on my Windows PC for android development. Despite all the changes i have made. When I run react-native run-android, it builds successfully but when I run it, I get the default react native screen.

The result when I run react-native run-android- enter image description here

The app I get-

enter image description here

index.js

import { AppRegistry } from 'react-native'; import App from './App';  AppRegistry.registerComponent('albums', () => App); 

app.js

import React from 'react' import ReactNative, { Text } from 'react-native'  export default const App = () => {   return (     <Text>Hello World</Text>   ) } 

When i ran react-native init albums, it was just an index.js file that was created, there was no index.android.js or index.ios.js file What am I doing wrong?

like image 436
Jonathan Utsu Undelikwo Avatar asked Jan 17 '18 15:01

Jonathan Utsu Undelikwo


People also ask

Can I run the React Native CLI without Android Studio?

If you are already familiar with mobile development, you may want to use React Native CLI. It requires Xcode or Android Studio to get started.

Why is React Native slow on Android?

Slow app launch is another issue of React Native apps. If your app opens too slowly, you probably have too many dependencies in your app and you're using slow components. Try to use fast, high-performance components and decrease the number of dependencies in your app.


1 Answers

Assuming that you are in the right folder, try to do this:

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 have index.android.js, do this instead:

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/ 

Then just execute react-native run-android.

like image 50
SmoggeR_js Avatar answered Sep 21 '22 16:09

SmoggeR_js