react-native-orientation icon indicating copy to clipboard operation
react-native-orientation copied to clipboard

failed linking references.

Open Tyrone2333 opened this issue 6 years ago • 14 comments

> Task :react-native-orientation:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-orientation:verifyReleaseResources'.
> 1 exception was raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
  error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster'
 not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2734: error: resource android:attr/fontStyle not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2735: error: resource android:attr/font not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2736: error: resource android:attr/fontWeight not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2737: error: resource android:attr/fontVariationSettings not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2738: error: resource android:attr/ttcIndex not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2902: error: resource android:attr/startX not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2905: error: resource android:attr/startY not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2908: error: resource android:attr/endX not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2911: error: resource android:attr/endY not found.
  E:\cunshu\app\cycunshu\node_modules\react-native-orientation\android\build\intermediates\res\merged\release\values\values.xml:2919: error: resource android:attr/offset not found.
  error: failed linking references.

build.gradle

    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")

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

Tyrone2333 avatar Oct 31 '19 01:10 Tyrone2333

me too

lp4298707 avatar Nov 01 '19 09:11 lp4298707

+1 exactly same thing

v-vashchenko avatar Nov 06 '19 15:11 v-vashchenko

I modified node_modules/react-native-orientation/android/build.gradle SdkVersion 23 => 28

    compileSdkVersion 28
    buildToolsVersion "28.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28

It works for me.

Tyrone2333 avatar Nov 07 '19 04:11 Tyrone2333

the error still exists, and the code which is fixed by erheme318 is not changed in the master branch.

genglei01 avatar Apr 27 '20 02:04 genglei01

+1

alex521 avatar Jun 15 '20 02:06 alex521

It works for me, too. Thank you @Tyrone2333 for the answer.

arlovip avatar Jul 31 '20 02:07 arlovip

Hey there, any update on this? This is the build.gradle right after install:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}

dependencies {
    compile "com.facebook.react:react-native:+"
}

kitsbits avatar Aug 26 '20 20:08 kitsbits

Any update on this? Manually editing this package's build.gradle is not maintainable.

kitsbits avatar Sep 15 '20 23:09 kitsbits

Anyone facing the same issue can run this patch via a bashscript using postinstall hook in package.json

#!/usr/bin/env bash
echo "Fixing build.gradle for RN Orientation"
sed -ie "s/23/28/" node_modules/react-native-orientation/android/build.gradle
sed -ie "s/22/28/" node_modules/react-native-orientation/android/build.gradle
echo "Done"

idsingh avatar Oct 07 '20 05:10 idsingh

try this: node_modules/react-native-orientation/android/build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}

dependencies {
    compile "com.facebook.react:react-native:+"
}

goodjun avatar Oct 14 '20 01:10 goodjun

It works for me. Thank you @goodjun

danielbadry avatar Apr 28 '21 09:04 danielbadry

Same issue. @yamill could you merge the update?

Until then, you guys can use: "react-native-orientation": "git+https://github.com/yamill/react-native-orientation.git#190ac7968f59af68b2febfbe7ada7de2317e847b", in your package.json.

AlbertoMeQ avatar Jun 10 '21 19:06 AlbertoMeQ

try this: node_modules/react-native-orientation/android/build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
}

dependencies {
    compile "com.facebook.react:react-native:+"
}

It works for me. Thank you @goodjun

JeffPatricio avatar Oct 19 '21 19:10 JeffPatricio

I have a better solution

rootProject/android/build.gradle

subprojects {
    afterEvaluate {subProject ->
        if (subProject.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}

Alan0725 avatar Dec 17 '21 02:12 Alan0725