1. 程式人生 > >Android--Gradle build finished with 232 error(s) in 1m 43s

Android--Gradle build finished with 232 error(s) in 1m 43s

Android–Gradle build finished with 232 error(s) in 1m 43s

What is this?(這是啥?)

這些很多可能性是我們在Android 的開發過程中使用了過時的javaAPI,或者不太規範的程式設計,所以這232個error,其實是232個warnings, 所以如果我們可以編譯通過,就代表並沒有什麼錯,我們可以使用以下幾種方式解決1

解決方法

以下都是在Gradle中加

// 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:2.2.3' classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files
} } allprojects { repositories { jcenter() //Bmob的maven倉庫地址--必填 maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" } gradle.projectsEvaluated { tasks.withType(JavaCompile){ options.compilerArgs << "-Xmaxerrs" << "1000"
} } } } task clean(type: Delete) { delete rootProject.buildDir }

1. 加入下列程式碼,把最大Error數調大

gradle.projectsEvaluated {  
    tasks.withType(JavaCompile) {  
        options.compilerArgs << "-Xmaxerrs" << "1000"  
    }  
}  

2. 加入下列程式碼,不檢查warning

allprojects {   
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}

參考