报错解决方案

1、无法远程调试,链接不上远程调试服务器

报错:unable to connect with remote debugger

解决方案:

  • Press Cmd + M on emulator screen
  • Go to Dev settings > Debug server host & port for device
  • Set localhost:8081
  • Rerun the android app: react-native run-android

将调试器改为localhost:8081,重启服务即可。

2、Could not read path 'C:\MyApp\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-az-rAZ'

Have you tried to run:

cd android && gradlew clean
cd .. && react-native run-android
This can solve some problems on Android :)

Or if this doesn't work, you can try to remove the android/app/build folder altogether.

3、SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'F:\react\AwesomeProject\android\local.properties'

解决方案:在android文件夹下面新建 local.properties 文件,在文件中输入以下路径:

For windows users:
sdk.dir=C\:\\Users\\UserName\\AppData\\Local\\Android\\sdk
For Mac users:
sdk.dir = /Users/USERNAME/Library/Android/sdk
For Linux (Ubuntu) users:
sdk.dir = /home/USERNAME/Android/Sdk
Where USERNAME is your linux username(Linux paths are case-sensitive: make sure the case of S in Sdk matches)

In case if this doesn't work, add ANDROID_HOME variable in "Environment Variables" as C:\Users\USER\AppData\Local\Android\Sdk

你可能感兴趣的:(报错解决方案)