Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release APK crash immediately on launch - React Native ( Version 0.58.4) #23352

Closed
ank26oct opened this issue Feb 9, 2019 · 41 comments
Closed
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@ank26oct
Copy link

ank26oct commented Feb 9, 2019

🐛 Bug Report

The android version runs perfectly in debug mode using android studio emulator. However, the release version of the apk crashes immediately when launched.

To Reproduce

Steps to reproduce the behavior.

Reproducible Demo

react-native init Demo
cd AwesomeProject

After this Just install following:

npm i --save react-native-crypto
npm i bitcore-lib --save
npm i --save react-native-randombytes
react-native link react-native-randombytes
npm i --save-dev tradle/rn-nodeify
./node_modules/.bin/rn-nodeify --hack --install

rn-nodeify will create a shim.js in the project root directory

import './shim.js' file in aap.js

react-native run-android

It runs perfectly in debug mode.
I have created signed apk it gets created without any error also installed without error but when i open, it crashes

Expected Behavior

The app should run without crashing.
App crashes on launch, logcat throws this error:

02-09 11:18:38.980 13627-13645/com.productionbuild E/ReactNativeJS: undefined is not a function (evaluating 'n.fill(255)')
02-09 11:18:38.995 13627-13645/com.productionbuild E/ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
02-09 11:18:39.007 13627-13646/com.productionbuild E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.productionbuild, PID: 13627
    com.facebook.react.common.JavascriptException: undefined is not a function (evaluating 'n.fill(255)'), stack:
    exports@527:162
    <unknown>@526:54
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@525:59
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@503:548
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@355:242
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@11:58
    _@2:1514
    d@2:897
    o@2:435
    global code@566:4
    
        at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
        at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:148)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
        at java.lang.Thread.run(Thread.java:818)

Code Example

import React, { Component } from "react";
import { Platform, StyleSheet, Text, View } from "react-native";
import "./shim.js";
import bitcoin from "bitcore-lib";
// import { Buffer } from "safe-buffer";
// var Buffer;
// if (typeof global !== "undefined") {
//   var Buffer = require("safe-buffer/").Buffer;
//   global.Buffer = Buffer; // TODO just use global Buffer
// }

type Props = {};
export default class App extends Component<Props> {
  constructor(props) {
    super(props);
    this.generateBitcoinKeys = this.generateBitcoinKeys.bind(this);
  }

  generateBitcoinKeys() {
    var privateKey = new bitcoin.PrivateKey(bitcoin.Networks.testnet);
    var publicKey = privateKey.toPublicKey();
    var address = publicKey.toAddress(bitcoin.Networks.testnet);
    return {
      Address: address.toString(),
      privateKey: privateKey.toString(),
      publicKey: publicKey.toString()
    };
  }
  render() {
    var aa = this.generateBitcoinKeys();
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>bitcoin address: {aa.Address}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  welcome: {
    fontSize: 20,
    textAlign: "center",
    margin: 10
  },
  instructions: {
    textAlign: "center",
    color: "#333333",
    marginBottom: 5
  }
});

Environment

Platform: Android
React Native Environment Info:
System: Windows 10
CPU: x64 Intel(R) Core(TM) i5- CPU M 520 @ 2.40GHz 2.39 GHz

Binaries:
Node : 8.11.3
npm: 6.4.1

IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5014246
VS Code: 1.31.0
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.4 => 0.58.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

@jassumgoran
Copy link

jassumgoran commented Feb 10, 2019

I have the exact same issue and the same dependencies (versions). All works good in debug builds but release builds are crashing:

2019-02-10 12:22:53.475 9442-9482/? E/ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
2019-02-10 12:22:53.486 9442-9483/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.borntoinvest.borntoinvest, PID: 9442
    com.facebook.react.common.c: null is not an object (evaluating 'P.MARKET'), stack:
    <unknown>@408:287
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@406:3622
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@382:167
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@380:152
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@355:216
    _@2:1514
    d@2:967
    o@2:435
    <unknown>@11:58
    _@2:1514
    d@2:897
    o@2:435
    global code@643:4
    
        at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(Unknown Source:20)
        at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(Unknown Source:0)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:148)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:808)
        at android.os.Handler.dispatchMessage(Handler.java:101)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
        at android.os.Looper.loop(Looper.java:166)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(Unknown Source:16)
        at java.lang.Thread.run(Thread.java:784)

@jassumgoran
Copy link

Disabling minification for release builds solved it for me:

def enableProguardInReleaseBuilds = false

@ank26oct
Copy link
Author

ank26oct commented Feb 11, 2019

