0

My project was working perfectly but it stops building after upgrading to RN 0.62.0 from RN 0.59.5 (debug build is working fine, it happens only for assembleRelease)

I did some research and came across using macthingFallback, but that doesn't worked too.

missingDimensionStrategy can be a solution, but adding it for every library used can't be optimised option.

My android/app/build.gradle have

  1. Two items in signingConfigs i.e. prod and stage that contains info about .keystore

  2. Four items in productFlavors (i.e. dev, beta, prod, qa)

  3. Three items in buildTypes i.e.
   debug {
        applicationIdSuffix = ".dev"
    }
release {
    minifyEnabled enableProguardInReleaseBuilds
    proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    productFlavors.beta.signingConfig signingConfigs.stage
    productFlavors.prod.signingConfig signingConfigs.prod
    productFlavors.qa.signingConfig signingConfigs.stage
    matchingFallbacks = ['release']
}
packagingOptions {
    pickFirst "lib/armeabi-v7a/libc++_shared.so"
    pickFirst "lib/arm64-v8a/libc++_shared.so"
    pickFirst "lib/x86/libc++_shared.so"
    pickFirst "lib/x86_64/libc++_shared.so"
}

android/build.gradle have

dependencies{
   classpath('com.android.tools.build:gradle:3.6.3')
}

repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { url "https://www.jitpack.io" }
    }
}

my gradle-wrapper.properties have

distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip

my gradle.properties

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true

FLIPPER_VERSION=0.33.1

settings.gradle have

rootProject.name = 'APPNAME'

include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')


apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':react-native-sound'
project(':react-native-sound').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sound/android')

include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')

Error logs after running ./gradlew assembleRelease (giving error only for release build)

halfer
  • 19,824
  • 17
  • 99
  • 186
Manjeet Singh
  • 4,382
  • 4
  • 26
  • 39

2 Answers2

0

Using the README.md of the async-storage itself, you can install the library as follow:

If you're using yarn:

yarn add @react-native-community/async-storage

If you're using npm:

npm install --save @react-native-community/async-storage

Then:

npx jetify

Then run your project again

In case this doesn't work, try:

react-native link @react-native-community/async-storage

Then recompile your app again

Community
  • 1
  • 1
  • Thanks for the response, but it is happening for every native npm used. And I think we don't need to use link command after RN 0.60.0 – Manjeet Singh Apr 24 '20 at 17:30
  • Yeah, because Async storage supports auto-linking, but the newer versions of react-native it's kinda buggy. And if you migrate from 0.59 to 0.60+, so much things changed. Hope you find a solution! – William Brochensque junior Apr 24 '20 at 17:37
0

Without any success and searching over internet, I came across similar problem faced by someone with flutter and from there I added following lines in my android/app/build.gradle within android section

lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }

Now it is working fine in release as well as debug mode. (it might introduces some bugs, let's see)

Manjeet Singh
  • 4,382
  • 4
  • 26
  • 39