wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.01k stars 2.68k forks source link

[V7] RuntimeException on android #6797

Closed WASHSWATDAVID closed 3 years ago

WASHSWATDAVID commented 3 years ago

🐛 Bug Report

I got the RuntimeException on the android version.

React-native Info

System:
    OS: macOS 10.15.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 147.66 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.0.0 - ~/.nvm/versions/node/v12.0.0/bin/node
    Yarn: 1.12.1 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.0.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.1 AI-173.4907809
    Xcode: 12.2/12B45b - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_181 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

RNN Version

"react-native-navigation": "^7.4.0",
"react": "17.0.1",
"react-native": "0.63.3",

Logs

2020-11-28 17:01:21.438 7695-7695/com.myapp.android E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.myapp.android, PID: 7695
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.android/com.myapp.android.MainActivity}: android.view.InflateException: Binary XML file line #17 in com.myapp.android:layout/abc_screen_simple: Binary XML file line #17 in com.myapp.android:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3556)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3703)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7948)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
     Caused by: android.view.InflateException: Binary XML file line #17 in com.myapp.android:layout/abc_screen_simple: Binary XML file line #17 in com.myapp.android:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
     Caused by: android.view.InflateException: Binary XML file line #17 in com.myapp.android:layout/abc_screen_simple: Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Field.get(java.lang.Object)' on a null object reference
        at uk.co.chrisjenx.calligraphy.ReflectionUtils.getValue(ReflectionUtils.java:29)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(CalligraphyLayoutInflater.java:203)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(CalligraphyLayoutInflater.java:20)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(CalligraphyLayoutInflater.java:302)
        at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:239)
        at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:659)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:481)
        at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:773)
        at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:659)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:543)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:166)
        at com.reactnativenavigation.NavigationActivity.addDefaultSplashLayout(NavigationActivity.java:148)
        at com.reactnativenavigation.NavigationActivity.onCreate(NavigationActivity.java:40)
        at com.myapp.android.MainActivity.onCreate(MainActivity.java:22)
        at android.app.Activity.performCreate(Activity.java:7955)
        at android.app.Activity.performCreate(Activity.java:7944)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3531)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3703)
2020-11-28 17:01:21.439 7695-7695/com.myapp.android E/AndroidRuntime:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7948)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

build/gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

ext {
    supportLibVersion = "28.0.0"

    buildToolsVersion = "29.0.3"
    minSdkVersion = 21
    compileSdkVersion = 29
    targetSdkVersion = 29
    ndkVersion = "20.1.5948944"

    googlePlayServicesVersion = "11.0.4"
    androidMapsUtilsVersion = "0.5+"
    kotlinVersion="1.3.72"
    RNNKotlinVersion="1.3.72"

    // App dependencies
    androidXTestVersion = '1.1.1'
    constraintLayoutVersion = '1.1.3'
    espressoVersion = '3.1.0-alpha4'
    junitVersion = '4.12'
    hamcrestVersion = '1.3'
    runnerExtVersion = '1.1.0'
    rulesVersion = '1.0.1'
    appCompatVersion = '1.0.2'
    supportLibraryVersion = '1.0.2'
    archLifecycleVersion = '2.1.0-alpha03'

}
buildscript {
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()

    }
    dependencies {
        classpath('com.android.tools.build:gradle')
        classpath 'com.google.gms:google-services:4.3.3'
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
        classpath 'com.android.tools.build:gradle:4.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support' && requested.name != 'multidex') {
            details.useVersion "${rootProject.ext.supportLibVersion}"
        }
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
        mavenCentral()
        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://jitpack.io' }
        maven {
            url 'https://maven.google.com'
        }
    }
}

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion

                variantFilter { variant ->
                    def names = variant.flavors*.name
                    if (
                    names.contains("reactNative51") ||
                            names.contains("reactNative55") ||
                            names.contains("reactNative56") ||
                            names.contains("reactNative57") ||
                            names.contains("reactNative57_5") ||
                            names.contains("reactNative60") ||
                            names.contains("reactNative62")
                    ) {
                        setIgnore(true)
                    }
                }
            }
        }
    }
}