@jassumgoran, this is already false. Not working.

@ank26oct
Copy link
Author

I have resolved this issue by using JSC build scripts for Android. Thanks to jsc-android.

@wouterds
Copy link

wouterds commented Feb 15, 2019

@ank26oct: Hi, I have the same issue, also since I upgraded to 0.58.x (from 0.57.3). But I have it on iOS, haven't tried Android yet. Does it work for you on iOS? Could you elaborate on the fix / what needs to be changed exactly?

@jollyjoker992
Copy link

Same as you. Looking forward a correct solution.

@wouterds
Copy link

Just upgraded from 0.58.4 to 0.58.5, still the same issue unfortunately.

@kelset
Copy link
Contributor

kelset commented Feb 22, 2019

I have resolved this issue by using JSC build scripts for Android.

React Native 0.59 will embed that JSC version, so unless someone can post a repro that uses 0.59 (meaning, a project init-ed to 0.59rc2 that still create the crash) there is no need to keep this open.

Moreover, it really seems that it has something to do with the libraries you add, not React Native itself.

Again, if you can post a repro for 0.59* I'll re-open.

@kelset kelset closed this as completed Feb 22, 2019
@jollyjoker992
Copy link

@ank26oct Do you know what exact library causes this problem?

@wouterds
Copy link

I've been debugging for hours, I have no clue what's causing it.

@jollyjoker992
Copy link

@ank26oct It just works in emulator, not in real device. Could you post your solution here?

@ank26oct
Copy link
Author

ank26oct commented Feb 28, 2019

Sorry for late reply. Its working both in emulator as well as in production build (real device). For this you have to install JSC build scripts for Android. You must use version r15c to build. r17 and above break NDK build that this app requires. Download the r15c NDK version here: https://developer.android.com/ndk/downloads/older_releases.

and follow the installation requirements for JSC build scripts for Android.
After installation and path setup i have made following changes in Android/build.gradle:

allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Local Maven repo containing AARs with JSC library built for Android
url "$rootDir/../node_modules/jsc-android/android"
}
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}

and in Android i have made following changes in android/app/build.gradle

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

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

defaultConfig {
    applicationId "com.abbc"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    ndk {
        abiFilters "armeabi-v7a", "x86"
    }
    multiDexEnabled true
    renderscriptTargetApi 23
    renderscriptSupportModeEnabled true
}

packagingOptions {
    pickFirst 'lib/x86_64/libjsc.so'
    pickFirst 'lib/arm64-v8a/libjsc.so'
}
signingConfigs {
    release {
        if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a"
    }
}
buildTypes {
    release {
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
    }
}
// applicationVariants are e.g. debug, release

applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}

