Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Expo弹出的应用程序崩溃,出现java.net.ConnectException_Java_Android_Android Studio_React Native Android - Fatal编程技术网

Expo弹出的应用程序崩溃,出现java.net.ConnectException

Expo弹出的应用程序崩溃,出现java.net.ConnectException,java,android,android-studio,react-native-android,Java,Android,Android Studio,React Native Android,我用Expo开发我的react原生应用程序 由于Expo不支持某些软件包,我决定从Expo中弹出我的应用程序 我目前正在android studio上工作,但遇到了这个错误 java.lang.RuntimeException: Expo encountered a fatal error: java.net.ConnectException: Failed to connect to /192.168.0.6:19000 at host.exp.exponent.exp

我用Expo开发我的react原生应用程序

由于Expo不支持某些软件包,我决定从Expo中弹出我的应用程序

我目前正在android studio上工作,但遇到了这个错误

    java.lang.RuntimeException: Expo encountered a fatal error: java.net.ConnectException: Failed to connect to /192.168.0.6:19000
        at host.exp.exponent.experience.BaseExperienceActivity$2.run(BaseExperienceActivity.java:206)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6944)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
如果我导航到
BaseExperienceActivity.java:206

...

// we don't ever want to show any Expo UI in a production standalone app
// so hard crash in this case
if (Constants.isStandaloneApp() && !isDebugModeEnabled()) {
 throw new RuntimeException("Expo encountered a fatal error: " + errorMessage.developerErrorMessage());
}

...
我没有使用
Expo start
react native run:android
来运行应用程序

我正在Android Studio中运行该应用程序

*(编辑)

下面是我当前的build.gradle
/android/app

