facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.21k stars 24.33k forks source link

Instant App Crash on Launch. Hermes Enabled. #35693

Closed AamirHafiez closed 1 year ago

AamirHafiez commented 1 year ago

Description

Hi, Require help.

I had upgraded react native from 0.66.4 to 0.70.6 and hermes enabled but when launching on any device I am getting the below error in logcat.

Error

---------------------------- PROCESS STARTED (10967) for package com.example.package ---------------------------- 2022-12-21 12:45:54.537 10967-10967 MultiDex com.example.package I VM with version 2.1.0 has multidex support 2022-12-21 12:45:54.537 10967-10967 MultiDex com.example.package I Installing application 2022-12-21 12:45:54.537 10967-10967 MultiDex com.example.package I VM has multidex support, MultiDex support library is disabled. 2022-12-21 12:45:54.567 10967-10967 FirebaseApp com.example.package I Device unlocked: initializing all Firebase APIs for app [DEFAULT] 2022-12-21 12:45:54.591 10967-10967 FirebaseCrashlytics com.example.package I Initializing Firebase Crashlytics 18.2.11 for com.example.package 2022-12-21 12:45:54.690 10967-10986 libcrashlytics com.example.package D Initializing libcrashlytics version 3.2.0 2022-12-21 12:45:54.702 10967-10985 DynamiteModule com.example.package I Considering local module com.google.android.gms.measurement.dynamite:73 and remote module com.google.android.gms.measurement.dynamite:0 2022-12-21 12:45:54.702 10967-10985 DynamiteModule com.example.package I Selected local version of com.google.android.gms.measurement.dynamite 2022-12-21 12:45:54.730 10967-10967 FA com.example.package W Failed to register event listener on calling thread. Trying again on the dynamite thread. 2022-12-21 12:45:54.778 10967-10986 libcrashlytics com.example.package D Initializing native crash handling successful. 2022-12-21 12:45:54.824 10967-10967 Glide com.example.package W Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored 2022-12-21 12:45:54.860 10967-10993 FA com.example.package I App measurement initialized, version: 64000 2022-12-21 12:45:54.860 10967-10993 FA com.example.package I To enable debug logging run: adb shell setprop log.tag.FA VERBOSE 2022-12-21 12:45:54.860 10967-10993 FA com.example.package I To enable faster debug mode event logging run: adb shell setprop debug.firebase.analytics.app com.example.package 2022-12-21 12:45:54.890 10967-10967 FirebaseInitProvider com.example.package I FirebaseApp initialization successful 2022-12-21 12:45:54.938 10967-10967 ReactNativeFirebaseApp com.example.package D received application context. 2022-12-21 12:45:54.963 10967-10967 RNFBCrashlyticsInit com.example.package D isCrashlyticsCollectionEnabled via RNFBJSON: true 2022-12-21 12:45:54.963 10967-10967 RNFBCrashlyticsInit com.example.package D isCrashlyticsCollectionEnabled after checking crashlytics_debug_enabled: false 2022-12-21 12:45:54.963 10967-10967 RNFBCrashlyticsInit com.example.package D isCrashlyticsCollectionEnabled final value: false 2022-12-21 12:45:54.963 10967-10967 RNFBCrashlyticsInit com.example.package I initialization successful 2022-12-21 12:45:54.997 10967-10977 art com.example.package I Background sticky concurrent mark sweep GC freed 25905(1569KB) AllocSpace objects, 15(300KB) LOS objects, 36% free, 6MB/10MB, paused 8.333ms total 93.737ms 2022-12-21 12:45:55.013 10967-10967 com.facebo...ngsManager com.example.package W Please set a value for AutoLogAppEventsEnabled. Set the flag to TRUE if you want to collect app install, app launch and in-app purchase events automatically. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events. 2022-12-21 12:45:55.013 10967-10967 com.facebo...ngsManager com.example.package W You haven't set a value for AdvertiserIDCollectionEnabled. Set the flag to TRUE if you want to collect Advertiser ID for better advertising and analytics results. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events. 2022-12-21 12:45:55.050 10967-11017 NetworkSecurityConfig com.example.package D No Network Security Config specified, using platform default 2022-12-21 12:45:55.064 10967-10967 WM-WrkMgrInitializer com.example.package D Initializing WorkManager with default configuration. 2022-12-21 12:45:55.097 10967-10967 fb-UnpackingSoSource com.example.package V locked dso store /data/user/0/com.example.package/lib-main 2022-12-21 12:45:55.099 10967-10967 fb-UnpackingSoSource com.example.package I dso store is up-to-date: /data/user/0/com.example.package/lib-main 2022-12-21 12:45:55.099 10967-10967 fb-UnpackingSoSource com.example.package V releasing dso store lock for /data/user/0/com.example.package/lib-main 2022-12-21 12:45:55.107 10967-10967 SoLoader com.example.package V libjscexecutor.so not found on /data/data/com.example.package/lib-main 2022-12-21 12:45:55.108 10967-10967 SoLoader com.example.package V libjscexecutor.so not found on /data/app/com.example.package-1/lib/x86 2022-12-21 12:45:55.108 10967-10967 SoLoader com.example.package V libjscexecutor.so not found on /system/lib 2022-12-21 12:45:55.108 10967-10967 SoLoader com.example.package V libjscexecutor.so not found on /system/vendor/lib 2022-12-21 12:45:55.108 10967-10967 System com.example.package W ClassLoader referenced unknown path: 2022-12-21 12:45:55.109 10967-10967 ApplicationLoaders com.example.package D ignored Vulkan layer search path /data/app/com.example.package-1/lib/x86:/data/app/com.example.package-1/base.apk!/lib/x86 for namespace 0xb2146090 2022-12-21 12:45:55.110 10967-10967 SoLoader com.example.package E couldn't find DSO to load: libjscexecutor.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.example.package/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.example.package-1/lib/x86 flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2] Native lib dir: /data/app/com.example.package-1/lib/x86 result: 0 2022-12-21 12:45:55.110 10967-10967 SoLoader com.example.package V libhermes.so not found on /data/data/com.example.package/lib-main 2022-12-21 12:45:55.111 10967-10967 SoLoader com.example.package D libhermes.so found on /data/app/com.example.package-1/lib/x86 2022-12-21 12:45:55.111 10967-10967 SoLoader com.example.package D Not resolving dependencies for libhermes.so 2022-12-21 12:45:55.118 10967-10967 SoLoader com.example.package V libhermes-executor-debug.so not found on /data/data/com.example.package/lib-main 2022-12-21 12:45:55.118 10967-10967 SoLoader com.example.package V libhermes-executor-debug.so not found on /data/app/com.example.package-1/lib/x86 2022-12-21 12:45:55.118 10967-10967 SoLoader com.example.package V libhermes-executor-debug.so not found on /system/lib 2022-12-21 12:45:55.118 10967-10967 SoLoader com.example.package V libhermes-executor-debug.so not found on /system/vendor/lib 2022-12-21 12:45:55.119 10967-10967 SoLoader com.example.package E couldn't find DSO to load: libhermes-executor-debug.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.example.package/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.example.package-1/lib/x86 flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2] Native lib dir: /data/app/com.example.package-1/lib/x86 result: 0 2022-12-21 12:45:55.119 10967-10967 SoLoader com.example.package V libhermes-executor-release.so not found on /data/data/com.example.package/lib-main 2022-12-21 12:45:55.119 10967-10967 SoLoader com.example.package V libhermes-executor-release.so not found on /data/app/com.example.package-1/lib/x86 2022-12-21 12:45:55.119 10967-10967 SoLoader com.example.package V libhermes-executor-release.so not found on /system/lib 2022-12-21 12:45:55.119 10967-10967 SoLoader com.example.package V libhermes-executor-release.so not found on /system/vendor/lib 2022-12-21 12:45:55.119 10967-10967 SoLoader com.example.package E couldn't find DSO to load: libhermes-executor-release.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.example.package/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.example.package-1/lib/x86 flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2] Native lib dir: /data/app/com.example.package-1/lib/x86 result: 0 2022-12-21 12:45:55.120 10967-10967 AndroidRuntime com.example.package D Shutting down VM 2022-12-21 12:45:55.206 10967-10970 art com.example.package I Do partial code cache collection, code=30KB, data=28KB 2022-12-21 12:45:55.207 10967-10970 art com.example.package I After code cache collection, code=26KB, data=26KB 2022-12-21 12:45:55.208 10967-10970 art com.example.package I Increasing code cache capacity to 128KB 2022-12-21 12:45:55.214 10967-10986 libcrashlytics com.example.package D Initializing libcrashlytics version 3.2.0 2022-12-21 12:45:55.215 10967-10986 libcrashlytics com.example.package D Initializing native crash handling successful. 2022-12-21 12:45:55.218 10967-10967 AndroidRuntime com.example.package E FATAL EXCEPTION: main Process: com.example.package, PID: 10967 java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes-executor-release.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.example.package/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/com.example.package-1/lib/x86 flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/vendor/lib flags = 2] Native lib dir: /data/app/com.example.package-1/lib/x86 result: 0 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127) at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943) at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772) at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:30) at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:19) at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:23) at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:393) at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:343) at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:96) at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42) at com.example.package.MainApplication.onCreate(MainApplication.java:86) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 2022-12-21 12:45:55.343 10967-11020 com.facebo...veProtocol com.example.package W Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared. Please follow https://developers.facebook.com/docs/android/troubleshooting/#faq_267321845055988 to make the declaration.

