Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information. #2325

Closed
aleksi-p opened this issue Apr 12, 2024 · 3 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@aleksi-p
Copy link

Build/Submit details page URL

No response

Summary

I am trying to build the Android apk but it always fails with "Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.". I ran npx expo-doctor, it finishes with "Didn't find any issues with the project!".
I checked all dependencies etc. but can find the error.

Any ideas?

Thank you guys

Managed or bare?

Managed

Environment

expo-env-info 1.2.0 environment info:
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 20.12.1 - C:\Program Files\nodejs\node.EXE
npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
SDKs:
Android SDK:
API Levels: 30, 31, 34
Build Tools: 30.0.3, 31.0.0, 32.0.0, 33.0.0, 34.0.0
System Images: android-30 | Intel x86_64 Atom, android-31 | Intel x86_64 Atom, android-33 | Intel x86_64 Atom, android-33 | Google Play Intel x86_64 Atom, android-34 | Google APIs Intel x86_64 Atom
IDEs:
Android Studio: AI-232.10300.40.2321.11567975
npmPackages:
expo: ^50.0.0 => 50.0.15
react: 18.2.0 => 18.2.0
react-native: 0.73.6 => 0.73.6
Expo Workflow: bare

Error output

Running 'gradlew :app:assembleRelease' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-8.3-all.zip
10%
20%.
30%.
40%.
50%
60%.
70%.
80%.
90%.
100%
Welcome to Gradle 8.3!
Here are the highlights of this release:

Configure project :
Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
Task :gradle-plugin:pluginDescriptors
Task :gradle-plugin:processResources
Task :gradle-plugin:compileKotlin
Task :gradle-plugin:compileJava NO-SOURCE
Task :gradle-plugin:classes
Task :gradle-plugin:jar
Task :gradle-plugin:inspectClassesForKotlinIC
FAILURE: Build completed with 2 failures.
1:
Task failed with an exception.


  • Where:
    Build file '/home/expo/workingdir/build/node_modules/expo-modules-core/android/build.gradle' line: 372
  • What went wrong:
    A problem occurred evaluating project ':expo-modules-core'.

Cannot invoke method replace() on null object

  • 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.
==============================================================================
2:
Task failed with an exception.


  • What went wrong:
    A problem occurred configuring project ':expo'.

compileSdkVersion is not specified. Please add it to build.gradle

  • 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 2m 5s
5 actionable tasks: 5 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Reproducible demo or steps to reproduce from a blank project

eas build -p android --profile preview

eas.json
{
"cli": {
"version": ">= 7.8.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"android": {
"buildType": "apk"
}
},
"production": {}
},
"submit": {
"production": {}
}
}

@aleksi-p aleksi-p added the needs review Issue is ready to be reviewed by a maintainer label Apr 12, 2024
@aleksi-p
Copy link
Author

build.gradle was wrong. After re-install of the package @react-native-community/netinfo and adjusting the build.gradle, it finally worked.

buildscript {
ext {
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'

@lperotti399
Copy link

any updates on this error please?

@moudy-wold
Copy link

I am waiting too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants