thom4ever
thom4ever

Reputation: 1

Expo sdk 48 - Android build failure - "FAILURE: Build completed with 2 failures"

I've been developing and publishing with expo / react native for more than 2 years. Suddenly building for Android fails. I just upgraded to the latest sdk, reinstalled node modules. Building for iOS works. But for Android, build fails at the "Run gradlew" step.

Here are the logs of that state:

Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/android Downloading https://services.gradle.org/distributions/gradle-7.5.1-all.zip Welcome to Gradle 7.5.1! .. Configure project :expo-updates FAILURE: Build completed with 2 failures. 1: Task failed with an exception.

  • Where: Build file '/home/expo/workingdir/build/node_modules/expo-updates/android/build.gradle' line: 78
  • What went wrong: A problem occurred evaluating project ':expo-updates'. Could not find method boolish() for arguments [true] on DefaultConfig$AgpDecorated_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=21, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=31, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=31, versionName=0.18.5, applicationId=null, testApplicationId=null, testInstrumentationRunner=androidx.test.runner.AndroidJUnitRunner, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=SigningConfig$AgpDecorated_Decorated{name=debug, storeFile=/home/expo/.android/debug.keystore, storePassword=android, keyAlias=AndroidDebugKey, keyPassword=android, storeType=pkcs12, v1SigningEnabled=true, v2SigningEnabled=true, enableV1Signing=null, enableV2Signing=null, enableV3Signing=null, enableV4Signing=null}, resConfig=[], buildConfigFields={EX_UPDATES_NATIVE_DEBUG=com.android.builder.internal.ClassFieldImpl@50e3c81e}, resValues={}, proguardFiles=[], consumerProguardFiles=[/home/expo/workingdir/build/node_modules/expo-updates/android/proguard-rules.pro], manifestPlaceholders={}, wearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.DefaultConfig$AgpDecorated.
  • 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.

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.

BUILD FAILED in 2m 14s

I have checked that compileSdkVersion is specified in expo-updates. I have removed and reinstalled expo-updates. But nothing works.

Do you have any idea ?

Seems related to this github issue

Thanks a million !

Upvotes: 0

Views: 691

Answers (1)

Diego Stallo
Diego Stallo

Reputation: 1

  1. Change java version to 17. If you are on a Mac, remember to point the soft link /Library/Java/JavaVirtualMachines/openjdk.jdk to /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk.

  2. Upgrade expo SDK to version 49 with: $ npx expo upgrade.

  3. Delete /android folder on project.

To make sure everything is built again from scratch:

  1. Run $ npx expo run:android.

  2. If that still doesn't work, make sure you are using gradle version 8.0.1.

This is set up in file /android/gradle/wrapper/gradle-wrapper.properties. The distributionUrl should be: distributionUrl=https://services.gradle.org/distributions/gradle-8.0.1-all.zip

Upvotes: 0

Related Questions