KjellConnelly / react-native-shared-group-preferences

127 stars 57 forks source link

release build generation fails #7

Open harshOnAndroid opened 5 years ago

harshOnAndroid commented 5 years ago

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
KjellConnelly commented 5 years ago

No clue - did you figure it out?

yakirzana commented 4 years ago

I have the same issue:

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

FAILURE: Build failed with an exception.

joaomoreirasys commented 3 years ago

I have the same issue too. Any idea?

KjellConnelly commented 3 years ago

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 commented 3 years ago

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.

DigohD commented 2 years ago

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 commented 2 years ago

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

adamsolomon1986 commented 1 year ago

I can confirm DigohD solution works