android/app/build.gradle

apply plugin: "com.android.application" apply plugin: "com.google.gms.google-services" apply plugin: "com.google.firebase.crashlytics"

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. If none specified and
  • // "index.android.js" exists, it will be used. Otherwise "index.js" is
  • // default. Can be overridden with ENTRY_FILE environment variable.
  • entryFile: "index.android.js",
  • // https://reactnative.dev/docs/performance#enable-the-ram-format
  • bundleCommand: "ram-bundle",
  • // 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 = [ enableHermes: true, // clean and rebuild if changing bundleInDevDebug: true, devDisabledInDevDebug: true, hermesFlagsForVariant: { def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('dev') ? ['-w'] : [] }, deleteDebugFilesForVariant: { def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('dev') }, ]

apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native-vector-icons/fonts.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 = true def shrinkResourcesInReleaseBuilds = true

/**

  • The preferred build flavor of JavaScriptCore.
  • For example, to use the international variant, you can use:
  • def jscFlavor = 'org.webkit:android-jsc-intl:+'
  • The international variant includes ICU i18n library and necessary data
  • allowing to use e.g. Date.toLocaleString and String.localeCompare that
  • give correct results when using with locales other than en-US. Note that
  • this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+'

/**

  • Whether to enable the Hermes VM.
  • This should be set on project.ext.react and that value will be read here. If it is not set
  • on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
  • and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false);

/**

  • Architectures to build native code for in debug. */ def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] }

