天天看點

gradle問題大全

  • 首先檢視

    android studio

    安裝目錄下的

    gradle

    檔案夾,如果你的

    gradle-2.10

    檔案夾已經被删除,就到http://gradle.android-studio.org/重新下載下傳一個放到該目錄。
  • 然後進入

    settings

    搜尋

    gradle

    ,修改

    Gradle home

    為下載下傳好的

    gradle-2.10

    目錄。
  • 最後修改項目中

    gradle/gradle-wrapper.properties

    檔案的

    distributionUrl

    屬性(如

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

    ),以及

    build.gradle

    檔案中的

    gradle

    版本,重新編譯,一切OK

 Unknown host 'services.gradle.org'. You may need to adjust the proxy settings in Gradle. Learn about configuring HTTP proxies in Gradle

折騰半天終于解決問題,廢話不多說直接上圖1.打開項目目錄gradle/wrapper/:2.打開gradle-wrapper.properties檔案,把distributionUrl值替換掉,可以建立一個項目複制過來,回到項目重新sync一下即可

問題

在添加butterKnife依賴的時候出現如下錯誤:

Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.

- butterknife-7.0.1.jar

Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.

修改

1

2

3

4

5

6

7

8

9

10

11

android {

...

defaultConfig {

...

javaCompileOptions {

annotationProcessorOptions {

includeCompileClasspath = true

}

}

}

}

添加上面配置就好…………….