【问题标题】:React Native Gradle SDK Location not found. Depreciated Gradle Features未找到 React Native Gradle SDK 位置。折旧的 Gradle 功能
【发布时间】:2021-06-05 17:47:23
【问题描述】:

我正在使用 ./gradlew assembleRelease 导出我的 react 本机文件。

我收到以下错误:

  1. 此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容

  2. 未找到 SDK 位置

我的 gradle 是否与我安装的 Java 版本不兼容?我似乎找不到解决方法?

以下完全错误

------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_291 (Oracle Corporation 25.291-b10)
OS:           Mac OS X 10.16 x86_64
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> 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 '/Users/mattlaszcz/Documents/HearthNative/HearthNative/android/local.properties'.

* 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

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.3/userguide/command_line_interface.html#sec:command_line_warnings

【问题讨论】:

  • 如有必要,我可以提供完整的堆栈跟踪。

标签: react-native gradle sdk


【解决方案1】:

确保 sdk 路径是 android 根文件夹中的 local.properties 文件,它应该是这样的 sdk.dir=C\:\\Users\\User\\AppData\\Local\\Android\\Sdk

【讨论】:

  • 我看不到 local.properties 文件,但我有一个 gradle.properties 文件,这会是一回事吗?
  • 不,您可以将其添加到 android 文件夹并将此代码添加到其中 sdk.dir=C\:\\Users\\User\\AppData\\Local\\Android\\Sdk
猜你喜欢
  • 2013-10-16
  • 2015-12-14
  • 2023-01-30
  • 2013-11-16
  • 2020-04-16
  • 1970-01-01
  • 1970-01-01
  • 2016-05-10
  • 1970-01-01
相关资源
最近更新 更多