I updated RN version 0.64 to 0.67, after adding that app getting crash immediately after launch without any error, please help me to fix issue
i ran adb logcat –buffer=crash
08-02 00:48:57.646 8869 8869 E AndroidRuntime: FATAL EXCEPTION: main 08-02 00:48:57.646 8869 8869 E AndroidRuntime: Process: com.tapp, PID: 8869
08-02 00:48:57.646 8869 8869 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed
resolution of: Landroidx/core/view/OnReceiveContentViewBehavior;
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at
androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1530)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1614)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:999)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:963)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:661)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:2173)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2671)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.originalInstallDecor(PhoneWindow.java:2753)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2735)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2120)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.ActivityTransitionState.setEnterActivityOptions(ActivityTransitionState.java:171)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8123)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8083)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3493)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3692)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2142)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.os.Looper.loop(Looper.java:236)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7864)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn’t find class "androidx.core.view.OnReceiveContentViewBehavior" on path: DexPathList[[zip file "/data/app/~~TvRq8yhbRZPMs3xyzJ7jGA==/com.tapp-xotKQaDfq4sZ-tA54NPe6w==/base.apk"],nativeLibraryDirectories=[/data/app/~~TvRq8yhbRZPMs3xyzJ7jGA==/com.tapp-xotKQaDfq4sZ-tA54NPe6w==/lib/arm64, /data/app/~~TvRq8yhbRZPMs3xyzJ7jGA==/com.tapp-xotKQaDfq4sZ-tA54NPe6w==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]] 08-02 00:48:57.646 8869 8869 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
08-02 00:48:57.646 8869 8869 E AndroidRuntime: … 29 more
app/build.gradle
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
import com.android.build.OutputFile
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
def nativeArchitectures =
project.getProperties().get("reactNativeDebugArchitectures")
plugins {
id 'com.android.application'
}
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
// compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_8
// targetCompatibility JavaVersion.VERSION_1_8
// }
defaultConfig {
configurations.all {
resolutionStrategy { force 'androidx.core:core:1.3.1' }
resolutionStrategy { force 'androidx.core:core-ktx:1.6.0'
}
}
applicationId "com.tapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "19.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 {
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
}
}
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
if (nativeArchitectures) {
ndk {
abiFilters nativeArchitectures.split(',')
}
}
}
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
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)
}
}
}
}
dependencies {
implementation 'com.facebook.fresco:animated-base-support:1.3.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-
core:1.3.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation project(path: ':library')
implementation platform('com.google.firebase:firebase-bom:29.0.4')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.facebook.fresco:animated-gif:2.0.0'
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) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
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)
apply from: "../../node_modules/react-native-vector-
icons/fonts.gradle"
3
Answers
Hi i was able to fix my crash issue by adding these line to build.gradle file
app/build.gradle
thanks
Best advice I can give is go through this migration helper link and make sure all files have been adjusted accordingly.
https://react-native-community.github.io/upgrade-helper/?from=0.64.0&to=0.67.0
I think problem is in andoidx.appcompat class not found
In app build.gradle, I changed this line of dependencies:
or chack the version of
I have below code in my build.gradle (Project)
but I am using react native 0.68.2 at the moment.