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/"}
        }
    }
相關文章
相關標籤/搜索