EAS Build Error (Android)

Hello Everybody,

I am farily new at this. I’m trying to build with EAS build --platform android, and it gives me this log errors:

Path to release keystore file is already set, ignoring ‘credentials.json’

FAILURE: Build failed with an exception.
  • Where:
Script '/usr/local/lib/node_modules/@expo/eas-build-worker/workingdir/build/node_modules/expo-updates/scripts/create-manifest-android.gradle' line: 38
  • What went wrong:
A problem occurred configuring project ':app'.

Cannot add task ‘createDebugExpoManifest’ as a task with that name already exists.


Can somebody please help me? Thank you!

Hi! what version of expo-updates are you using, and can you share your build.gradle?

Hello!

Thank you for the reply.

The expo-updates version is
“expo-updates”: “~0.4.0”,

the build.gradle:

apply plugin: “com.android.application”

import com.android.build.OutputFile

project.ext.react = [

enableHermes: false

]

apply from: ‘…/…/node_modules/react-native-unimodules/gradle.groovy’

apply from: “…/…/node_modules/react-native/react.gradle”

apply from: “…/…/node_modules/expo-constants/scripts/get-app-config-android.gradle”

apply from: “…/…/node_modules/expo-updates/scripts/create-manifest-android.gradle”

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def jscFlavor = ‘org.webkit:android-jsc:+’

def enableHermes = project.ext.react.get(“enableHermes”, false);

android {

compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {

    sourceCompatibility JavaVersion.VERSION_1_8

    targetCompatibility JavaVersion.VERSION_1_8

}

defaultConfig {

    applicationId "com.singandguess"

    minSdkVersion rootProject.ext.minSdkVersion

    targetSdkVersion rootProject.ext.targetSdkVersion

    versionCode 1

    versionName "1.0"

}

splits {

    abi {

        reset()

        enable enableSeparateBuildPerCPUArchitecture

        universalApk false  // If true, also generate a universal APK

        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"

    }

}

signingConfigs {

    debug {

        storeFile file('debug.keystore')

        storePassword 'android'

        keyAlias 'androiddebugkey'

        keyPassword 'android'

    }

    release {

        if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {

            storeFile file(MYAPP_UPLOAD_STORE_FILE)

            storePassword MYAPP_UPLOAD_STORE_PASSWORD

            keyAlias MYAPP_UPLOAD_KEY_ALIAS

            keyPassword MYAPP_UPLOAD_KEY_PASSWORD

        }

    }

}

buildTypes {

    debug {

        signingConfig signingConfigs.debug

    }

    release {

        // Caution! In production, you need to generate your own keystore file.

        // see https://reactnative.dev/docs/signed-apk-android.

        signingConfig signingConfigs.release

        minifyEnabled enableProguardInReleaseBuilds

        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

    }

}

// applicationVariants are e.g. debug, release

applicationVariants.all { variant ->

    variant.outputs.each { output ->

        // For each separate APK per architecture, set a unique version code as described here:

        // https://developer.android.com/studio/build/configure-apk-splits.html

        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]

        def abi = output.getFilter(OutputFile.ABI)

        if (abi != null) {  // null for the universal-debug, universal-release variants

            output.versionCodeOverride =

                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode

        }

    }

}

}

dependencies {

implementation fileTree(dir: "libs", include: ["*.jar"])

//noinspection GradleDynamicVersion

implementation 'com.google.android.gms:play-services-auth:19.0.0'

implementation(project(":react-native-google-signin"))

implementation "com.facebook.react:react-native:+"  // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {

  exclude group:'com.facebook.fbjni'

}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {

    exclude group:'com.facebook.flipper'

    exclude group:'com.squareup.okhttp3', module:'okhttp'

}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {

    exclude group:'com.facebook.flipper'

}

addUnimodulesDependencies()

if (enableHermes) {

    def hermesPath = "../../node_modules/hermes-engine/android/";

    debugImplementation files(hermesPath + "hermes-debug.aar")

    releaseImplementation files(hermesPath + "hermes-release.aar")

} else {

    implementation jscFlavor

}

}

// Run this once to be able to run the application with BUCK

// puts all compile dependencies into folder libs for BUCK to use

task copyDownloadableDepsToLibs(type: Copy) {

from configurations.compile

into 'libs'

}

apply from: file(“…/…/node_modules/@react-native-community/cli-platform-android/native_modules.gradle”); applyNativeModulesAppBuildGradle(project)

apply plugin: ‘com.google.gms.google-services’

apply from: “./eas-build.gradle”

// Integration with Expo updates

apply from: “…\…\node_modules\expo-updates\scripts\create-manifest-android.gradle”

apply from: “./eas-build.gradle”

I was able to re do my whole app, and this error is gone.

However, now it shows another errors:
(I’m using a react native bare project, with unimodules)
(I’m also using backendless npm as backend service)

hi there, that error isn’t particularly useful for us. are you able to run a release build successfully locally?

Hello! Thank you for replying.

Also no… :frowning:

it gives this error below… Do you know what this might be?

Couldn’t find a ‘credentials.json’ file, skipping release keystore configuration

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

FAILURE: Build failed with an exception.

  • What went wrong:
    Task ‘installRelease’ not found in project ‘:app’. Some candidates are: ‘uninstallRelease’.

  • Try:
    Run gradlew tasks to get a list of available tasks. 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 41s

error Failed to install the app. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installRelease -PreactNativeDevServerPort=8081

apply from: "./eas-build.gradle"

is included in your build.gradle twice

  • if you added it manually remove one of the occurrences
  • if eas command did that please provide actual build.gradle file

and for future reference do not post files/logs/code this way, it’s very hard to read it in this form and you are potentially removing important information that may be necessary to debug a problem, use some external services instead.

1 Like

you can sync your credentials to local machine as described here Syncing credentials between remote and local sources - Expo Documentation

1 Like

Hello!

After i created the credentials, i was able to build a release version of the app locally. But still can’t do an EAS build… :confused:

Here’s the build.gradle :

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    enableHermes: false
]

apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.sandg"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
    addUnimodulesDependencies()

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "./eas-build.gradle"

// Integration with Expo updates
apply from: "..\\..\\node_modules\\expo-updates\\scripts\\create-manifest-android.gradle"

Hello! Can you please check my build.gradle?

I don’t have

apply from: “./eas-build.gradle”

twice…

Thank you!

@dijay - compare your example to a working minimal build.gradle that you would get from running expo init, choosing a bare app, then configuring with eas build: build.gradle · GitHub

Hello!

I have compared and the files are the same… I really don’t know what’s wrong :sob:

can you share your project on github? i’m brentvatne there

1 Like

Just invited. I am diogopotes

hi there,

i looked at your project and it has build errors that are unrelated to eas build that i don’t have time to help with.

you should get your app running locally first. it looks like react-native-backendless isn’t properly configured, among other things. good luck!

Hello.

I figured that out… but the thing is that locally I can run it. Anyway, i’m gonna try to solve this.
Thank you anyway.