React native Android Simulator debug

Source: Internet
Author: User

Simulation machine debugging first to confirm that your environment variable path is not the ADB paths, ADB generally in the Android ADK directory under Platform-tools, Android directory by default in the C disk user/administrator (user default words ) in/appdata/

If you're using the emulator that comes with Android studio, you can play it like this.

Run

C:\Users\Administrator\AppData\Local\Android\Sdk\emulator\emulator.exe-netdelay none-netspeed FULL-AVD NEXUS4 _api_27

This command to ensure that the Emulator.exe directory is correct, generally in the Android directory tools or in emulator, like me in this case two directories, emulator can be executed, the other one does not, the reason is unknown.

The nexus4_api_27 behind the-AVD parameter is the name of your virtual machine and you can see it in Android Studio.

Then you run React-native run-android under the project root to see that the project is running on the virtual machine.

Or you can use the other Android simulator, I'm using the night God Simulator,

Run a command first

adb connect 127.0. 0.1:62001

You can then pass

ADB devices See if the device is added

After

Then modify the IP,IP address is your computer's IPv4 address, where you can directly use the ipconfig command to see the address, but each boot may assign you a different IP, you can go to fix your IP, go to the network settings on the computer to find the adapter

Modify the IPv4 network, this look at the personal situation

After you run the react-native run-android command in the project root directory

May report some errors

For example, unable to load script form assets

The solution is to first create a assets directory in the Android/app/src/mian of the project

Then run the root directory

false --entry-file index.android.js--bundle-output android/app/src/main/assets/ Index.android.bundle--assets-dest Android/app/src/main/res

It is important to note that the new version Reactnative project created with React-native Init has no index.android.js, only index.js, so you need to put index.android.js Run as Index.js, or there will be a series of errors,

For example, the could not connect to Development Server error may be the cause of this.

Before running react-native run-android, it is best to restart the night God Simulator.

Some blogs on the internet say that running the ADB command is run in the bin directory of the night God simulator, but if you have already configured the Platform-tools path under the Android directory in the environment variable, Run the ADB connect command directly in any directory that has ADB in addition to the night God Simulator or other simulator, or you may get an error.

If you want JS remote debugging, then choose Debug JS remotely

Then the browser input http://localhost:8081/debugger-ui/(I started with IP, but there are cross-domain issues)

Then go to the choice reload (I have been in the browser ctrl+r, but has no effect, find a half day results found that is the reason, aerobic)

React native Android Simulator debug

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.