phuchoangmai
phuchoangmai

Reputation: 305

React-native can not map tcp port with device


I'm a newbie in React-native. In the first project. I init react project with command line react-native init <project name>
This environment: nodejs: v4.5.0, npm: 4.1.2 and ANDROID_HOME.
When I run adb device enter image description here
But when I run project react-native run-android enter image description here
I try run command line adb reverse tcp:8081 tcp:8081 but it not working. Who can tell me fix this error. Thanks

Upvotes: 1

Views: 342

Answers (3)

Thanh Nguyen
Thanh Nguyen

Reputation: 5352

Install Android SDK v23 should resolve your problem.

enter image description here

Update answer:

Android API 23 I installed but when I install Android SDK Build-tool 23.0.1 it's working while Android SDK Build-tool 23.0.2 or 23.0.3 not working

Because 23.0.1 is the default SDK version for a React Native project. I don't know how to modify this but if you want to see the build version, checkout this file android/app/build.gradle. You would see a section with following content:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
}

Upvotes: 2

Tom Walters
Tom Walters

Reputation: 15616

You need to install the Android build tools via Android Studio.

  1. Open Android Studio
  2. Go to Tools > Android > SDK Manager
  3. Click "Launch Standalone SDK Manager" at the bottom of the window
  4. Find the referenced package and check it (see below)
  5. Click "Install packages..."
  6. Agree to the licences

Android SDK Manager

You should then be able to build onto the device.

Upvotes: 0

challenger
challenger

Reputation: 2214

Did you enable developer options on your phone? if not check this line: enable developer options on android device

Upvotes: 0

Related Questions