Android Studio使用时碰见的一些问题+解决方法(持续更新)

1.若是编译时出现“ERROR: Plugin with id 'com.android.application' not found.”错误.android

解决方法:请在build.gradle文件中添加如下代码。app

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
         //版本号请根据本身的gradle插件版本号自行更改
        classpath 'com.android.tools.build:gradle:3.4.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

 

2.Error:Failed to resolve: com.android.support:support-v4:26.0.0maven

出现问题的缘由:support annotations自25.4.0以后support包不在sdk中更新了,须要用谷歌的maven库,在Project的build.gradle中添加谷歌的地址gradle

解决方法:所以须要咱们手动的在Project的build.gradle中添加以下谷歌的地址ui

allprojects {
        repositories {

            jcenter()
            mavenCentral()

            maven{ url "https://maven.google.com"}
            maven{ url "https://dl.google.com./dl.android/maven2/"}
        }
    }
相关文章
相关标签/搜索