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屋!