Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed

I've made a demo app and added some animation using Lottie, it works fine in debug but fails in release mode. This is the error I get

Execution failed for task ':lottie-react- 
native:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.andr

this is my build.gradle

buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}


allprojects {
repositories {
    google()
    mavenLocal()
    jcenter()
    maven {
        url 'https://maven.google.com'
    }
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext.versions = [:]
versions.compileSdk = 28
versions.minSdk = 19
versions.targetSdk = 26
versions.support = "28.0.0"
versions.constraint_layout = "1.1.3"
versions.glide = "4.8.0"
versions.work = "1.0.0-alpha10"

app level gradle

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
    applicationId "com.pois"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
subprojects {
    project.configurations.all {
        afterEvaluate {project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion 26
                    buildToolsVersion '26.0.1'
                }
            }
        }
    }
}

signingConfigs {
    release {
        if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
    }
}
buildTypes {
    release {
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
    }
}
// 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:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2]
        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 {
compile project(':lottie-react-native')
compile project(':react-native-code-push')
compile project(':react-native-vector-icons')
compile project(':react-native-view-overflow')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:28.0.0'
compile "com.android.support:support-v4:28.0.+"
compile 'com.facebook.react:react-native:+'
// From node_modules
implementation "android.arch.work:work-runtime:$versions.work"
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex:rxandroid:1.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
    transitive = true;
}
}

This error came into existence only after I added Lottie to the project. It works fine when I run it with react-native run-android but when I generate a signed apk it does not work.

like image 942
Divye Shah Avatar asked Nov 18 '25 06:11

Divye Shah


1 Answers

So stupid of me. I just needed to upgrade the compileSdkVersion of the Lottie library and codePush in their respective gradle files and Voila good to go.

like image 183
Divye Shah Avatar answered Nov 19 '25 20:11

Divye Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!