1
votes

I get this error when trying to compile in React Native, I have fixed the version of the SDK in 27.0.3 and it does not work. Any ideas of what may be happening?

Error:

C:\Users\devan.gradle\caches\transforms-1\files-1.1\appcompat-v7-

27.1.1.aar\750a91892d2e2f437e111b8d6039bfbe\res\values-v24\values-v24.xml:3:5-157: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

C:\Users\devan.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\750a91892d2e2f437e111b8d6039bfbe\res\values-v24\values-v24.xml:4:5-135: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

C:\Users\devan.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\750a91892d2e2f437e111b8d6039bfbe\res\values-v26\values-v26.xml:13:5-16:13: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

 FAILURE: Build failed with an exception.
  • What went wrong: Execution failed for task ':react-native-orientation:verifyReleaseResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt

My build.gradle:

android {


compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
    applicationId "com.yojma"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 3
    versionName "3.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
}
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(':react-native-orientation')
    compile project(':react-native-video')
    compile project(':react-native-vector-icons')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.0.3"
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

// 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'
}

I've been trying to compile for a day. This has become very frustrating.

1
Were you able to solve this issue? - Suhair Zain
also having the same issue - vbvx

1 Answers

0
votes

adding this to the project gradle file solved the issue for me:

subprojects {
  afterEvaluate {project ->
    if (project.hasProperty("android")) {
      android {
        compileSdkVersion 27
        buildToolsVersion "27.1.1"
      }
    }
  }
}

as per suggested here React native Android Generate Signed APK giving Resource error which forces android subproject to use gradle build tool 27. My assumption is that some libraries in your project are using build tool version 26 or lower and this generates a broken apk. For example, I would check gradle build tool of react-native-orientation ':react-native-orientation:verifyReleaseResources'.