我构建了React Native Released Version并将其发布到Google Play商店 . 但它不起作用 .

不要从SplashScreen移动到下一个HomeScreen . 因此,我使用My Android Emulator进行测试,并突然在终端上运行Meteor JS Bundle,并且像Debug版本一样工作 .

熟悉这个bug https://github.com/facebook/react-native/issues/16793

但是这个链接的解决方案对我不起作用 . 解决方案是删除“ import com.facebook.react.BuildConfig; ”行,但我没有 .

这是MainApplication的代码

package org.sharingappforstudent;

import android.app.Application;

import com.crashlytics.android.Crashlytics;
import com.facebook.react.ReactApplication;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import org.wonday.pdf.RCTPdfView;
import com.RNFetchBlob.RNFetchBlobPackage;
import cl.json.RNSharePackage;
import com.reactlibrary.RNMailCorePackage;
import com.magus.fblogin.FacebookLoginPackage;

import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.imagepicker.ImagePickerPackage;
import io.fabric.sdk.android.Fabric;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.AlexanderZaytsev.RNI18n.RNI18nPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new SplashScreenReactPackage(),
        new RCTPdfView(),
        new RNFetchBlobPackage(),
        new RNSharePackage(),
        new RNMailCorePackage(),
        new FacebookLoginPackage(),
        new PickerPackage(),
        new VectorIconsPackage(),
        new ImagePickerPackage(),
        new RNFirebasePackage(),
        new RNI18nPackage(),
        new RNFirebaseStoragePackage(),
        new RNFirebaseAuthPackage(),
        new RNFirebaseDatabasePackage(),
        new RNFirebaseMessagingPackage(),
        new MapsPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());
    SoLoader.init(this, /* native exopackage */ false);
  }
}

app / build.gradle文件

apply plugin: "com.android.application"
apply plugin: 'io.fabric'


import com.android.build.OutputFile

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

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 {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "org.sharingappforstudent"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 11
        versionName "1.3"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        multiDexEnabled true
    }

    // (!!!ATTENTION!!!) FIX FOR MAIL CORE DEPENDENCIES (!!!DO NOT REMOVE!!!)
    packagingOptions {
        pickFirst 'lib/armeabi-v7a/libgnustl_shared.so'
        pickFirst 'lib/arm64-v8a/libgnustl_shared.so'
        pickFirst 'lib/x86_64/libgnustl_shared.so'
        pickFirst 'lib/x86/libgnustl_shared.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"
        }
    }
    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
            }
        }
    }
    dexOptions {
        jumboMode true
    }
}

dependencies {
    compile project(':react-native-splash-screen')
    compile project(':react-native-pdf')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-share')
    compile(project(':react-native-mailcore'))
    compile project(':react-native-facebook-login')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-vector-icons')
    compile project(':react-native-image-picker')
    compile (project(':react-native-maps')) {
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

    compile project(':react-native-i18n')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+" // From node_modules
    compile "com.google.firebase:firebase-messaging:12.0.0"

    compile project(':react-native-facebook-login')

    compile(project(':react-native-firebase')) {
        transitive = false
    }
    // Firebase dependencies
    compile "com.google.android.gms:play-services-base:12.0.0"
    compile 'com.google.android.gms:play-services-maps:12.0.0'
    compile "com.google.firebase:firebase-core:12.0.0"
    compile "com.google.firebase:firebase-storage:12.0.0"
    compile "com.google.firebase:firebase-auth:12.0.0"
    compile "com.google.firebase:firebase-database:12.0.0"
    compile "me.leolin:ShortcutBadger:1.1.21@aar"
    compile('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
        transitive = true
    }
}

// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

需要帮忙 . 谢谢 .