0
Gradle的传统艺能记录贴------持续更新
Maybe 发表于 2020-05-11 17:48 180
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed ...

原因:com.android.tools.build:gradle版本太太太太低

Caused by: org.gradle.internal.event.MultipleCompilationErrorsException: startup

原因:还没有发现

Gradle sync failed: Failed to find Build Tools revision xx.x.x

原因:app里的build.gradle里缺少了xx.x.x版本的,以文件夹形式打开build.gradle,添加相应版本

Error:Minimum supported Gradle version is 5.6.4. Current version is 4.6.

原因:最低支持的Gradle版本是5.6.4。 当前版本是4.6,因为人为修改了Gradle的版本,然后插件的版本没有修改导致不匹配,把插件也升级一下就可以了,在Project选项下找到gradle-wrapper.properties,把版本改成它需要的最小版本

Installation did not succeed.
The application could not be installed: INSTALL_FAILED_TEST_ONLY

原因:该项目不支持真机运行,在project下找到gradle.properties,添加android.injected.testOnly=false

Caused by: java.lang.IllegalStateException: failed to find target with hash string 'android-25'

原因:你的电脑没有这个版本的sdk,可以选择点错误报告下载,或者打开app下的build.gradle,修改targetSdkVersion、compileSdkVersion、buildToolsVersion为你当前用的版本

org.gradle.api.ProjectConfigurationException

原因:使用开源中国的maven库:阿里云的速度比较快,更稳定 阿里云的:http://maven.aliyun.com/nexus/content/groups/public/ OSChina的仓库地址:http://maven.oschina.net/content/groups/public/ 在项目的build.gradle文件中,修改repositories配置

repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    }

· ·

Could not resolve all artifacts for configuration ':classpath'.

原因:配置文件不对,好像是缺少支持库,弄一个第三方网站jcenter(){ url 'https://jcenter.bintray.com/'}下载一下就好了,注意http要加上s

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        mavenCentral()
        jcenter(){ url 'https://jcenter.bintray.com/'}
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.novoda:bintray-release:0.9.1'
        classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        mavenCentral()
        jcenter(){ url 'https://jcenter.bintray.com/'}
        maven { url 'https://jitpack.io' }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
评论
0/240
文章目录