react-native-background-geolocation: Error while generating signed android build.

I am facing an issue while generating a signed build of the app. however there is no error during debug

Your Environment

  • Plugin version:3.0.2
  • Platform: iOS or Android: Android
  • OS version:5.0
  • Device manufacturer / model: LYF LS5001
  • React Native version (react-native -v):0.55.4
  • Plugin config

Expected Behavior

Successfull android build.

Actual Behavior

Error while taking android build

* What went wrong:
Execution failed for task ':react-native-background-geolocation:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

Steps to Reproduce

1.cd android 2. gradlew assembleRelease

Context

Generate a signed android build

Debug logs

* What went wrong:
Execution failed for task ':react-native-background-geolocation:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

android/build.gradle

buildscript {
    ext {
        googlePlayServicesVersion = "11.8.0"
        // googlePlayServicesVersion = "15.0.1" // default: "+"
        compileSdkVersion = 27 // default: 23
        buildToolsVersion = "27" // default: "25.0.2"
        targetSdkVersion = 27 // default: 22
        googlePlayServicesLocationVersion = "16.0.0"
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.1.0'
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        // Add jitpack repository (added by tipsi-stripe)
        maven { url "https://jitpack.io" }
        mavenLocal()
        google()
        maven {url "https://maven.google.com"} 
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        flatDir {
            dirs "$rootDir/libs"
        }
        maven { url "$rootDir/../node_modules/react-native-background-fetch/android/libs" }
        maven { url "$rootDir/../node_modules/react-native-background-geolocation/android/libs" }

    }
}


subprojects {
    if (project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                jcenter()
                maven { url "https://dl.bintray.com/android/android-tools/" }
            }
        }
    }
}

android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: 'io.fabric'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

import com.android.build.OutputFile



project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"


def enableSeparateBuildPerCPUArchitecture = false

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

android {
	purgeBackgroundGeolocationDebugResources(applicationVariants)
    compileSdkVersion rootProject.ext.compileSdkVersion
    // buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.reorder.clap"
        minSdkVersion 18
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 134
        multiDexEnabled true
        versionName "1.134"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [onesignal_app_id: "e344f931-b51f-4a43-855a-96e521a3ea51",
                                onesignal_google_project_number: "REMOTE"]
    }
    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
            }
        }
    }
}

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal 
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
    }
}

dependencies {
    implementation project(':@estimote_react-native-proximity')
    compile project(':react-native-background-fetch')
    compile project(':react-native-background-geolocation')
    compile project(':react-native-geolocation-service')
    compile project(':react-native-gesture-handler')
    compile project(':scandit-react-native')
    compile project(':react-native-camera')
    compile project(':react-native-qr-generator')
    compile project(':react-native-onesignal')
    compile project(':react-native-pdf')
    compile project(':rn-fetch-blob')
    implementation project(':react-native-reanimated')
    implementation project(':react-native-firebase')
      implementation "com.google.android.gms:play-services-base:16.1.0"
      implementation "com.google.android.gms:play-services-location:16.0.0"
    implementation "com.google.firebase:firebase-core:16.0.8"
    implementation "com.google.firebase:firebase-auth:16.2.0"
    implementation "com.google.firebase:firebase-perf:16.2.4"
    implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
    implementation project(':react-native-fbsdk')
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation project(':react-native-device-info')
    implementation project(':tipsi-stripe')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-linear-gradient')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.facebook.android:facebook-login:[4,5)'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation ("com.facebook.react:react-native:+") { force = true }  // From node_modules
    // compile project(':react-native-intercom')    
    // compile 'io.intercom.android:intercom-sdk-base:3.+'
    implementation project(':instabug-reactnative')
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true
    }
}

// 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 plugin: 'com.google.gms.google-services'
apply plugin: "com.google.firebase.firebase-perf"
// com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

// [Added by react-native-background-geolocation] Purge debug sounds from release build.
def purgeBackgroundGeolocationDebugResources(applicationVariants) {
    if ((rootProject.ext.has("removeBackgroundGeolocationDebugSoundsInRelease")) && (rootProject.ext.removeBackgroundGeolocationDebugSoundsInRelease == false)) return
    applicationVariants.all { variant ->
        if (variant.buildType.name == "release") {
            println("[react-native-background-geolocation] Purging debug resources in release build")
            variant.mergeResources.doLast {
                delete(fileTree(dir: variant.mergeResources.outputDir, includes: ["raw_tslocationmanager*"]))
            }
        }
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

Never hard-code support lib version. Use ext.supportLibVersion gradle variable.