繁体   English   中英

我无法执行 npx react-native run-android,Java 错误; 无法确定任务“:app:compileDebugJavaWithJavac”的依赖关系。 LINUX

[英]I can't do npx react-native run-android, Java error; Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. LINUX

有很多 Mapping new... 日志,所以我删除了一大块,因为我超出了可用字符数

(我不确定这是否是问题所在)它说这与许可证有关,但据我所知,我已经全部接受了。

在图片中,我向您展示了我通过 Android Studio 安装的内容,一切似乎都很好。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

npx react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 2 workers...
info JS server already running.
/bin/sh: 1: /home/u/platform-tools/adb: not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Observed package id 'system-images;android-29;google_apis;x86' in inconsistent location '/home/u/Android/Sdk/system-images/android-29/google_apis/x86' (Expected '/home/u/system-images/android-29/google_apis/x86')
Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Observed package id 'tools' in inconsistent location '/home/u/Android/Sdk/tools' (Expected '/home/u/tools')
Checking the license for package Android SDK Build-Tools 30.0.2 in /home/u/licenses
Warning: License for package Android SDK Build-Tools 30.0.2 not accepted.
Checking the license for package Android SDK Platform 30 in /home/u/licenses
Warning: License for package Android SDK Platform 30 not accepted.

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
  
  Using Android SDK: /home/u

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 38s

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 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
  
  Using Android SDK: /home/u

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 38s

    at makeError (/home/u/Desktop/workdir/Math_App/mathapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
    at /home/u/Desktop/workdir/Math_App/mathapp/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (/home/u/Desktop/workdir/Math_App/mathapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
    at async Command.handleAction (/home/u/Desktop/workdir/Math_App/mathapp/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.

它基本上表明它缺少build-tools;30.0.2 Android SDK Build-Tools 30.0.2 platforms;android-30 Android SDK Platform 30

通过 Android-Studio 安装它们,一切正常。


除此之外,我还有另一个问题(可能与上面的问题无关,但我仍会在此处添加)

所以,现在,如果我再次尝试npx react-native run-android ,则会弹出以下错误

[adb]: Cannot run program "/home/u/platform-tools/adb": error=2, No such file or directory

platform-tools位于~/Android/Sdk中,而不是~/中。

基本上这意味着路径是错误的。 修复是在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM