有。
我正在开发使用crna创建并分离为expo-kit的react-native应用程序,该应用程序在模拟器和设备上的调试模式下按预期运行,但是在发布模式下运行时,它在启动时崩溃,并显示以下logcat:< / p>
08-13 09:34:14.448 4119-4119/com.trixel.cobru E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.trixel.cobru, PID: 4119
java.lang.RuntimeException: Unable to create application host.exp.exponent.MainApplication: java.lang.RuntimeException: NativeModuleDepsProvider could not find object for class class android.app.Application
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5364)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.RuntimeException: NativeModuleDepsProvider could not find object for class class android.app.Application
at host.exp.exponent.b.a.b(NativeModuleDepsProvider.java:1092)
at host.exp.exponent.e.q.<init>(Kernel.java:146)
at host.exp.exponent.l.a(ExpoApplication.java:67)
at host.exp.exponent.e.an.a(KernelProvider.java:26)
at host.exp.exponent.k.onCreate(ExpoApplication.java:79)
at host.exp.exponent.MainApplication.onCreate(MainApplication.java:30)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
我相信这里的重要部分是 NativeModuleDepsProvider找不到类类android.app.Application 的对象,但在Google中搜索和stackoverflow都没有提供答案。我找到了这个link,似乎是在第5行产生错误的文件。
我不明白为什么该应用程序可以在调试而不是发行版上工作,我缺少什么?
这是我的gradle文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://plugins.gradle.org/m2/' }
google()
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
// apply plugin: 'com.neenbedankt.android-apt'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com/' }
google()
jcenter()
}
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.trixel.cobru'
targetSdkVersion 25
versionCode 1
versionName '0.1.0'
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
// Deprecated. Used by net.openid:appauth
manifestPlaceholders = [
'appAuthRedirectScheme': 'host.exp.exponent',
'onesignal_app_id': 'd152183c-09c1-4c08-976b-5929f4f894e9',
'onesignal_google_project_number': '73022214728'
]
}
signingConfigs {
release {
if (project.hasProperty('COBRU_RELEASE_STORE_FILE')) {
storeFile file(COBRU_RELEASE_STORE_FILE)
storePassword COBRU_RELEASE_STORE_PASSWORD
keyAlias COBRU_RELEASE_KEY_ALIAS
keyPassword COBRU_RELEASE_KEY_PASSWORD
}
}
}
dexOptions {
javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
}
flavorDimensions "sdk"
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
dimension "sdk"
}
devRemoteKernel {
minSdkVersion 21
dimension "sdk"
}
/*dev19 {
// For debugging / development on older SDK versions. Increases build
// time so use 'dev' if not running on older SDKs.
minSdkVersion 19
dimension "sdk"
}*/
prod {
// The actual minSdkVersion for the application.
minSdkVersion 21
dimension "sdk"
}
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
signingConfig signingConfigs.release
}
}
signingConfigs {
debug {
storeFile file('../debug.keystore')
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
/*packagingOptions {
pickFirst "**"
}*/
}
// Don't use modern jsc-android since it still has some critical bugs that
// crash applications when the string for the JS bundle is loaded and when
// locale-specific date functions are called.
// configurations.all {
// resolutionStrategy {
// force 'org.webkit:android-jsc:r216113'
// }
// }
task exponentPrebuildStep(type: Exec) {
workingDir '../'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', '.\\detach-scripts\\prepare-detached-
build.bat'
} else {
commandLine './detach-scripts/prepare-detached-build.sh'
}
}
preBuild.dependsOn exponentPrebuildStep
dependencies {
compile project(':react-native-onesignal')
compile project(':react-native-fbsdk')
implementation project(':react-native-onesignal')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.1'
// Our dependencies
implementation 'com.android.support:appcompat-v7:26.0.1'
// Our dependencies from ExpoView
// DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.facebook.android:facebook-android-sdk:4.7.0'
implementation('com.facebook.android:audience-network-sdk:4.22.1') {
exclude module: 'play-services-ads'
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.amplitude:android-sdk:2.9.2' // Be careful when upgrading! Upgrading might break experience scoping. Check with Jesse. See Analytics.resetAmplitudeDatabaseHelper
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-gcm:9.8.0'
implementation 'com.google.android.gms:play-services-analytics:9.8.0'
implementation 'com.google.android.gms:play-services-maps:9.8.0'
implementation 'com.google.android.gms:play-services-auth:9.8.0'
implementation 'com.google.android.gms:play-services-location:9.8.0'
implementation 'com.google.android.gms:play-services-ads:9.8.0'
annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
implementation "com.raizlabs.android:DBFlow:2.2.1"
implementation "com.madgag.spongycastle:core:1.53.0.0"
implementation "com.madgag.spongycastle:prov:1.53.0.0"
debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
implementation 'com.facebook.device.yearclass:yearclass:1.0.1'
implementation 'commons-io:commons-io:1.3.2'
implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
implementation 'com.yqritc:android-scalablevideoview:1.0.1'
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.segment.analytics.android:analytics:4.3.0'
implementation 'com.google.zxing:core:3.2.1'
implementation 'net.openid:appauth:0.4.1'
implementation 'com.airbnb.android:lottie:2.2.0'
implementation 'io.branch.sdk.android:library:2.6.1'
implementation('io.nlopez.smartlocation:library:3.2.11') {
transitive = false
}
implementation 'com.android.support:exifinterface:26.0.1'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
implementation 'com.squareup.okhttp3:okhttp-ws:3.4.1'
implementation 'com.squareup.okio:okio:1.9.0'
// Testing
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:support-annotations:26.0.1'
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
annotationProcessor 'com.jakewharton:butterknife:7.0.1'
implementation('host.exp.exponent:expoview:26.0.0@aar') {
transitive = true
}
}
// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
enter code here
这些是我正在使用的事物的版本:
react-native-cli:2.0.1 反应本机:0.54.2 博览会:55.0.4
我还使用了一个信号sdk和facebook sdk(除了所有预装的expo软件包之外),但这似乎在ios上运行良好,因此我很确定这是Android特定的东西。
非常感谢您的帮助。