React-Native - Could not configure services using GradleScopeCompileServices.configure() - react-native

In react native im using react-native run-android and i keep getting this error
Welcome to Gradle 6.7!
Here are the highlights of this release:
- File system watching is ready for production use
- Declare the version of Java your build requires
- Java 15 support
For more details see https://docs.gradle.org/6.7/release-notes.html
FAILURE: Build failed with an exception.
* What went wrong:
Could not create an instance of type org.gradle.invocation.DefaultGradle.
> Could not configure services using GradleScopeCompileServices.configure().
* 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 36s
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
FAILURE: Build failed with an exception.
* What went wrong:
Could not create an instance of type org.gradle.invocation.DefaultGradle.
> Could not configure services using GradleScopeCompileServices.configure().
* 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 36s
at makeError (C:\Users\tp_re\source\repos\Wcarnapp\node_modules\execa\index.js:174:9)
at C:\Users\tp_re\source\repos\Wcarnapp\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async runOnAllDevices (C:\Users\tp_re\source\repos\Wcarnapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\tp_re\source\repos\Wcarnapp\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
when i do react-native info i get:
info Fetching system and libraries information...
(node:600) Warning: Accessing non-existent property 'padLevels' of module exports inside circular
dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU # 1.30GHz
Memory: 2.86 GB / 15.71 GB
Binaries:
Node: 15.5.0 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 29
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3
System Images: android-29 | Android TV Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 4.1.0.0 AI-201.8743.12.41.6858069
Visual Studio: 16.8.30804.86 (Visual Studio Professional 2019)
Languages:
Java: javac 16
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found

Related

Am having travel run react native CLI with android . i get so many error

At first was runing node 16.15 with JDK 18. thought it was a problem with the jdk. had to down grade to JDK 11. but still facing this problem. can any one help?
my virtual devices are already runing but for some reason i can
npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-
jetifier" flag.
Jetifier found 964 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
'"adb"' is not recognized as an internal or external command,
operable program or batch file.
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...
> Configure project :app
Unable to detect AGP versions for included builds. All projects in the build should use the
same AGP version. Class name for the included build object:
org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine
if they come from your own scripts or plugins.
See
https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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
'C:\aldoobi\newaldoobi\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
BUILD FAILED in 8s
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
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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
'C:\aldoobi\newaldoobi\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
BUILD FAILED in 8s
at makeError (C:\aldoobi\newaldoobi\node_modules\execa\index.js:174:9)
at C:\aldoobi\newaldoobi\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\aldoobi\newaldoobi\node_modules\#react-native-community\cli-
platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\aldoobi\newaldoobi\node_modules\#react-native-
community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
i have tried changing the path in my computer variables; i have added ANDROID_HOME, JAVA_HOME and also tried to change the android virtual deveces to SDK R but nothing . can any one help?

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

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
use ./gradlew clean to delete all previous build and rebuild
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://stackoverflow.com/a/57975287/10030693

Can't run react-native run-android?

I'v followed the steps from https://reactnative.dev/docs/environment-setup. I can start the phone emulator from AVD Manager in Android Studio and I can run react-native start without problems. When i enter in another terminal react-native run-android I get the following error:
info Running jetifier to migrate libraries to AndroidX. You can
disable it using "--no-jetifier" flag. (node:9612) Warning: Accessing
non-existent property 'padLevels' of module exports inside circular
dependency (Use node --trace-warnings ... to show where the warning
was created) Jetifier found 967 file(s) to forward-jetify. Using 16
workers... info Starting JS server... info Launching emulator... info
Successfully launched emulator. info Installing the app... Downloading
file:/D:/App/AwesomeProject/android/gradle/wrapper/services.gradle.org/distributions/gradle-6.7-all.zip
Exception in thread "main" java.io.FileNotFoundException:
D:\App\AwesomeProject\android\gradle\wrapper\services.gradle.org\distributions\gradle-6.7-all.zip
(The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.(FileInputStream.java:153)
at java.base/java.io.FileInputStream.(FileInputStream.java:108)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189)
at org.gradle.wrapper.Download.downloadInternal(Download.java:78)
at org.gradle.wrapper.Download.download(Download.java:63)
at org.gradle.wrapper.Install$1.call(Install.java:68)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
error Failed to install the app. Make sure you have the Android
development environment set up:
https://reactnative.dev/docs/environment-setup. Run CLI with --verbose
flag for more details. Error: Command failed: gradlew.bat
app:installDebug -PreactNativeDevServerPort=8081 Exception in thread
"main" java.io.FileNotFoundException:
D:\App\AwesomeProject\android\gradle\wrapper\services.gradle.org\distributions\gradle-6.7-all.zip
(The system cannot find the path specified)
And if I run react-native info I get:
info Fetching system and libraries information... (node:14952)
Warning: Accessing non-existent property 'padLevels' of module exports
inside circular dependency (Use node --trace-warnings ... to show
where the warning was created) System:
OS: Windows 10 10.0.19041
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 23.88 GB / 31.90 GB Binaries:
Node: 14.15.0 - D:\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.8 - D:\nodejs\npm.CMD
Watchman: Not Found SDKs:
Android SDK: Not Found
Windows SDK: Not Found IDEs:
Android Studio: Not Found
Visual Studio: Not Found Languages:
Java: 15.0.1
Python: 3.9.0 npmPackages:
#react-native-community/cli: ^4.13.0 => 4.13.0
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-windows: Not Found npmGlobalPackages:
react-native: Not Found
I'v tried a lot of things but nothing seems to work.
Looks like an issue with gradle version.
Do these.
remove android/.gradle folder.
open /android in android studio
goto File->Project Structure->Project and change Gradle Version to more recent one. and wait for it to complete gralde sync task.
run react-native run-android after this.

react-native-nested-scroll-view: processDebugManifest FAILED

I'm using the module: react-native-sticky-parallax-header.
I follow all the steps at https://www.npmjs.com/package/react-native-sticky-parallax-header without problems:
yarn add react-native-sticky-parallax-header
react-native link react-native-nested-scroll-view
yarn add patch-package postinstall-postinstall
"scripts": {
+ "postinstall": "patch-package"
}
But when I do react-native run-android, I get:
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.2-all.zip
...............................................................................................................
Unzipping C:\Users\Diogo\.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip to C:\Users\Diogo\.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Welcome to Gradle 4.10.2!
> Task :react-native-nested-scroll-view:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Failed to create directory 'C:\Users\Diogo\Documents\ProjetosMobile\newproject\node_modules\react-native-nested-scroll-view\android\build\intermediates\merged_manifests\debug'
> root project > Resolve dependencies of :classpath
* 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.
> IDLE
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 43s
2 actionable tasks: 2 executed
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
I wear:
react-native-cli: 2.0.1
react-native: 0.59.8
node: v10.13.0

Error: When run the react-native run-android Command

When trying react-native run-android occurs Following Error
`FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
The SDK directory 'C:\Users\PC_Name\AppData\Local\Android\Sdk\tool\platform-tools' does not exist.
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 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
The SDK directory 'C:\Users\PC_NAME\AppData\Local\Android\Sdk\tool\platform-tools' does not exist.
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 3s
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:13)
at runOnAllDevices (G:\React-native\SampleApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (G:\React-native\SampleApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (G:\React-native\SampleApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
SYSTEM INFO
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i3-7100 CPU # 3.90GHz
Memory: 974.69 MB / 7.89 GB
Binaries:
Node: 10.13.0 - C:\Program Files\nodejs\node.EXE
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.1 => 0.61.1
I'm trying to change the gradlew file permission but its not working.
Thanks in Advance :)