React Native Run-Android不更新修改后的代码 [英] React native run-android do not updating modified code
问题描述
我在Windows PC上使用React native 0.52.0和react-native-cli 2.0.1进行android开发.尽管我进行了所有更改.当我运行react-native run-android
时,它会成功构建,但是当我运行它时,会得到默认的react native屏幕.
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.
我运行react-native run-android
-时的结果
我得到的应用程序
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>
)
}
当我运行react-native init albums
时,它只是创建的index.js文件,没有index.android.js或index.ios.js文件
我在做什么错了?
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?
推荐答案
假定您在正确的文件夹中,请尝试执行以下操作:
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/
如果您拥有index.android.js,请改为执行此操作:
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/
然后只需执行react-native run-android.
Then just execute react-native run-android.
这篇关于React Native Run-Android不更新修改后的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!