yamill/react-native-orientation

failed linking references.

Tyrone2333 opened this issue ยท 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
    }

me too

+1 exactly same thing

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.

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

+1

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

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:+"
}

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

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"

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

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.

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

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