React Native Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0
Asked Answered
P

2

8

after installing some packages like react-native-safe-area-context or react-native-screen, I always have this problem: can't run the app

when I run yarn android:

> Configure project :react-native-async-storage_async-storage
Subproject ':react-native-async-storage_async-storage' has location 'D:\ewm\git\itc\node_modules\@react-native-async-storage\async-storage\android' which is outside of the project root. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0.

> Configure project :react-native-safe-area-context
Subproject ':react-native-safe-area-context' has location 'D:\ewm\git\itc\node_modules\react-native-safe-area-context\android' which is outside of the project root. This behaviour has been deprecated and is scheduled to be removed in Gradle 8.0.

> Task :react-native-safe-area-context:compileDebugKotlin
w: D:\ewm\git\itc\node_modules\react-native-safe-area-context\android\src\main\java\com\th3rdwave\safeareacontext\SafeAreaView.kt: (50, 23): 'getter for uiImplementation: UIImplementation!' is deprecated. Deprecated in Java
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

* What went wrong:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0

* 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 26s

when I run react-native info:

OS: Windows 10 10.0.19044
  CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Memory: 3.90 GB / 15.96 GB
Binaries:
  Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
  npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
  API Levels: 29, 30, 31, 32
  Build Tools: 30.0.1, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
  System Images: android-Tiramisu | Google Play Intel x86 Atom_64
Android NDK: Not Found
Windows SDK:
  AllowAllTrustedApps: Disabled
  Versions: 10.0.18362.0, 10.0.19041.0
IDEs:
  Android Studio: Version     2021.1.0.0 AI-211.7628.21.2111.8193401
  Visual Studio: 16.11.32106.194 (Visual Studio Community 2019)
Languages:
  Java: 17.0.2
npmPackages:
  @react-native-community/cli: Not Found
  react: Not Found
  react-native: Not Found
  react-native-windows: Not Found
npmGlobalPackages:
  *react-native*: Not Found
Pazice answered 4/4, 2022 at 8:36 Comment(2)
I am facing the same issue, did you find any solution?Grandparent
@Grandparent i had to clean / delete any android path and programs on my computer and re-install from zeroPazice
P
0

In my case the issue was to do with duplicate files in android resource folders. I used below commands to remove the duplicates.

rm -rf ./android/app/src/main/res/drawable-*

rm -rf ./android/app/src/main/res/raw

See: https://mcmap.net/q/187470/-react-native-error-duplicate-resources-android

Pfennig answered 11/5, 2022 at 21:45 Comment(0)
R
-2

use ./gradlew clean to delete all previous build and rebuild

Remaremain answered 20/8, 2022 at 23:13 Comment(1)
didn't work for meMoue

© 2022 - 2024 — McMap. All rights reserved.