UFO ET IT

Android Studio 프로젝트의 명령 줄에서 Gradle을 사용한 빌드 실패 : Xlint 오류

ufoet 2021. 1. 6. 20:02
반응형

Android Studio 프로젝트의 명령 줄에서 Gradle을 사용한 빌드 실패 : Xlint 오류


이 명령을 사용하여 gradle로 Android 프로젝트를 빌드하려고 할 때 :

> gradlew clean build assembleRelease

이 오류가 발생합니다.

Note: Some input files use or override a deprecated API.  
Note: Recompile with -Xlint:deprecation for details.  
Note: Some input files use unchecked or unsafe operations.  
Note: Recompile with -Xlint:unchecked for details.

이 프로젝트를 빌드하고 Studio에서 APK를 만들 수 있습니다.

Xlint 알림을 무시하고 컴파일을 수행하도록 Gradle을 구성하는 방법이 있습니까?

또는 다른 매개 변수를 사용하여 gradle / gradlew를 사용하여 명령 줄에서 릴리스 할 수 있습니까?


오류가 아니라 좋은 경고입니다. 전체 Lint 보고서를 보려면 다음 행을 build.gradle에 추가 할 수 있습니다.

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

이러한 경고를 정말로 제거하려면 :

  1. 더 이상 사용되지 않는 API를 사용하지 마십시오.
  2. @SuppressWarnings ( "deprecation") 사용

이 @의 shakalaca의 대답에서 매우 분명하다,하지만 당신은 중단 경고를 얻을 코드 오래된만큼이있는 경우, 당신은 또한 예를 들면되지 않은 작업을 사용하는 코드 옛 충분히있을 수 List와 같이 파라미터 화 된 형태 않고를 List<String>. 그러면 추가 경고가 표시됩니다.

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

컴파일러 args 블록을 확장하여이를 포함 할 수 있습니다.

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

참조 URL : https://stackoverflow.com/questions/18596309/failure-on-build-with-gradle-on-command-line-with-an-android-studio-project-xl

반응형