【问题标题】:Could not find android-maven-gradle-plugin.jar while updating android studio 3.0.1 to 3.1将 android studio 3.0.1 更新到 3.1 时找不到 android-maven-gradle-plugin.jar
【发布时间】:2018-09-07 23:11:00
【问题描述】:

我在将 android studio 3.0.1 更新到 3.1 时遇到以下问题

找不到 android-maven-gradle-plugin.jar (com.github.dcendents:android-maven-gradle-plugin:1.5)。 在以下位置搜索: https://jcenter.bintray.com/com/github/dcendents/android-maven-gradle-plugin/1.5/android-maven-gradle-plugin-1.5.jar

下面是我的 build.gradle

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.novoda:bintray-release:0.3.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath 'io.fabric.tools:gradle:1.24.4'
    }
}

请帮忙

【问题讨论】:

标签: java android maven gradle android-studio-3.1


【解决方案1】:

找到解决方案, 通过更新解决了错误

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

在 gradle-wrapper.properties 中使用:

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

并将 buildToolsVersion 更新为 27.0.3

【讨论】:

    【解决方案2】:

    Gradle Android Maven 插件

    要使用 android-maven-gradle-plugin,只需在您的 android-library 项目中应用该插件即可。还将插件类路径依赖项添加到 buildScript。

    buildscript {
    repositories {
        mavenCentral()
    }
    
    dependencies {
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
    }
    }
    
    apply plugin: 'com.android.library'
    
    apply plugin: 'com.github.dcendents.android-maven'
    

    或使用 gradle 2.1

    plugins {
     id "com.github.dcendents.android-maven" version "2.0"
    }
    

    可以在脚本build.gradle中设置maven groupId和version:

    group = 'com.example'
    version = '1.0'
    

    在 settings.gradle 中设置:

    rootProject.name = 'artifact'
    

    【讨论】:

      猜你喜欢
      • 2018-09-08
      • 2018-09-15
      • 2015-05-14
      • 1970-01-01
      • 1970-01-01
      • 2018-06-14
      • 1970-01-01
      • 1970-01-01
      • 2018-09-09
      相关资源
      最近更新 更多