0

I've designed a react native mobile app, and app works well when testing it on expo tunnel, but the issue comes when I try to generate an apk for the app. When I run eas build, it runs for some time, and then returns this error

> Task :expo-gl:buildCMakeRelWithDebInfo[arm64-v8a]
[stderr] 
FAILURE: Build failed with an exception.
[stderr] 
* What went wrong:
[stderr] 
Execution failed for task ':app:bundleReleaseResources'.
[stderr] 
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable
[stderr] 
   > Android resource linking failed
[stderr] 
     ERROR:/home/expo/workingdir/build/android/app/build/intermediates/incremental/release/mergeReleaseResources/merged.dir/values/values.xml:879: AAPT: error: resource drawable/rn_edit_text_material (aka tomato_app.diagnosis:drawable/rn_edit_text_material) not found.
[stderr] 
         
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 5m 55s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.6.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 3 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
495 actionable tasks: 495 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

I feel so frustrated, I've been debuging this for the past 3 days, Idk what am doing wrong. Here is my android build.gradle

    buildscript {
    ext {
        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '33.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '33')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '33')
        // if (findProperty('android.kotlinVersion')) {
            kotlinVersion = "1.8.0"//findProperty('android.kotlinVersion')
        // }
        frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.3'
        classpath('com.android.tools.build:gradle:7.4.2')
        classpath('com.facebook.react:react-native-gradle-plugin')
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
    }
}

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')"].execute(null, rootDir).text.trim(), '../dist'))
        }
        maven {
            // expo-camera bundles a custom com.google.android:cameraview
            url "$rootDir/../node_modules/expo-camera/android/maven"
        }
        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

And here is andriod/app/build.gradle

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"

import com.android.build.OutputFile

def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
def expoDebuggableVariants = ['debug']
// Override `debuggableVariants` for expo-updates debugging
if (System.getenv('EX_UPDATES_NATIVE_DEBUG') == "1") {
  react {
    expoDebuggableVariants = []
  }
}


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"
    debuggableVariants = expoDebuggableVariants
}

ext {
  hermesEnabled = (findProperty('expo.jsEngine') ?: "hermes") == "hermes"
}

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()

def jscFlavor = 'org.webkit:android-jsc:+'


def reactNativeArchitectures() {
    def value = project.getProperties().get("reactNativeArchitectures")
    return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {

    compileSdkVersion rootProject.ext.compileSdkVersion

    namespace 'tomato_app.diagnosis'
    defaultConfig {
        applicationId 'tomato_app.diagnosis'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 9
        versionName "1.0.2"
    }

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include (*reactNativeArchitectures())
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            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 =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }

        }
    }
}

["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
    
    def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
   
    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)"
       
        options.each {
            android.packagingOptions[prop] += it
        }
    }
}

dependencies {
    
    implementation("com.facebook.react:react-android")
    implementation 'com.github.mwiede:jsch:0.1.62'

    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
    def frescoVersion = rootProject.ext.frescoVersion

   
    if (isGifEnabled || isWebpEnabled) {
        implementation("com.facebook.fresco:fresco:${frescoVersion}")
        implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
    }

    if (isGifEnabled) {
       
        implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
    }

    if (isWebpEnabled) {
       
        implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
        if (isWebpAnimatedEnabled) {
           
            implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
        }
    }

    implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesAppBuildGradle(project)

apply plugin: 'com.google.gms.google-services'

I dont know what am doing wrong. I'll really be grateful if anyone can help me.

0 Answers0