configurations.all {
resolutionStrategy {
force 'org.webkit:android-jsc:r216113'
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

I hope this will help you.
Thanks

@lucaspiressimao
Copy link

lucaspiressimao commented Apr 22, 2019

I am facing the same problem with RN 0.59.4. After installing react-native-admob and changing some dependencies I can compile but not run the app. But I can't use even in debug. What I should check ?
This problem occours affter instaling and linking admob lib.

dependencies {
    implementation (project(':react-native-admob')){
        exclude group: "com.google.android.gms", module: "play-services-ads"
    }
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-firebase')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.google.firebase:firebase-auth:16.2.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.google.firebase:firebase-core:16.0.8"
    implementation ("com.google.android.gms:play-services-ads:17.0.0") {
        force = true;
    }
}

Any ideas ? plz...

@quietbits
Copy link

I'm getting these crashes with RN version 0.59.5 with APK, too. It works fine when building, but APK crashes right after opening the app. Can reproduce this on a real device (OnePlus 3, Android version 8.0.0), as well as on emulators (Pixel 3 XL with 64 bit Android 9.0 and Nexus 6P with Android 7.1.1). I can confirm that this is an issue even with a clean project created with react-native init. Other solutions mentioned here have not worked for me.

@douglasjunior
Copy link

douglasjunior commented May 15, 2019

@quietbits Seems to be related to #24260

@quietbits
Copy link

Posting this here as well in the other related issue. Here is a repo with APK to try: https://github.com/quietbits/react-native-apk-crash. Any tests are much appreciated!

@dagenius007
Copy link

I am having the same issue. RN version 0.57.8

@ndvbd
Copy link

ndvbd commented May 16, 2019

solved when I moved from 0.59.0-rc.0 to 0.59.8

@devt3000
Copy link

https://medium.com/@impaachu/react-native-android-release-build-crash-on-device-14f2c9eacf18 this post fixed my issue, but I skipped some steps.

@douglasjunior
Copy link

I found this issue #24261 with Hi-Pri tag.

@ranapk
Copy link

ranapk commented May 29, 2019

after generating the keystore run the following command

"react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"

this worked for me

@rodrigobutta
Copy link

rodrigobutta commented Jun 1, 2019

This might help!!!!!!

When the screen closes at start, there might be some errors not being showed in the build console. I don't know why. So instead of running the react-native run-android, try tu run this:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
It will try to compile and it will start throwing the errors nobody was telling you!!

It took me several hours to notice this, after knowing the errors, i fixed one by one. Hope it helps!!

Some of the silly errors that were closing the app just after starts:
image
image

@mathew3
Copy link

mathew3 commented Jun 10, 2019

Try to use adb logcat *:E, super helpful if the error is not JS related

@JuliyaShirokova
Copy link

I am having the same issue. RN version 0.60.
Solved when I set enableProguardInReleaseBuilds to false.

@azharuddinkhan8898
Copy link

This resolved my issue.

@chilugen
Copy link

@azharuddinkhan8898 its not working

@azharuddinkhan8898
Copy link

azharuddinkhan8898 commented Aug 29, 2019

@chilugen Use this adb logcat *:E and check what error you are getting when you open your app.

@chilugen
Copy link

chilugen commented Aug 29, 2019

Untitled
@azharuddinkhan8898

@ShaneMatthias
Copy link

Upgrading from RN 0.59.5 to RN 0.59.10 worked for me.

@chilugen
Copy link

@LeonardoPlacanica
Copy link

Updated to 0.59.10 but still not working just apk crash on start. I've tried every workaround but nothing any suggestion?

@chilugen
Copy link

delete node_modules folder reinstall npm i @LeonardoPlacanica

@LeonardoPlacanica
Copy link

Already tried at least 10 times. The app is building the release correctly but once i run the apk on a device it crashes at the start

@chilugen
Copy link

@LeonardoPlacanica some android folder code plz

@LeonardoPlacanica
Copy link

build.gradle on root project
`// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
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.3.0")

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

}

allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "27.0.0"
}
}`

build.gradle in app folder
`apply plugin: "com.android.application"

import com.android.build.OutputFile

/**

  • The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
  • and bundleReleaseJsAndAssets).
  • These basically call react-native bundle with the correct arguments during the Android build
  • cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
  • bundle directly from the development server. Below you can see all the possible configurations
  • and their defaults. If you decide to add a configuration block, make sure to add it before the
  • apply from: "../../node_modules/react-native/react.gradle" line.
  • project.ext.react = [
  • // the name of the generated asset file containing your JS bundle
  • bundleAssetName: "index.android.bundle",
  • // the entry file for bundle generation
  • entryFile: "index.android.js",
  • // whether to bundle JS and assets in debug mode
  • bundleInDebug: false,
  • // whether to bundle JS and assets in release mode
  • bundleInRelease: true,
  • // whether to bundle JS and assets in another build variant (if configured).
  • // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
  • // The configuration property can be in the following formats
  • // 'bundleIn${productFlavor}${buildType}'
  • // 'bundleIn${buildType}'
  • // bundleInFreeDebug: true,
  • // bundleInPaidRelease: true,
  • // bundleInBeta: true,
  • // whether to disable dev mode in custom build variants (by default only disabled in release)
  • // for example: to disable dev mode in the staging build type (if configured)
  • devDisabledInStaging: true,
  • // The configuration property can be in the following formats
  • // 'devDisabledIn${productFlavor}${buildType}'
  • // 'devDisabledIn${buildType}'
  • // the root of your project, i.e. where "package.json" lives
  • root: "../../",
  • // where to put the JS bundle asset in debug mode
  • jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
  • // where to put the JS bundle asset in release mode
  • jsBundleDirRelease: "$buildDir/intermediates/assets/release",
  • // where to put drawable resources / React Native assets, e.g. the ones you use via
  • // require('./image.png')), in debug mode
  • resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
  • // where to put drawable resources / React Native assets, e.g. the ones you use via
  • // require('./image.png')), in release mode
  • resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
  • // by default the gradle tasks are skipped if none of the JS files or assets change; this means
  • // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
  • // date; if you have any other folders that you want to ignore for performance reasons (gradle
  • // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
  • // for example, you might want to remove it from here.
  • inputExcludes: ["android/", "ios/"],
  • // override which node gets called and with what additional arguments
  • nodeExecutableAndArgs: ["node"],
  • // supply additional arguments to the packager
  • extraPackagerArgs: []
  • ]
    */

project.ext.react = [

entryFile: "index.js",
bundleAssetName: "index.android.bundle",
bundleInAlpha: true,
bundleInBeta: true,

// whether to bundle JS and assets in debug mode
bundleInDebug: false,
// whether to bundle JS and assets in release mode
bundleInRelease: true, 

// the root of your RN project, i.e. where "package.json" lives
root: "../../"

]

apply from: "../../node_modules/react-native/react.gradle"

/**

  • Set this to true to create two separate APKs instead of one:
    • An APK that only works on ARM devices
    • An APK that only works on x86 devices
  • The advantage is the size of the APK is reduced by about 4MB.
  • Upload all the APKs to the Play Store and people will download
  • the correct one based on the CPU architecture of their device.
    */
    def enableSeparateBuildPerCPUArchitecture = false

/**

  • Run Proguard to shrink the Java bytecode in release builds.
    */
    def enableProguardInReleaseBuilds = false

android {
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.medallioniosapp"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
    missingDimensionStrategy 'react-native-camera', 'general'
    multiDexEnabled true
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
signingConfigs {      
    release {
        storeFile file(MYAPP_RELEASE_STORE_FILE)
        storePassword MYAPP_RELEASE_STORE_PASSWORD
        keyAlias MYAPP_RELEASE_KEY_ALIAS
        keyPassword MYAPP_RELEASE_KEY_PASSWORD
    }
}
buildTypes {
    release {
        minifyEnabled enableProguardInReleaseBuilds            
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
    }
}
packagingOptions {
    exclude 'META-INF/androidx.exifinterface_exifinterface.version'
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}

}

dependencies {
compile (project(':react-native-camera')) {
exclude group: "com.android.support"
}
implementation "com.android.support:exifinterface:+"
implementation "com.android.support:support-annotations:+"
implementation "com.android.support:support-v4:+"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
// For animated GIF support
compile 'com.facebook.fresco:animated-gif:1.10.0'
implementation "com.google.android.gms:play-services-gcm:12.+"
compile project(':react-native-fetch-blob')
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
`

@longnk-1447
Copy link

Already tried at least 10 times. The app is building the release correctly but once i run the apk on a device it crashes at the start

the same, any solution for help me!!

@codewithaashir
Copy link

Please try to use try catch in your function when you use another service

@rodrigofbm
Copy link

I'm facing this after install react-native-firebase. This happens only on Android 8.0 by now.

@tomybudiman
Copy link

Disabling minification for release builds solved it for me:

def enableProguardInReleaseBuilds = false

Thank you! It works for me! 🎉

@arnaudambro
Copy link

Try to use adb logcat *:E, super helpful if the error is not JS related

best tip ever !
I could see that

E/AndroidRuntime(18795): FATAL EXCEPTION: AsyncTask #4
E/AndroidRuntime(18795): Process: com.myapp, PID: 18795
E/AndroidRuntime(18795): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(18795): 	at android.os.AsyncTask$3.done(AsyncTask.java:304)
E/AndroidRuntime(18795): 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(18795): 	at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(18795): 	at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(18795): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(18795): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(18795): 	at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime(18795): Caused by: java.lang.SecurityException: Neither user 10116 nor current process has android.permission.READ_PROFILE.
E/AndroidRuntime(18795): 	at android.os.Parcel.readException(Parcel.java:1546)
E/AndroidRuntime(18795): 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
E/AndroidRuntime(18795): 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
E/AndroidRuntime(18795): 	at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
E/AndroidRuntime(18795): 	at android.content.ContentResolver.query(ContentResolver.java:489)
E/AndroidRuntime(18795): 	at android.content.ContentResolver.query(ContentResolver.java:433)
E/AndroidRuntime(18795): 	at com.rt2zz.reactnativecontacts.ContactsProvider.getContacts(ContactsProvider.java:212)
E/AndroidRuntime(18795): 	at com.rt2zz.reactnativecontacts.ContactsManager$1.doInBackground(ContactsManager.java:101)
E/AndroidRuntime(18795): 	at com.rt2zz.reactnativecontacts.ContactsManager$1.doInBackground(ContactsManager.java:94)
E/AndroidRuntime(18795): 	at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/AndroidRuntime(18795): 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)

adding then <uses-permission android:name="android.permission.READ_PROFILE"/> to my AndroidManifest.xlm solved my problem

@TRIPTI-JAIN
Copy link

#24260 (comment)

@facebook facebook locked as resolved and limited conversation to collaborators Feb 22, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests