Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate With Existing Android project will crash! #9184

Closed
xinzhuangbao opened this issue Aug 3, 2016 · 2 comments
Closed

Integrate With Existing Android project will crash! #9184

xinzhuangbao opened this issue Aug 3, 2016 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@xinzhuangbao
Copy link

xinzhuangbao commented Aug 3, 2016

after learned the doc https://facebook.github.io/react-native/docs/integration-with-existing-apps.html , I new a MyReactActivity as follows

image

I did all steps mentioned in that doc , and confirmed that the configuration is corrent . but when i run the app , it will crash , (the react-native version is 0.30.0 , run in the android emulator,and the package server had been started and was live ) ,here is the logs

08-03 09:32:45.215 1216-2098/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
08-03 09:32:45.697 2699-2699/com.awesomeproject E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.awesomeproject, PID: 2699
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Could not connect to development server.
Try the following to fix the issue:
Ensure that the packager server is running
Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to y
at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:912)
at com.facebook.react.ReactInstanceManagerImpl.access$700(ReactInstanceManagerImpl.java:99)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:196)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:179)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

and sometimes the package server will stoped when build android project , e.g.

image

who can help me ! I had try all the method what I can think of , I just want integrate the react-native to my existing android project . sorry for my poor english !

@humlk
Copy link

humlk commented Aug 3, 2016

连不上开发服务器吧!
仔细看你的报错信息,log中有说明: "If you're on a physical device connected to the same machine, run ' adb reverse tcp:8081 tcp:8081 ' to forward requests from your device"。
cmd下运行一次“adb reverse tcp:8081 tcp:8081”。

@xinzhuangbao
Copy link
Author

after add this code
"".setUseOldBridge(true).setUseDeveloperSupport(true)"" , it run success! thank you !

@hramos hramos closed this as completed Nov 1, 2016
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants