react-native-shared-group-preferences icon indicating copy to clipboard operation
react-native-shared-group-preferences copied to clipboard

release build generation fails

Open harshOnAndroid opened this issue 5 years ago • 8 comments

I am getting no idea at all why release build is failing.

i think something is wrong with this folder-

node_modules\react-native-shared-group-preferences\android\build\intermediates\res\compiled\release\

a lot of files under this folder gets printed in the console. The log doens't even fit in the console.

stacktrace -

Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
        at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.doLink(Aapt2DaemonImpl.kt:177)
        at com.android.builder.internal.aapt.v2.Aapt2Daemon.link(Aapt2Daemon.kt:103)
        at com.android.builder.internal.aapt.v2.Aapt2DaemonManager$LeasedAaptDaemon.link(Aapt2DaemonManager.kt:176)
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:823)
        at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable$run$1.invoke(Aapt2ProcessResourcesRunnable.kt:34)
        at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable$run$1.invoke(Aapt2ProcessResourcesRunnable.kt:28)
        at com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon(Aapt2DaemonManagerService.kt:71)
        at com.android.build.gradle.internal.res.namespaced.Aapt2DaemonManagerService.useAaptDaemon$default(Aapt2DaemonManagerService.kt:69)
        at com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable.run(Aapt2ProcessResourcesRunnable.kt:33)
        at com.android.ide.common.workers.ExecutorServiceAdapter$submit$submission$1.run(ExecutorServiceAdapter.kt:39)
        ... 46 more

harshOnAndroid avatar Apr 11 '19 06:04 harshOnAndroid

No clue - did you figure it out?

KjellConnelly avatar Oct 21 '19 23:10 KjellConnelly

I have the same issue:

Task :react-native-shared-group-preferences:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-shared-group-preferences:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade 1 exception was raised by workers: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed C:\Users\user.gradle\caches\transforms-2\files-2.1\ce0c402438ea724ce7f42dbc3d780e69\appcompat-1.0.2\res\values-v26\values-v26.xml:5:5-8:13: AAPT: error: resource android:attr/colorError not found. C:\Users\user.gradle\caches\transforms-2\files-2.1\ce0c402438ea724ce7f42dbc3d780e69\appcompat-1.0.2\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

yakirzana avatar Nov 10 '20 09:11 yakirzana

I have the same issue too. Any idea?

joaomoreirasys avatar Feb 17 '21 18:02 joaomoreirasys

Not sure. It's working for me on the latest version of RN. Btw, I need to update this library in the next few days. I just realized from some of my users that data isn't being saved to external storage. It was on my test device. Since API 29 (30 is the latest), one of the methods used is deprecated, which is why I am guessing it isn't working on some users' devices.

KjellConnelly avatar Feb 17 '21 19:02 KjellConnelly

Ok, I did a bit of research, and I think it has to do with your project using an older build which does not contain some properties. If you're on the latest version of react-native, then this shouldn't be a problem. But if you're using a significantly older version, this becomes more likely based on using older buildTools, targetSdkVersions, etc... Not quite sure the combination myself, but thats what I got from this thread:

https://github.com/luggit/react-native-config/issues/299

TLDR: Update android build tools/sdk/etc.

KjellConnelly avatar Feb 18 '21 21:02 KjellConnelly

I get the same error now when upgrading from RN 0.68 to 0.69. Probably the reverse problem perhaps? That the package needs an update to keep up?

DigohD avatar Aug 09 '22 14:08 DigohD

Heading into react-native-shared-group-preferences node_modules folder, updating gradle and minSdkVersion to the same as in my main android project files solved the issue for me!

Here is the new full build.gradle file:

    repositories {
        google()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 31
    buildToolsVersion "31.0.0"

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.facebook.react:react-native:+'
}

Hope it can help someone else in need

DigohD avatar Aug 09 '22 14:08 DigohD

I can confirm DigohD solution works

adamsolomon1986 avatar Feb 01 '23 19:02 adamsolomon1986