def keyPropsFile = file("keystore.properties") def keyProps = new Properties() keyProps.load(new FileInputStream(keyPropsFile))

android { ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig { applicationId "com.example.package" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 3146328 versionName "3.14.1" multiDexEnabled true buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() missingDimensionStrategy 'react-native-camera', 'general' if (isNewArchitectureEnabled()) { // We configure the CMake build only if you decide to opt-in for the New Architecture. externalNativeBuild { cmake { arguments "-DPROJECT_BUILD_DIR=$buildDir", "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build", "-DNODE_MODULES_DIR=$rootDir/../node_modules", "-DANDROID_STL=c++_shared" } } if (!enableSeparateBuildPerCPUArchitecture) { ndk { abiFilters (*reactNativeArchitectures()) } } } }

if (isNewArchitectureEnabled()) { // We configure the NDK build only if you decide to opt-in for the New Architecture. externalNativeBuild { cmake { path "$projectDir/src/main/jni/CMakeLists.txt" } } def reactAndroidProjectDir = project(':ReactAndroid').projectDir def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") into("$buildDir/react-ndk/exported") } def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") into("$buildDir/react-ndk/exported") } afterEvaluate { // If you wish to add a custom TurboModule or component locally, // you should uncomment this line. // preBuild.dependsOn("generateCodegenArtifactsFromSchema") preDebugBuild.dependsOn(packageReactNdkDebugLibs) preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) // Due to a bug inside AGP, we have to explicitly set a dependency // between configureCMakeDebug* tasks and the preBuild tasks. // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild) configureCMakeDebug.dependsOn(preDebugBuild) reactNativeArchitectures().each { architecture -> tasks.findByName("configureCMakeDebug[${architecture}]")?.configure { dependsOn("preDebugBuild") } tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure { dependsOn("preReleaseBuild") } } } }

flavorDimensions "default" productFlavors { dev { def host = "http://"+getLocalIPv4()+":8088" // applicationIdSuffix ".dev" versionNameSuffix "-dev" resValue "string", "app_name", "OS DEV" buildConfigField "String", "BASE_URL", "\"$host\"" } prod { resValue "string", "app_name", "AppName" buildConfigField "String", "BASE_URL", '"https://com.example.package"' } uat { // applicationIdSuffix ".uat" versionNameSuffix "-uat" resValue "string", "app_name", "OS UAT" buildConfigField "String", "BASE_URL", '"example.url.com"' } }

splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include (*reactNativeArchitectures()) } } signingConfigs { OneScore { storeFile file(keyProps['storeFile']) storePassword keyProps['storePassword'] keyAlias keyProps['keyAlias'] keyPassword keyProps['keyPassword'] } } buildTypes { debug { signingConfig signingConfigs.OneScore } release { signingConfig signingConfigs.OneScore minifyEnabled enableProguardInReleaseBuilds shrinkResources shrinkResourcesInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" firebaseCrashlytics { nativeSymbolUploadEnabled true unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' } } }

// 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: // https://developer.android.com/studio/build/configure-apk-splits.html // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. 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 = defaultConfig.versionCode * 1000 + versionCodes.get(abi) }

   }

} }

static def getLocalIPv4() { def ip4s = [] NetworkInterface.getNetworkInterfaces() .findAll { it.isUp() && !it.isLoopback() && !it.isVirtual() } .each { it.getInetAddresses() .findAll { !it.isLoopbackAddress() && it instanceof Inet4Address } .each { ip4s << it } } return ip4s.first() }

repositories { maven { url 'https://artifacts.netcore.co.in/artifactory/android' } jcenter() }

dependencies { implementation fileTree(dir: "libs", include: ["*.jar"])

implementation "com.facebook.react:react-native:+" // From node_modules implementation 'androidx.work:work-runtime:2.7.1'

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation 'androidx.multidex:multidex:2.0.1'

implementation "androidx.security:security-crypto:1.1.0-alpha03"

implementation project(':react-native-fs')

implementation 'com.netcore.android:smartech-sdk:3.1.29'

implementation platform('com.google.firebase:firebase-bom:30.1.0') implementation 'com.google.firebase:firebase-analytics' implementation "com.google.firebase:firebase-crashlytics" implementation 'com.google.firebase:firebase-messaging:23.0.5' implementation "androidx.biometric:biometric:1.1.0"

implementation 'com.facebook.android:facebook-android-sdk:latest.release'

implementation 'com.facebook.fresco:animated-gif:2.6.0'

implementation 'com.jakewharton.timber:timber:4.7.1'

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' }

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' }

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' }

if (enableHermes) { //noinspection GradleDynamicVersion implementation("com.facebook.react:hermes-engine:+") { // From node_modules exclude group:'com.facebook.fbjni' } } else { implementation jscFlavor } }

if (isNewArchitectureEnabled()) { // If new architecture is enabled, we let you build RN from source // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. // This will be applied to all the imported transtitive dependency. configurations.all { resolutionStrategy.dependencySubstitution { substitute(module("com.facebook.react:react-native")) .using(project(":ReactAndroid")) .because("On New Architecture we're building React Native from source") substitute(module("com.facebook.react:hermes-engine")) .using(project(":ReactAndroid:hermes-engine")) .because("On New Architecture we're building Hermes from source") } } }

// 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.implementation into 'libs' }

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

def isNewArchitectureEnabled() { // To opt-in for the New Architecture, you can either: // - Set newArchEnabled to true inside the gradle.properties file // - Invoke gradle with -newArchEnabled=true // - Set an environment variable ORG_GRADLE_PROJECT_newArchEnabled=true return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" }

android/build.gradle

buildscript { ext { buildToolsVersion = "31.0.0" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 if (System.properties['os.arch'] == "aarch64") { // For M1 Users we need to use the NDK 24 which added support for aarch64 ndkVersion = "24.0.8215888" } else { // Otherwise we default to the side-by-side NDK version from AGP. ndkVersion = "21.4.7075529" } kotlin_version = '1.6.10' // <- kotlin version } repositories { google() mavenCentral() jcenter() } dependencies { classpath "com.android.tools.build:gradle:7.2.1" classpath "com.facebook.react:react-native-gradle-plugin" classpath "de.undercouch:gradle-download-task:5.0.1" classpath "com.google.gms:google-services:4.3.10" classpath "com.google.firebase:firebase-crashlytics-gradle:2.8.1" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } }

allprojects { repositories {

    // TODO: react-native update: Check this maven - after 
    // mavenCentral()
    // mavenLocal()
    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")
    }

    mavenCentral {
        // We don't want to fetch react-native from Maven Central as there are
        // older versions over there.
        content {
            excludeGroup "com.facebook.react"
        }
    }

    google()
    maven { url 'https://www.jitpack.io' }
     jcenter() {
        content {
            includeModule("com.yqritc", "android-scalablevideoview")
        }
    }
}

}

Version

0.70.6

Output of npx react-native info

System: OS: macOS 12.6.2 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 26.61 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.9.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.2 - /usr/local/bin/npm Watchman: 2022.10.03.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9014738 Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Have upgraded from 0.66.4 to 0.70.6

Snack, code example, screenshot, or link to a repository

N.A.

tonydatw commented 1 year ago

this is happening to me as well and i can't wrap my head around trying to fix it. My project is production ready but release crashes on launch. It's been many days already trying to find a workaround without success.

AamirHafiez commented 1 year ago

Managed to solve this issue -

What worked for me is

Remove these from app/build.gradle:

 bundleInDevDebug: true,
    devDisabledInDevDebug: true,
    hermesFlagsForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('dev') ? ['-w'] : []
    },
    deleteDebugFilesForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('dev')
    },

but kept only:

project.ext.react = [
   enableHermes: true,  // clean and rebuild if changing
]

Was missing this import on top of app/build.gradle: import org.apache.tools.ant.taskdefs.condition.Os

Upgraded react from 0.70.2 to 0.70.6 according to the below issue: https://github.com/facebook/react-native/issues/35210#issue-1436785719

Also Removed these lines from build.gradle: def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

And atlast cd android && ./gradlew clean invalidate cache re-build

CHANDRAMOHANnegi commented 1 year ago

https://medium.com/@devesu/react-native-android-release-build-crash-on-device-14f2c9eacf18

this solved issue for me, there was an issue with assets in drawable😊

yberstad commented 1 year ago

@AamirHafiez, thanks for your info! Worked for 0.69.x also. Updated from 0.69.3 to 0.69.10, and the app crash on Android 14 went away.