Quantcast
Viewing latest article 26
Browse Latest Browse All 29390

Why is my Expo eas build failing in React Native app

all experts. This might look like a duplicated or a repeated question but I'm new to React Native development and I'm trying to create and build an app using Expo and eas. I keep getting the below fail (I've put only the last part of the "Run Gradle" build log to make it short).

Run Gradle log fragment:

> Task :app:processReleaseMainManifest FAILED[com.android.support:animated-vector-drawable:28.0.0] /home/expo/.gradle/caches/8.10.2/transforms/ed7d39d8e0aceb01c08b7bdd080b1661/transformed/animated-vector-drawable-28.0.0/AndroidManifest.xml Warning:    Namespace 'android.support.graphics.drawable' is used in multiple modules and/or libraries: com.android.support:animated-vector-drawable:28.0.0, com.android.support:support-vector-drawable:28.0.0. Please ensure that all modules and libraries have a unique namespace. For more information, See https://developer.android.com/studio/build/configure-app-module#set-namespace[androidx.versionedparcelable:versionedparcelable:1.1.1] /home/expo/.gradle/caches/8.10.2/transforms/01c68b7f99bce65bd3d6563c2b710b81/transformed/versionedparcelable-1.1.1/AndroidManifest.xml Warning:    Namespace 'androidx.versionedparcelable' is used in multiple modules and/or libraries: androidx.versionedparcelable:versionedparcelable:1.1.1, com.android.support:versionedparcelable:28.0.0. Please ensure that all modules and libraries have a unique namespace. For more information, See https://developer.android.com/studio/build/configure-app-module#set-namespaceSee https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger./home/expo/workingdir/build/android/app/src/main/AndroidManifest.xml:28:18-86 Error:    Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.13.1] AndroidManifest.xml:28:18-86    is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:15:3-33:17 to override.> Task :react-native-safe-area-context:compileReleaseKotlinw: file:///home/expo/workingdir/build/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextPackage.kt:27:11 'constructor ReactModuleInfo(String, String, Boolean, Boolean, Boolean, Boolean, Boolean)' is deprecated. use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]w: file:///home/expo/workingdir/build/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextPackage.kt:33:27 'getter for hasConstants: Boolean' is deprecated. This property is unused and it's planning to be removed in a future version of        React Native. Please refrain from using it.w: file:///home/expo/workingdir/build/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt:59:23 'getter for uiImplementation: UIImplementation!' is deprecated. Deprecated in Java> Task :react-native-reanimated:compileReleaseJavaWithJavacNote: Some input files use or override a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: Some input files use unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.> Task :expo-modules-core:compileReleaseKotlinFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:processReleaseMainManifest'.> Manifest merger failed with multiple errors, see logs* 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 42sDeprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.355 actionable tasks: 355 executedError: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

android\build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    ext {        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '35.0.0'        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '24')        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '35')        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.25'        ndkVersion = "26.1.10909125"    }    repositories {        google()        mavenCentral()    }    dependencies {        classpath('com.android.tools.build:gradle')        classpath('com.facebook.react:react-native-gradle-plugin')        classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')    }}apply plugin: "com.facebook.react.rootproject"allprojects {    repositories {        maven {            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))        }        maven {            // Android JSC is installed from npm            url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))        }        google()        mavenCentral()        maven { url 'https://www.jitpack.io' }    }}

android\app\build.gradle:

apply plugin: "com.android.application"apply plugin: "org.jetbrains.kotlin.android"apply plugin: "com.facebook.react"def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()/** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */react {    entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())    reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()    hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() +"/sdks/hermesc/%OS-BIN%/hermesc"    codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()    // Use Expo CLI to bundle the app, this ensures the Metro config    // works correctly with Expo projects.    cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())    bundleCommand = "export:embed"    /* Folders */     //   The root of your project, i.e. where "package.json" lives. Default is '../..'    // root = file("../../")    //   The folder where the react-native NPM package is. Default is ../../node_modules/react-native    // reactNativeDir = file("../../node_modules/react-native")    //   The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen    // codegenDir = file("../../node_modules/@react-native/codegen")    /* Variants */    //   The list of variants to that are debuggable. For those we're going to    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.    // debuggableVariants = ["liteDebug", "prodDebug"]    /* Bundling */    //   A list containing the node command and its flags. Default is just 'node'.    // nodeExecutableAndArgs = ["node"]    //    //   The path to the CLI configuration file. Default is empty.    // bundleConfig = file(../rn-cli.config.js)    //    //   The name of the generated asset file containing your JS bundle    // bundleAssetName = "MyApplication.android.bundle"    //    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'    // entryFile = file("../js/MyApplication.android.js")    //    //   A list of extra flags to pass to the 'bundle' commands.    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle    // extraPackagerArgs = []    /* Hermes Commands */    //   The hermes compiler command to run. By default it is 'hermesc'    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"    //    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"    // hermesFlags = ["-O", "-output-source-map"]    /* Autolinking */    autolinkLibrariesWithApp()}/** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()/** * The preferred build flavor of JavaScriptCore (JSC) * * 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:+'android {    ndkVersion rootProject.ext.ndkVersion    buildToolsVersion rootProject.ext.buildToolsVersion    compileSdk rootProject.ext.compileSdkVersion    namespace 'com.badihbarakat.myapp'    defaultConfig {        applicationId 'com.badihbarakat.myapp'        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 1        versionName "1.0.0"    }    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            shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"            crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true)        }    }    packagingOptions {        jniLibs {            useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)        }    }    androidResources {        ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'    }}// Apply static values from `gradle.properties` to the `android.packagingOptions`// Accepts values in comma delimited lists, example:// android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->    // Split option: 'foo,bar' -> ['foo', 'bar']    def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");    // Trim all elements in place.    for (i in 0..<options.size()) options[i] = options[i].trim();    // `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.    options -= ""    if (options.length > 0) {        println "android.packagingOptions.$prop += $options ($options.length)"        // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'        options.each {            android.packagingOptions[prop] += it        }    }}dependencies {    // The version of react-native is set by the React Native Gradle Plugin    implementation("com.facebook.react:react-android")    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";    if (isGifEnabled) {        // For animated gif support        implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")    }    if (isWebpEnabled) {        // For webp support        implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")        if (isWebpAnimatedEnabled) {            // Animated webp support            implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")        }    }    if (hermesEnabled.toBoolean()) {        implementation("com.facebook.react:hermes-android")    } else {        implementation jscFlavor    }}

If any other information is require, please let me know. I've been struggling with it for a week now.Thank,Badih


Viewing latest article 26
Browse Latest Browse All 29390

Trending Articles