简体   繁体   中英

React Native doesn't work in physical Android Device

I'm having issues to run my react native apps in physical devices. When I execute react-native run-android using a Genymotion virtual device for example, it works perfectly.

But when I try to execute in physical connected devices, i get multiple errors. I tried 2 different devices, and checked with "adb devices" if they are connected, they do.

When I try to just execute "react-native run-android", I get the following error: (and nothing appears on physical device)

react-native run-android

But when I check for devices, and use the device id when executing like: "react-native run-android --deviceId E6D68T7P99999999", I get the new error: (but now appearing "Unable to load script from assets 'Index.android.bundle'." on the device)

react-native run-android --deviceId E6D68T7P99999999

Also I have tried some other ways In my project folder android/app/build.gradle, I changed where it was compile "com.facebook.react:react-native:+" to compile "com.facebook.react:react-native:0.44.0" This makes to BUILD appears SUCESSFULL, but otherwise, in the physical device appears like: "The development server returned response error code: 404 URL: etc etc. BODY: Cannot GET /index.android.delta?platform=android&dev=true&minify=false"

将 build.gradle 从“+”更改为“0.44.0”

Can anyone help me please? I tried all the ways, using react-native start, killing process on port 8081 but NOTHING works with me!

React Native version: 0.44.0, Windows 7 x64, Tried on 2 different devices and Developer mode and usb debugging mode ON

Try using adb install -r to reinstall your apk. I notice that your error says the apk already exists.

Failure [INSTALL_FAILED_ALREADY_EXISTS] when I tried to update my application

I had the same problem today and I do not know whether you have solved your problem, but for me, I had to add "ANDROID_HOME" environment variable(specify the SDK path). I hope it helps anyone who might come in contact with such problem

There's actually a hand full of things you could try to fix this problem.

1) npm install

2) npm start -- --reset-cache

3) Delete node_modules then npm install

4) cd to android and gradlew clean

5) Make sure all of your Java SDKs or what not are in the correct system path.

6) Restart your computer then try again.

Let me know your progress once you tried these options!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM