0
  1. 在 react -native 中打开 Android Release apk 已停止

    *****E/AndroidRuntime: FATAL EXCEPTION: Thread-3
        Process: com.reactapp, PID: 4023
        java.lang.ExceptionInInitializerError
            at com.facebook.react.bridge.p.a(Unknown Source)
            at com.facebook.react.k$5.run(Unknown Source)
            at java.lang.Thread.run(Thread.java:761)
         ****Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.bridge.ProxyJavaScriptExecutor" on path: DexPathList[[zip file "/data/app/com.reactapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.reactapp-2/lib/arm, /data/app/com.reactapp-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/vendor/lib]]****
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            at java.lang.Runtime.nativeLoad(Native Method)
            at java.lang.Runtime.doLoad(Runtime.java:1060)
            at java.lang.Runtime.load0(Runtime.java:895)
            at java.lang.System.load(System.java:1505)
            at com.facebook.l.b.a(Unknown Source)
            at com.facebook.l.b.a(Unknown Source)
            at com.facebook.l.g.a(Unknown Source)
            at com.facebook.l.g.a(Unknown Source)
            at com.facebook.react.bridge.ao.a(Unknown Source)
            at com.facebook.react.bridge.NativeMap.<clinit>(Unknown Source)
            at com.facebook.react.bridge.p.a(Unknown Source) 
            at com.facebook.react.k$5.run(Unknown Source) 
            at java.lang.Thread.run(Thread.java:761)***** 
    
    1. 我应该怎么做任何人都可以帮助我

我在这个项目中使用 react-native-fcm 和 react-native-device-info

#

  • 列表项 Build.gradle gere

    #

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

    defaultConfig {
        applicationId "com.reactapp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    
        packagingOptions {
            exclude "lib/arm64-v8a/librealm-jni.so"
            exclude 'META-INF/services/javax.annotation.processing.Processor'
        }
    
    
    }
    
    signingConfigs {
        release {
            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 true  // If true, also generate a universal APK
    
        }
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['src/main/jniLibs']
        }
    }
    /* packagingOptions {
         exclude '/lib/mips64/**'
         exclude '/lib/arm64-v8a/**'
         exclude '/lib/x86_64/**'
     }*/
    
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    
    }
    
    // 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
            }
        }
    }
    

    }

    dependencies { implementation project(':react-native-fcm') implementation fileTree(dir: "libs", include: ["*.jar"]) // implementation "com.android.support:appcompat-v7:${rootProject .ext.supportLibVersion}" implementation "com.android.support:appcompat-v7:27.1.1" implementation "com.facebook.react:react-native:+" // 来自 node_modules implementation project(':react-native-device -信息')

    /*implementation 'com.android.support:multidex:1.0.0'*/
    implementation 'com.google.code.gson:gson:2.8.5'
    

    }

    // 运行一次,以便能够使用 BUCK 运行应用程序 // 将所有编译依赖项放入文件夹 libs 中,以便 BUCK 使用任务 copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply plugin: "com. google.gms.google 服务”

4

0 回答 0