eQu*_*nox 5 android google-play-services react-native react-native-android
当我使用依赖项构建(> react-native run-android)时,构建成功!但是,当应用程序启动时,它立即崩溃...怎么不知道怎么可能,没有错误,没什么可告诉我为什么应用程序崩溃了...
确保它来自依赖项...
dependencies {
implementation project(':react-native-intercom')
implementation "io.intercom.android:intercom-sdk:3.+"
implementation project(':react-native-onesignal')
implementation 'com.google.android.gms:play-services-location:+'
implementation project(':react-native-linear-gradient')
implementation project(':react-native-i18n')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+"
implementation project(':tipsi-stripe')
implementation (project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
exclude group: "com.android.support", module: 'support-v4'
}
implementation "com.android.support:appcompat-v7:23.0.1"
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.google.android.gms:play-services-maps:10.0.1'
implementation 'com.google.android.gms:play-services-gcm:10.0.1'
}
Run Code Online (Sandbox Code Playgroud)
非常感谢
我现在有完全相同的错误,react 0.59.8(甚至60+)。也许我可以解释一下这一点,因为它真的让我很恼火,因为我无法开发我的应用程序,而是专注于修复与框架相关的错误......所以作为解释:该项目已成功构建。当 cd 到 android 子文件夹并执行时
./gradlew assembleDebug --stacktrace (or similar)
Run Code Online (Sandbox Code Playgroud)
它说构建成功。如果我运行react-native run-android它,它也会成功构建并尝试将文件上传到设备。然后崩溃,没有任何错误。我只是回到了我执行的 shell 中react-native run-android。
npm start有时,在设备上执行并重新加载后,它会被修复,导致 javascript 被构建/转换(或那里发生的任何事情。我不知道。)
有人有同样的问题吗?
有人知道为什么会发生并可以解释吗?
更新:adblogcat *:E 在尝试连接到运行的 Metro 捆绑器时抛出此错误npm start(当它无法运行 npm start 时)
unknown:ReactNative: ... 21 more
09-17 10:34:38.851 29275 29275 E unknown:ReactNative: Caused by: android.system.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
我的 package.json:
./gradlew assembleDebug --stacktrace (or similar)
Run Code Online (Sandbox Code Playgroud)
我的 MainApplication.java
{
...
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"lodash": "^4.17.11",
"moment": "^2.24.0",
"react": "16.8.3",
"react-native": "0.59.8",
"react-native-firebase": "^5.3.1",
"react-native-gesture-handler": "^1.2.1",
"react-native-image-picker": "^0.28.1",
"react-native-table-component": "^1.2.0",
"react-native-vector-icons": "^6.4.2",
"react-navigation": "^3.11.0",
"uuid": "^3.3.2"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/runtime": "^7.4.4",
"babel-jest": "^24.8.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.54.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}Run Code Online (Sandbox Code Playgroud)
android/build.gradle
...
import android.app.Application;
import com.facebook.react.ReactApplication;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.imagepicker.ImagePickerPackage;
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 RNFirebasePackage(), new RNFirebaseAuthPackage(),
new RNGestureHandlerPackage(), new ImagePickerPackage(), new RNFirebaseStoragePackage(),
new RNFirebaseDatabasePackage());
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}Run Code Online (Sandbox Code Playgroud)
android/app/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}Run Code Online (Sandbox Code Playgroud)
gradle.properties 包含:
android.useAndroidX=true
android.enableJetifier=true
| 归档时间: |
|
| 查看次数: |
631 次 |
| 最近记录: |