久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

出現(xiàn)錯(cuò)誤“未找到 Gradle DSL 方法:'compile()'

Getting Error quot;Gradle DSL method not found: #39;compile()#39;quot; when Syncing Build.Gradle(出現(xiàn)錯(cuò)誤“未找到 Gradle DSL 方法:compile()同步 Build.Gradle 時(shí))
本文介紹了出現(xiàn)錯(cuò)誤“未找到 Gradle DSL 方法:'compile()'"同步 Build.Gradle 時(shí)的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

添加 V4支持庫到 android studio,我遵循了這個(gè)文檔:https://developer.android.com/tools/support-library/setup.html#libs-without-res 但我得到一個(gè)錯(cuò)誤.這就是我所做的

To add V4 support libraries to android studio, i followed this document:https://developer.android.com/tools/support-library/setup.html#libs-without-res but I get an error. Here is what i did

  1. SDK manager> 已安裝 Android 支持庫和 Android 存儲(chǔ)庫.
  2. 轉(zhuǎn)到 Build.Gradle 并添加文檔中給出的行.Build.Gradle 現(xiàn)在看起來像這樣:

//頂級(jí)構(gòu)建文件,您可以在其中添加所有子項(xiàng)目/模塊通用的配置選項(xiàng).

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.13.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
    dependencies {

        compile "com.android.support:support-v4:18.0.+"
    }
}

}

然后,我收到一個(gè)提示我同步 gradle 的彈出窗口.當(dāng)我同步 Gradle 時(shí),我收到此錯(cuò)誤:

Then, I get a popup that suggest that I sync gradle. When i sync Gradle, i get this error:

錯(cuò)誤:(20, 0) Gradle DSL 方法未找到:'compile()'可能的原因:

  • 項(xiàng)目staymax"可能正在使用不包含該方法的 Gradle 版本.打開 Gradle 包裝文件
  • 構(gòu)建文件可能缺少 Gradle 插件.應(yīng)用 Gradle 插件
  • Error:(20, 0) Gradle DSL method not found: 'compile()' Possible causes:

  • The project 'staymax' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • 我是否缺少任何步驟?請建議.

    Am i missing any step? Please suggest.

    Build.Gradle(應(yīng)用程序)

    Build.Gradle(app)

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"
    
    defaultConfig {
        applicationId "com.appt.shreyabisht.staymax"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
     }
    }
    
    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    

    推薦答案

    在幾乎所有情況下,您的依賴項(xiàng)都應(yīng)該放在單個(gè)模塊的 build.gradle 文件中,而不是放在最頂層的 build.gradle 文件中.在您的情況下,這意味著應(yīng)該將依賴項(xiàng)添加到 app 模塊的 build.gradle 文件中:

    In almost all cases, your dependencies should be put into the individual module's build.gradle files rather than at the top most level build.gradle file. In your case, that means the dependency should be added to the app module's build.gradle file:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile "com.android.support:support-v4:18.0.+"
    }
    

    您應(yīng)該刪除頂層 build.gradle 的整個(gè) allprojects 部分.

    And you should remove the entire allprojects part of the top level build.gradle.

    這篇關(guān)于出現(xiàn)錯(cuò)誤“未找到 Gradle DSL 方法:'compile()'"同步 Build.Gradle 時(shí)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

    【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

    相關(guān)文檔推薦

    IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
    How to get current flavor in gradle(如何在 gradle 中獲取當(dāng)前風(fēng)味)
    How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復(fù)“意外元素lt;查詢gt;在“清單中找到錯(cuò)誤?)
    Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風(fēng)味庫的多風(fēng)味應(yīng)用)
    Android dependency has different version for the compile and runtime(Android 依賴在編譯和運(yùn)行時(shí)有不同的版本)
    Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
    主站蜘蛛池模板: 久久伊人精品 | 久久久久久亚洲精品不卡 | 韩国成人在线视频 | 91久久夜色 | 四虎永久在线精品免费一区二 | 国产精品福利网站 | 国产中的精品av涩差av | 日本在线视频不卡 | 不卡av电影在线播放 | 久久99蜜桃综合影院免费观看 | av日韩在线播放 | 操到爽 | 欧美精品一区二区三区蜜桃视频 | 成人午夜免费福利视频 | 精品欧美黑人一区二区三区 | 国产午夜精品一区二区三区四区 | 国产高清在线 | 亚洲精品欧美 | 日韩欧美在线不卡 | 亚洲精品视频免费观看 | 影音先锋中文字幕在线观看 | 国产精品一二三区 | 日韩成人av在线 | 精品国产欧美一区二区三区成人 | 精品网站999 | 毛片一级片 | 午夜国产精品视频 | 麻豆国产一区二区三区四区 | 国产日产久久高清欧美一区 | 亚洲精品久久久久久首妖 | 久久综合色综合 | 日韩在线视频一区二区三区 | 久久久一 | 亚洲欧美日韩精品久久亚洲区 | 美女国内精品自产拍在线播放 | 日韩伦理一区二区 | 成人免费一区二区三区视频网站 | 欧美一区二区在线 | 蜜桃毛片| 精品久久久久一区二区国产 | 精品久久久久久久久久 |