subprojects {
    repositories {
        mavenCentral()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
    project.configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support' && requested.name != 'multidex') {
                details.useVersion "${rootProject.ext.supportLibVersion}"
            }
        }
    }
    afterEvaluate {
        android {
            compileSdkVersion rootProject.ext.compileSdkVersion
            defaultConfig {
                targetSdkVersion rootProject.ext.targetSdkVersion
            }
        }
    }
}

build/app/gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' // <- Add this line

import com.android.build.OutputFile

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

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,  // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

//def enableSeparateBuildPerCPUArchitecture = false
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = true

def jscFlavor = 'org.webkit:android-jsc:+'

def enableHermes = project.ext.react.get("enableHermes", false);

android {
    ndkVersion rootProject.ext.ndkVersion
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "com.myapp.android"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 179
        versionName "5.6.0"
        multiDexEnabled true
        missingDimensionStrategy "RNN.reactNativeVersion", "reactNative63"

    }
    lintOptions {
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding {
        enabled = true
    }
    dexOptions {
        preDexLibraries false
        javaMaxHeapSize "8g"
    }

    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
//            universalApk false  // If true, also generate a universal APK
            universalApk true

            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        release {

        }
    }
    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, "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)
            }
        }
    }
}

//configurations.all {
//    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
//        if (details.getRequested().getGroup() == 'com.google.android.gms') {
//            details.useVersion('9.8.0')
//        }
//    }enableSeparateBuildPerCPUArchitecture
//}

dependencies {
    implementation project(':@react-native-community_blur')
    implementation project(':react-native-send-intent')
    implementation project(':@react-native-community_viewpager')
    implementation project(':react-native-appsflyer')
    implementation project(':react-native-dark-mode')
    implementation project(':react-native-image-crop-picker')
    implementation project(':@react-native-community_async-storage')
    implementation project(':react-native-webview')
    implementation 'com.zoyi.channel:plugin-android-fcm:8.0.0'
    implementation project(':react-native-channel-plugin')
    implementation 'com.google.android.exoplayer:exoplayer:2.7.3'

    // segment
    // airbridge
    implementation 'io.airbridge:sdk-android:1.5.+'
    implementation 'com.android.installreferrer:installreferrer:1.0'
    implementation project(':bugsnag-react-native')
    implementation project(':react-native-mixpanel')
    implementation project(':react-native-bottomsheet')
    implementation project(':react-native-device-info')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-maps')
    implementation project(':react-native-code-push')
    implementation project(':react-native-video')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-view-shot')
    implementation project(':lottie-react-native')
    implementation project(':react-native-sha256')
    implementation project(':react-native-community-netinfo')
    implementation project(path: ":@react-native-firebase_app")
    implementation project(path: ":@react-native-firebase_messaging")

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

    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "androidx.annotation:annotation:${rootProject.ext.appCompatVersion}"
    implementation "androidx.appcompat:appcompat:${rootProject.ext.appCompatVersion}"
    implementation "androidx.constraintlayout:constraintlayout:${rootProject.ext.constraintLayoutVersion}"

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${rootProject.ext.kotlinVersion}"

    testImplementation "junit:junit:$junitVersion"
    testImplementation "org.hamcrest:hamcrest-all:$hamcrestVersion"

//    implementation 'com.android.support:appcompat-v7:21.0.+'

    implementation 'com.android.support:design:25.4.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-navigation')
    implementation project(":react-native-android-keyboard-adjust")
    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-places:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'

    compile('com.google.android.gms:play-services-gcm:15.0.1') {
        force = true
    }

    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.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) {
        // For RN 0.60.x
        def hermesPath = "../../node_modules/hermesvm/android/"
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// 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'
}
apply plugin: 'com.google.gms.google-services'

Have you read the Contributing Guidelines on issues?

Sure

(Write your answer here.)

To Reproduce

(Write your steps here:)

  1. Step 1...
  2. Step 2...
  3. Step 3...

Expected behavior

(Write what you thought would happen.)

Actual Behavior

(Write what happened. Add screenshots, if applicable.)

Your Environment

Reproducible Demo

(Paste the link to an example repo and exact instructions to reproduce the issue.)

jinshin1013 commented 3 years ago

Hi @WASHSWATDAVID, please follow the issue template.

alejandrorangel commented 2 years ago

@WASHSWATDAVID did you were able to fix this problem?