RN环境配置的问题
问题一
由于仅部分匹配或匹配不明确,因此无法迁移设备 USB\VID_22D9&PID_2046\DUKJMRAU9L9D4SDU。
解决方案:需要在点击USB调试按钮时选择传输文件。如果选择充电的话就会显示没有连接上设备。
问题二
在运行命令:
yarn andriod
之后报错
原因:由于app目录处于’F:/猪/reactnative/code/myApp’中,其中有中文,因此将中文目录变成全英文目录即可解决问题。
问题三
在运行命令:
yarn andriod
之后报错:
error Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses".
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;30.0.2 Android SDK Build-Tools 30.0.2
platforms;android-30 Android SDK Platform 30
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
解决方案:
问题四
在运行命令:
yarn andriod
之后报错:
> Task :app:installDebug
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device DUKJMRAU9L9D4SDU: null
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device DUKJMRAU9L9D4SDU: null
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device DUKJMRAU9L9D4SDU: null
Skipping device 'DUKJMRAU9L9D4SDU' for 'app:debug': Unknown API Level
> Task :app:installDebug FAILED
31 actionable tasks: 31 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any devices.
解决方案:
在当前根目录下运行以下步骤 :
1 cd android
2 ./gradlew clean
3 cd …
4 npm cache clean --force
5 yarn android