Build failed: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase
Asked Answered
C

4

7

I have faced this sort of error while bundling any suggestions on how to solve this error I have tried it by removing extra dependencies but still it doesn't work

Moreover, I have also removed the node modules and re-installed them if any module was unknowingly removed by mistake. But still it doesn't work.

could be any problem but I can`t resolve it I have been facing and trying to solve this since past 2 days

I have made a sample default bundle And it worked but this app isn`t bundling I am using Expo-react-native

Downloading https://services.gradle.org/distributions/gradle-7.3.3-all.zip
10%.
20%.
30%.
40
%
50
%.
60%.
70%.
80%.
90%
100%
Welcome to Gradle 7.3.3!
Here are the highlights of this release:
 - Easily declare new test suites in Java projects
 - Support for Java 17
 - Support for Scala 3
For more details see https://docs.gradle.org/7.3.3/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.3.3/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
Unable to list file systems to check whether they can be watched. Assuming all file systems can be watched. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
> Task :react-native-gradle-plugin:compileKotlin
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (155, 32): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (161, 31): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (169, 36): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (100, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with rootto point to your root project and reactNativeDir to point to the folder of the react-native NPM package
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 51): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (132, 12): 'LibraryVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (252, 14): 'BaseVariant' is deprecated. Deprecated in Java
> Task :react-native-gradle-plugin:compileJava
[stderr] 
Note: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java uses or overrides a deprecated API.
[stderr] 
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-gradle-plugin:pluginDescriptors
> Task :react-native-gradle-plugin:processResources
> Task :react-native-gradle-plugin:classes
> Task :react-native-gradle-plugin:inspectClassesForKotlinIC
> Task :react-native-gradle-plugin:jar
> 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.
> Configure project :expo-eas-client
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
> Configure project :expo-structured-headers
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
> Configure project :expo-updates-interface
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
> Configure project :expo
Using expo modules
  - expo-ads-admob (13.0.0)
  - expo-ads-facebook (11.2.0)
  - expo-application (4.1.0)
- expo-constants (13.1.1)
  - expo-eas-client (0.2.1)
  - expo-error-recovery (3.1.0)
  - expo-facebook (12.2.0)
- expo-file-system (14.0.0)
- expo-font (10.1.0)
  - expo-json-utils (0.3.0)
  - expo-keep-awake (10.1.1)
  - expo-manifests (0.3.0)
  - expo-modules-core (0.9.2)
  - expo-splash-screen (0.15.1)
  - expo-structured-headers (2.2.1)
  - expo-system-ui (1.2.0)
  - expo-updates (0.13.2)
[stderr] 
FAILURE: Build completed with 2 failures.
[stderr] 
1:
[stderr] 
Task failed with an exception.
[stderr] 
-----------
[stderr] 
* Where:
[stderr] 
Build file '/home/expo/workingdir/build/node_modules/react-native-ad-manager/android/build.gradle' line: 23
[stderr] 
* What went wrong:
[stderr] 
A problem occurred evaluating project ':react-native-ad-manager'.
[stderr] 
> Plugin with id 'maven' not found.
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
2: Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
A problem occurred configuring project ':react-native-ad-manager'.
[stderr] 
> compileSdkVersion is not specified. Please add it to build.gradle
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 2m 24s
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 executed
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.```




Coreycorf answered 7/7, 2022 at 4:56 Comment(0)
J
1

run the following commands will solve the problems:

  1. npx expo-doctor
  2. npx expo-doctor --fix-dependencies
  3. npx expo install --check
Janik answered 12/4, 2024 at 17:38 Comment(0)
S
0

You have Three choices to fix this error

Choice 1

Downgrade gradle from android/gradle/wrapper/gradle-wrapper.properties change distributionUrl

from

distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

to

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

Choice 2

Make the changes found in this link https://github.com/NZME/react-native-ad-manager/blob/master/android/build.gradle in your node_modules/react-native-ad-manager/build.gradle.

Also Change these lines

def DEFAULT_COMPILE_SDK_VERSION = 28
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'

to this

def DEFAULT_COMPILE_SDK_VERSION = 30
def DEFAULT_BUILD_TOOLS_VERSION = '30.0.2'

Choice 3

Find a replacement for react-native-ad-manager which is updated and maintained for gradle 7+

Hope this helps you

Salina answered 7/7, 2022 at 5:41 Comment(0)
P
0

check the react-native-ad-manager in your node-modules, that is where the error is coming from

Pampas answered 13/7, 2023 at 13:39 Comment(2)
suggest the very common things that already mentioned in another answerRedford
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewIcing
M
0

I faced the same error this was the error when i started builing my app using eas build command Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.```

just delete the /Android folder from your project directory and start a new build with new name and slug , basically make a whole new build so that there is no cache issue. hope this will fix the error as it fixed for me.

Merrymerryandrew answered 27/7, 2024 at 8:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.