buildscript {
  repositories {
    google()
    maven { url 'https://maven.fabric.io/public' }
  }

  dependencies {
    classpath 'io.fabric.tools:gradle:1.31.0'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'devicefarm'

repositories {
  maven { url 'https://maven.fabric.io/public' }
}

def safeExtGet(prop, fallback) {
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
  compileSdkVersion safeExtGet("compileSdkVersion", 28)

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  defaultConfig {
    applicationId '######'
    minSdkVersion safeExtGet("minSdkVersion", 21)
    targetSdkVersion safeExtGet("targetSdkVersion", 28)
    versionCode 6
    versionName '1.8.0'

    multiDexEnabled true
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    // Deprecated. Used by net.openid:appauth
    manifestPlaceholders = [
        'appAuthRedirectScheme': 'host.exp.exponent'
    ]
  }
  dexOptions {
    javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
  }

  signingConfigs {
    debug {
      storeFile file('../debug.keystore')
    }
    release {
      storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
      storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
      keyAlias System.getenv("ANDROID_KEY_ALIAS")
      keyPassword System.getenv("ANDROID_KEY_PASSWORD")
    }
  }
  buildTypes {
    debug {
      debuggable false
      // debuggable true (Original)
//      ext.enableCrashlytics = false
    }
    release {
      minifyEnabled true
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      consumerProguardFiles 'proguard-rules.pro'
      signingConfig signingConfigs.release
    }
  }
  lintOptions {
    abortOnError false
  }
  packagingOptions {
    pickFirst "**"
  }
}

devicefarm {
  projectName System.getenv("DEVICEFARM_PROJECT_NAME")
  devicePool System.getenv("DEVICEFARM_DEVICE_POOL")
  executionTimeoutMinutes 40
  authentication {

    accessKey System.getenv("AWS_ACCESS_KEY_ID")
    secretKey System.getenv("AWS_SECRET_ACCESS_KEY")
  }
}

configurations.all {
  resolutionStrategy {
    force 'org.webkit:android-jsc:r245459'
  }
}

// WHEN_PREPARING_SHELL_REMOVE_FROM_HERE

apply from: 'expo.gradle'

// WHEN_PREPARING_SHELL_REMOVE_TO_HERE

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

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])

  implementation 'androidx.multidex:multidex:2.0.0'

  // Our dependencies
  implementation 'androidx.appcompat:appcompat:1.1.0'

  // (Recommended) Add the Google Analytics dependency.
  implementation 'com.google.firebase:firebase-analytics:17.2.1'

  // Add the Firebase Crashlytics dependency.
  implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

  // Our dependencies from ExpoView
  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
  implementation 'androidx.appcompat:appcompat:1.1.0'
  implementation 'com.facebook.android:facebook-android-sdk:5.0.1'
  implementation('com.facebook.android:audience-network-sdk:5.1.1') {
    exclude module: 'play-services-ads'
  }
  compileOnly 'org.glassfish:javax.annotation:3.1.1'
  implementation 'com.jakewharton:butterknife:10.2.0'
  implementation 'de.greenrobot:eventbus:2.4.0'

  implementation 'com.squareup.picasso:picasso:2.5.2'
  implementation 'com.google.android.gms:play-services-gcm:15.0.1'
  implementation 'com.google.android.gms:play-services-analytics:16.0.1'
  implementation 'com.google.android.gms:play-services-maps:15.0.1'
  implementation 'com.google.android.gms:play-services-auth:15.0.1'
  implementation 'com.google.android.gms:play-services-location:15.0.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'
  // debugImplementation '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:2.1.0'
  implementation 'commons-io:commons-io:1.4'
  implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
  implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
  implementation 'commons-codec:commons-codec:1.10'
  implementation 'com.segment.analytics.android:analytics:4.3.0'
  implementation 'com.google.zxing:core:3.3.3'
  implementation 'net.openid:appauth:0.4.1'
  implementation 'com.airbnb.android:lottie:2.5.6'
  implementation('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  implementation "androidx.exifinterface:exifinterface:1.0.0"
  implementation 'com.squareup.okio:okio:1.9.0'
  implementation 'com.facebook.soloader:soloader:0.6.0'

  // expo-file-system
  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'

  // Testing
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
  // We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
  androidTestImplementation 'androidx.test:runner:1.1.0'
  androidTestImplementation "androidx.annotation:annotation:1.0.0"
  androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
  androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
  androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'

  androidTestImplementation 'junit:junit:4.12'
  androidTestImplementation 'org.mockito:mockito-core:1.10.19'
  testImplementation 'org.robolectric:robolectric:3.8'
  androidTestImplementation 'androidx.test:runner:1.1.0'
  androidTestImplementation 'androidx.test:rules:1.2.0'

  testImplementation 'androidx.test:runner:1.1.0'
  testImplementation 'androidx.test:rules:1.2.0'
  testImplementation 'junit:junit:4.12'
  testImplementation 'org.mockito:mockito-core:1.10.19'


  implementation('host.exp.exponent:expoview:36.0.0@aar') {
    transitive = true
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
  }




  api 'org.webkit:android-jsc:r245459' // needs to be before react-native
  api 'com.facebook.react:react-native:33.0.0'




  addUnimodulesDependencies([
      modulesPaths : [
        '../../node_modules'
      ],
      configuration: 'api',
      target       : 'react-native',
      exclude      : [
        // You can exclude unneeded modules here, eg.
        // 'unimodules-face-detector-interface',
        // 'expo-face-detector'

        // Adding a name here will also remove the package
        // from auto-generated BasePackageList.java
      ]
  ])

}

// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'


我也有这个问题。我发现这是在属性
可调试
为true时发生的。请检查
/android/app/
中的
build.gradle
文件。确保您选择的是发布版本而不是调试,并且发布块中的属性
debugable
不存在或值为false。希望这能对您有所帮助。

好的,我将
可调试设置为false。你能详细说明一下发行版本吗?我是Gradle和Android的新手。我在帖子中附上了我的
build.Gradle
。对不起,我不知道。我比较了你的gradle档案和我的。没有区别。似乎例外的原因是不同的:(谢谢你的帮助!我将标记你的答案为接受,因为它可能会在将来帮助其他人。