giscafer / app-study

app开发学习
MIT License
0 stars 0 forks source link

react-native run-android issues #3

Open giscafer opened 7 years ago

giscafer commented 7 years ago

Problem

Execution failed for task ':app:installDebug'. com.android.builder.testing.api.DeviceException: No connected devices!

Solving:

没有启动AVD,启动模拟器后再执行语句即可

emulator -avd [AVD_for_Nexus_6_by_Google]

react-native run-android

参考:https://github.com/facebook/react-native/issues/2711

giscafer commented 7 years ago

Problem

haxm not compatible with windows

http://stackoverflow.com/questions/41092207/the-intel-x86-emulator-accelerator-haxm-installer-revision-6-0-5-is-showing-no

giscafer commented 7 years ago

Problem

12:16:16 E/adb: Unable to obtain result of 'adb version' :app:installDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:installDebug'. com.android.builder.testing.api.DeviceException: Timeout getting device list.

http://stackoverflow.com/questions/34754816/react-native-run-android-appinstalldebug-failed http://stackoverflow.com/questions/35959350/react-native-android-genymotion-adb-server-didnt-ack

giscafer commented 7 years ago

Problem

Error occurred during initialization of VM Unable to allocate 130176KB bitmaps for parallel garbage collection for the requested 4165632KB heap. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

内存不足

giscafer commented 7 years ago

Problem

unfortunately AwesomeProject has stoped

http://stackoverflow.com/questions/35406657/react-native-android-application-has-stopped

giscafer commented 7 years ago

Problem

Invariant Violation:Applicaction 项目名 has not been registered.This is either due to a require() error during initialization or failure to call AppRegistry.registerCommponent.

程序名称没有保持一致或者是如react-native在运行程序A而你打开了程序B,也会出现相同的问题。解决方法很简单,关掉命令行运行程序。ctrl+c,运行你想运行的程序。

http://www.jianshu.com/p/82a09063e61c

giscafer commented 7 years ago

Problem

could not get BatchedBridge , make sure your bundle is packaged correctly

解决方案1:

在演示机(或虚拟机)上Dev Setting里设置IP和端口,eg:127.0.0.1:8081

然后访问:http://IP:端口/index.android.bundle?platform=android&dev=true&hot=false&minify=false验证是否正常,正确后即可解决。

方案2: 1、Create theandroid/app/src/main/assets folder

2、run react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --sourcemap-output android/app/src/main/assets/index.android.map --assets-dest android/app/src/main/res/on the project root

3、Then assets will generate three filesindex.android.bundle index.android.bundle.meta index.android.map

4、Last run project react-native run-android

http://stackoverflow.com/questions/38870710/error-could-not-get-batchedbridge-make-sure-your-bundle-is-packaged-properly

https://github.com/facebook/react-native/issues/9336

http://www.cnblogs.com/LiuZhen/p/5971176.html

giscafer commented 7 years ago

Problem

Element type is invalid: expected a String(for built-in components) or a class/function(for composite components) but got:object

giscafer commented 7 years ago

Problem

double rr刷新后 cannot connect to development server

giscafer commented 7 years ago

Problem

Execution failed for task ':app:preDexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.E xecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe' ' finished with non-zero exit value 1

cd android && ./gradlew clean && cd ..