Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.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
Javascript 程序包未在xxx:yy运行_Javascript_Android_Reactjs_React Native_Firebase Cloud Messaging - Fatal编程技术网

Javascript 程序包未在xxx:yy运行

Javascript 程序包未在xxx:yy运行,javascript,android,reactjs,react-native,firebase-cloud-messaging,Javascript,Android,Reactjs,React Native,Firebase Cloud Messaging,我正在使用react native构建一个分离的android应用程序在安装react native fcm后,我总是收到以下错误消息: 我的gradle项目如下所示: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() google()

我正在使用react native构建一个分离的android应用程序在安装react native fcm后,我总是收到以下错误消息:

我的gradle项目如下所示:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
  repositories {
    jcenter()
    google()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.1.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    mavenLocal()
    jcenter()
    maven {
      // Point to local maven repository
      url "$rootDir/../.expo-source/android/maven"
    }
    maven { url "https://jitpack.io" }
    maven { url "https://maven.google.com" }
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}
而我的app/build.gradle看起来是:

apply plugin: 'com.android.application'

android {
  compileSdkVersion 26
  buildToolsVersion '26.0.2'

  defaultConfig {
    applicationId "fi.x.y"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 2
    versionName "1.0.2"
    multiDexEnabled true
    ndk {
      abiFilters 'armeabi-v7a', 'x86'
    }
    manifestPlaceholders = [
      'appAuthRedirectScheme': 'fi.x.y'
    ]
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
  dexOptions {
    javaMaxHeapSize "8g"
  }
  lintOptions {
    abortOnError false
  }
}

task exponentPrebuildStep(type: Exec) {
  workingDir '../../'

  if (System.getProperty('os.name').toLowerCase().contains('windows')) {
    commandLine 'cmd', '/c', '.\\.expo-source\\android\\detach-scripts\\prepare-detached-build.bat'
  } else {
    commandLine './.expo-source/android/detach-scripts/prepare-detached-build.sh'
  }
}
preBuild.dependsOn exponentPrebuildStep

repositories{
  flatDir{
    dirs "../../node_modules/react-native-background-geolocation/android/libs"
  }
  mavenLocal()
  maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile(project(':react-native-firebase')) {
        transitive = false
    }
    compile project(':react-native-vector-icons')
  compile fileTree(dir: 'libs', include: ['*.jar'])
  testCompile 'junit:junit:4.12'
  compile 'com.android.support:multidex:1.0.2'

  compile 'com.google.android.gms:play-services:11.8.0'
  compile 'com.google.android.gms:play-services-location:11.8.0'
  compile 'com.google.android.gms:play-services-places:11.8.0'
  compile 'com.google.android.gms:play-services-maps:11.8.0'
  compile 'com.google.android.gms:play-services-ads:11.8.0'

  compile('host.exp.exponent:expoview:22.0.0@aar') {
    exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
    exclude group: 'com.facebook.android', module: 'audience-network-sdk'
    exclude group: 'io.nlopez.smartlocation', module: 'library'
    transitive = true
  }

  compile ('com.facebook.android:facebook-android-sdk:4.+')
  compile('com.facebook.android:audience-network-sdk:4.+') {
    exclude module: 'play-services-ads'
  }
  compile('io.nlopez.smartlocation:library:3.2.11') {
    transitive = false
  }
  compile(project(':react-native-background-geolocation')) {
    exclude group: 'com.google.android.gms', module: 'play-services-location'
  }
  compile(name: 'tslocationmanager', ext: 'aar') {
    exclude group: 'com.google.android.gms'
  }
  compile project(':react-native-fcm')
  compile 'com.google.firebase:firebase-core:11.8.0' //this decides your firebase SDK version

}

apply plugin: 'com.google.gms.google-services'
主要用途:

// Needed for `react-native link`
  public List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        // Add your own packages here!
        // TODO: add cool native modules
            new RNBackgroundGeolocation(),
            // Needed for `react-native link`
        // new MainReactPackage(),
            new RNFirebasePackage(),
            new VectorIconsPackage(),
            new RNFirebaseMessagingPackage(),
            new FIRMessagingPackage()

    );
  }
我将按照此链接为react native android安装推送通知:

我没有在控制台日志中看到任何日志,项目正在成功构建,但当启动应用程序时,带有错误消息的白色屏幕显示comes软件包未在xxx:yy运行

我以前没有这个问题,我也不得不把所有的谷歌服务包改成11.8.0,因为在我安装fcm库时有冲突


你知道这会导致我无法打开我的应用程序吗

我以前遇到过此问题,请尝试以下方法:

确保您的笔记本电脑和手机位于同一个Wi-Fi网络上。 在设备上打开React本机应用程序。你会看到一个红色的屏幕 如果出现错误,请打开应用内开发者菜单。您正在谈论的那个

转到开发人员设置→ 调试设备的服务器主机。摇动设备

键入计算机的IP地址和本地开发人员的端口 服务器,例如10.0.1.1:8081。返回“开发人员”菜单并 选择ReloadJS

我使用ipconfig查找我的IP,并使用上述方法

我还建议您使用平台工具,确保正确安装了adb

我通过创建一个新的react本地项目,发现这解决了这个错误

注意:您可能会收到另一个错误,告诉您x文件路径无法删除。我在我的实践项目中进行了尝试,效果很好。 *试试看,风险自负


应用程序根本没有打开,我无法摇动,此时没有可用的菜单。软件包有点问题,我想,我使用的是相同的网络ip都很好,在安装fcm Library之前,它的工作性能很好。当出现红色屏幕时,您通常可以向下滚动并单击“关闭”按钮。然后您可以摇动屏幕并显示菜单。您是否创建了一个新项目,并检查是否存在相同的问题。这也发生在我尝试使用react native sound时。有一些不兼容的问题,我通过卸载修复了它。重新安装。在我之后:cd android gradlew clean