Реагировать на собственную ошибку сборки: плагин с идентификатором com.google.gms: google-services не найден - PullRequest
0 голосов
/ 13 марта 2019

Я посмотрел на существующие ответы - большинство рекомендуют добавить строку classpath, которая у меня уже есть.Другой ответ рекомендовал добавить репозиторий Maven.Ни один не работал.

Модуль build.gradle

buildscript {
  ext {
    buildToolsVersion = "27.0.3"
    minSdkVersion = 16
    compileSdkVersion = 27
    targetSdkVersion = 26
    supportLibVersion = "27.1.1"
  }
  repositories {
    google()
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    //
    // HERE'S the appropriate classpath line
    //
    classpath 'com.google.gms:google-services:4.2.0'
  }
}
allprojects {
  repositories {
    mavenLocal()
    google()
    jcenter()
    maven {
      url "$rootDir/../node_modules/react-native/android"
    }
  }
}
task wrapper(type: Wrapper) {
  gradleVersion = '4.4'
  distributionUrl = distributionUrl.replace("bin", "all")
}
subprojects {
  project.configurations.all {
    resolutionStrategy.eachDependency { details ->
      if (details.requested.group == 'com.android.support'
          && !details.requested.name.contains('multidex') ) {
       details.useVersion "25.2.0"
      }
    }
  }
}

А по моему app/build.gradle

apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
  entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
  compileSdkVersion rootProject.ext.compileSdkVersion
  buildToolsVersion rootProject.ext.buildToolsVersion
  defaultConfig {
    applicationId "com.matthart.hcff"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 19
    versionName "1.30"
    ndk {
      abiFilters "armeabi-v7a", "x86"
    }
  }
  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"
    }
  }
  applicationVariants.all { variant ->
    variant.outputs.each { output ->
      def versionCodes = ["armeabi-v7a":1, "x86":2]
      def abi = output.getFilter(OutputFile.ABI)
      if (abi != null) {
        output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
      }
    }
  }
}
dependencies {
  compile project(':react-native-vector-icons')
  compile project(':react-native-payments')
  compile project(':react-native-maps')
  compile project(':react-native-geocoder')
  compile project(':react-native-gesture-handler')
  implementation fileTree(dir: "libs", include: ["*.jar"])
  implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
  implementation "com.facebook.react:react-native:+"
}
task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
}
//
// AND HERE'S the plugin line. Without this line, of course, it builds fine
//
apply plugin: 'com.google.gms:google-services'
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...