无法找到com.google.android.gms:strict-version-matcher-plugin:1.1.0。

9

无法解析配置文件classpath的所有文件。

找不到com.google.android.gms:strict-version-matcher-plugin:1.1.0。

在以下位置搜索: https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar file:/C:/Users/e1706396/.m2/repository/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom file:/C:/Users/e1706396/.m2/repository/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar Required by: unspecified:unspecified:unspecified > com.google.gms:google-services:4.2.0

尝试:运行--stacktrace选项以获取堆栈跟踪。 运行--info或--debug选项以获取更多日志输��。

获取更多帮助: https://help.gradle.org

命令运行失败,退出码为1。

plugin are i am using

   <plugin name="cordova-plugin-appavailability" spec="^0.4.2" />
    <plugin name="cordova-plugin-camera" spec="^4.0.3" />
    <plugin name="cordova-plugin-compat" spec="^1.2.0" />
    <plugin name="cordova-plugin-device" spec="^2.0.2" />
    <plugin name="cordova-plugin-googleplus" spec="^5.2.1">
        <variable name="REVERSED_CLIENT_ID" value="xxx" />
    </plugin>
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <plugin name="cordova-plugin-ionic-webview" spec="^1.1.19" />
    <plugin name="cordova-plugin-mfp" spec="^8.0.2018070216" />
    <plugin name="cordova-plugin-mfp-push" spec="^8.0.2018040410" />
    <plugin name="cordova-plugin-network-information" spec="^2.0.1" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-x-socialsharing" spec="^5.4.1" />
    <plugin name="cordova-wheel-selector-plugin" spec="^1.1.1" />
    <plugin name="info.protonet.imageresizer" spec="^0.1.1" />

Build gradle using

buildscript {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        mavenCentral()
        jcenter()
    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="27.0.1" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

依赖可能是我认为的问题

旧系统或其他系统运行良好

Node -v 3.10.10, NPM -v 6.10.10

我的当前系统无法正常工作,会出现错误

npm -v 6.4.1, node -v 8.12.0 node -v

4个回答

5
我曾在Android Studio中的Android项目中遇到过类似的问题。
请确保您的项目级别 build.gradle 文件像这样:
// 顶层构建文件,在其中可以添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
    jcenter()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    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 {
    google()
    jcenter()
}
task clean(type: Delete) {
delete rootProject.buildDir
}

通过在repositories{}和allprojects{}中添加同时具有jcenter()和google()的存储库来解决此问题。


4

简而言之,这是一个与jcenter存储库相关的问题,它报告无法找到您的插件所依赖的库,很多人都遇到了同样的问题。为了使其正常工作,您需要将jcenter放在platforms/android/build.gradle文件中的最后一个选项。

来自于:platforms/android/build.gradle - 第40行

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

转化为中文如下:

在文件 platforms/android/build.gradle 的第40行


// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        mavenLocal()
        google()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}

然后尝试重新构建您的应用程序。

如果出现与未找到google()存储库相关的错误,请尝试更新gradle版本。


0

我遇到了同样的问题,是由 cordova-plugin-fcm 引起的。

通过将 Google Maven 添加到插件的 gradle 中解决。 对于 cordova-plugin-fcm,它在这里:

平台 > 安卓 > cordova-plugin-fcm > ***.gradle

您可以检查 cordova-plugin-googleplus 文件夹或其他依赖于 google-services 的插件,我的看起来像这样:

dependencies {
    ...
    classpath 'com.google.gms:google-services:+'
    ...
}

我的最终代码:

buildscript {
    repositories {
        maven { url "https://maven.google.com" }
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:+'
    }
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

0

我通过在 cordova-support-google-services 插件的 build.gradle 仓库中添加 maven { url "https://maven.google.com" } 来解决了这个问题。最终文件现在看起来像这样:

buildscript {
    repositories {
        maven { url "https://maven.google.com" }
        jcenter()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.+'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

我正在使用 Gradle 4.1。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接