Sami.C
Sami.C

Reputation: 731

Expo Android cannot build

EDIT: Simplified my post a bit.

I was running Java 11. I've just upgraded to 17 in an attempt to try and resolve the issue.

running eas build --platform android --profile production --clear-cache --build-logger-level=debug

outputs:

Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/android
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
FAILURE: Build failed with an exception.
* Where:
Script '/home/expo/workingdir/build/node_modules/expo/scripts/autolinking.gradle' line: 4
* What went wrong:
A problem occurred evaluating script.
> Could not find method exec() for arguments [autolinking_9szxo5may2zrgnhpqcnrso9ei$_run_closure1@58dbf0e1] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.
* 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: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

android/app/build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    namespace 'com.truestreetcarclub.tsccmemberapp' // Add this line

    compileSdkVersion rootProject.ext.compileSdkVersion

    buildFeatures {
        buildConfig true // Add this line to enable buildConfig feature
    }

    defaultConfig {
        applicationId "com.truestreetcarclub.tsccmemberapp" // Set your package name here
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.facebook.react:react-native:+'
}

Have had no issues building iOS and I suspect there is some form of incompatibility occurring but cannot for the life of me debug this. Any pointers on where to turn to?

I've been going around in circles with this autolinking. I've deleted node_modules countless times and reinstalled, cleared caches to make sure nothing silly but no luck.

Upvotes: 0

Views: 180

Answers (1)

Sami.C
Sami.C

Reputation: 731

For those interested, this was an Expo managed workflow app. It is my first time using expo/react-native. I was unaware that there should not be an "Android" folder at all.

Because of this, I was going down the wrong path attempting to diagnose the build error which I suspect was due to the way expo was setup.

I have no idea how that Android folder was created (perhaps an installed package caused it??), but after deleting the Android folder the build went through.

Hope this helps someone.

Upvotes: 0

Related Questions