【问题标题】:React Native build looks for sdk licenses in wrong folderReact Native 构建在错误的文件夹中查找 sdk 许可证
【发布时间】:2021-12-25 08:02:02
【问题描述】:

我目前正在尝试在 CLI 中构建我的 react 本机应用程序,它给了我这个错误

Observed package id 'platform-tools' in inconsistent location 'D:\Android\android-sdk\platform-tools' (Expected 'D:\Android\android-sdk\platform-tools\platform-tools')
Checking the license for package SDK Patch Applier v4 in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Tools in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 30.0.2 in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package Android SDK Build-Tools 30.0.2 not accepted.
Checking the license for package Android SDK Platform 30 in D:\Android\android-sdk\platform-tools\licenses       
Warning: License for package Android SDK Platform 30 not accepted.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

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.
     patcher;v4 SDK Patch Applier v4
     emulator Android Emulator
     platforms;android-30 Android SDK Platform 30
     build-tools;30.0.2 Android SDK Build-Tools 30.0.2
     tools Android SDK Tools
  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

但后来我意识到构建实际上是在错误的目录中查找,这可能就是它给我许可证错误的原因。我的许可证位于android-sdk,但构建正在寻找android-sdk/platform-tools 中的许可证,我也有。

Observed package id 'platform-tools' in inconsistent location 'D:\Android\android-sdk\platform-tools' (Expected 'D:\Android\android-sdk\platform-tools\platform-tools')
Checking the license for package SDK Patch Applier v4 in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Tools in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 30.0.2 in D:\Android\android-sdk\platform-tools\licenses
Warning: License for package Android SDK Build-Tools 30.0.2 not accepted.
Checking the license for package Android SDK Platform 30 in D:\Android\android-sdk\platform-tools\licenses       
Warning: License for package Android SDK Platform 30 not accepted.

如何重新配置​​构建以查找正确的目录?我可以将许可证文件夹拖到平台工具文件夹吗?这会安全吗?

谢谢

【问题讨论】:

  • 也许你应该指定文件夹。进入你项目的 android/ 目录;创建一个名为 local.properties 的文件,其中包含:sdk.dir = D:\Android\android-sdk
  • 我试过了,还是一样的错误。问题不在于 sdk 目录,而在于构建时许可证检查的行为。它会尝试在错误位置的平台工具目录中查找许可证。

标签: android react-native android-studio mobile android-sdk-tools


【解决方案1】:

我想通了。我将平台工具剪切粘贴到我的 sdk 目录中的另一个平台工具目录下,因为它正在那里寻找它。我还将许可证文件夹放在第二个平台工具目录上方的一个文件夹中。

【讨论】:

    猜你喜欢
    • 2019-08-10
    • 1970-01-01
    • 2022-08-03
    • 2021-04-18
    • 2020-05-31
    • 1970-01-01
    • 1970-01-01
    • 2017-11-16
    • 1970-01-01
    相关资源
    最近更新 更多