Gradle build falla en la tarea de pelusa

Tengo un proyecto androide simple que he creado con Android Studio 0.4.0. Uso Gradle 1.9 y Gradle Android Plugin 0.7. Ayer he añadido la biblioteca ButterKnife de Jake Wharton en mi script de compilación gradle:

dependencies { compile 'com.android.support:support-v4:19.0.0' compile 'com.android.support:appcompat-v7:19.0.0' // Butterknife compile 'com.jakewharton:butterknife:4.0.1' } 

Cuando ejecuto la aplicación desde Android Studio, la compilación se ejecuta correctamente y se ejecuta correctamente en mis dispositivos. Pero cuando intento (desde la línea de comandos) gradle build la construcción falla. Aquí está una parte de mi informe de la pelusa:

 InvalidPackage: Package not included in Android /home/yami/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/4.0.1/f43b36925363701633d01adb8e54df7150397a78/butterknife-4.0.1.jar: Invalid package reference in library; not included in Android: javax.annotation.processing. Referenced from butterknife.internal.InjectViewProcessor. /home/yami/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/4.0.1/f43b36925363701633d01adb8e54df7150397a78/butterknife-4.0.1.jar: Invalid package reference in library; not included in Android: javax.annotation.processing. Referenced from butterknife.internal.InjectViewProcessor. /home/yami/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/4.0.1/f43b36925363701633d01adb8e54df7150397a78/butterknife-4.0.1.jar: Invalid package reference in library; not included in Android: javax.annotation.processing. Referenced from butterknife.internal.InjectViewProcessor. /home/yami/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/4.0.1/f43b36925363701633d01adb8e54df7150397a78/butterknife-4.0.1.jar: Invalid package reference in library; not included in Android: javax.annotation.processing. Referenced from butterknife.internal.InjectViewProcessor. /home/yami/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/4.0.1/f43b36925363701633d01adb8e54df7150397a78/butterknife-4.0.1.jar: Invalid package reference in library; not included in Android: javax.annotation.processing. Referenced from butterknife.internal.InjectViewProcessor. 

Tal vez me estoy perdiendo algo, pero no para poder construir el proyecto en los bloques de terminales de la posibilidad de CI para los proyectos de Android.

Cualquier ayuda sería grande.

Con 0.7.0 viene el soporte extendido para Lint, sin embargo, no funciona siempre correctamente. (Por ejemplo, la biblioteca butterknife)

La solución es deshabilitar el abandono de la compilación de errores encontrados en la pelusa

Tomé la inspiración de https://android.googlesource.com/platform/tools/base/+/e6a5b9c7c1bca4da402de442315b5ff1ada819c7

(Implementación: https://android.googlesource.com/platform/tools/base/+/e6a5b9c7c1bca4da402de442315b5ff1ada819c7/build-system/gradle/src/main/groovy/com/android/build/gradle/internal/model/DefaultAndroidProject.java )

(Discusión: https://plus.google.com/+AndroidDevelopers/posts/ersS6fMLxw1 )

 android { // your build config defaultConfig { ... } signingConfigs { ... } compileOptions { ... } buildTypes { ... } // This is important, it will run lint checks but won't abort build lintOptions { abortOnError false } } 

Y si necesitas deshabilitar una regla de Lint específica y mantener la falla de compilación en otros, usa esto:

 /* * Use only 'disable' or only 'enable', those configurations exclude each other */ android { lintOptions { // use this line to check all rules except those listed disable 'RuleToDisable', 'SecondRuleToDisable' // use this line to check just listed rules enable 'FirstRuleToCheck', 'LastRuleToCheck' } } 

Si abortOnError false no resolverá su problema, puede probarlo.

 lintOptions { checkReleaseBuilds false } 

Puede seleccionar las opciones adecuadas desde aquí

 android { lintOptions { // set to true to turn off analysis progress reporting by lint quiet true // if true, stop the gradle build if errors are found abortOnError false // if true, only report errors ignoreWarnings true // if true, emit full/absolute paths to files with errors (true by default) //absolutePaths true // if true, check all issues, including those that are off by default checkAllWarnings true // if true, treat all warnings as errors warningsAsErrors true // turn off checking the given issue id's disable 'TypographyFractions','TypographyQuotes' // turn on the given issue id's enable 'RtlHardcoded','RtlCompat', 'RtlEnabled' // check *only* the given issue id's check 'NewApi', 'InlinedApi' // if true, don't include source code lines in the error output noLines true // if true, show all locations for an error, do not truncate lists, etc. showAll true // Fallback lint configuration (default severities, etc.) lintConfig file("default-lint.xml") // if true, generate a text report of issues (false by default) textReport true // location to write the output; can be a file or 'stdout' textOutput 'stdout' // if true, generate an XML report for use by for example Jenkins xmlReport false // file to write report to (if not specified, defaults to lint-results.xml) xmlOutput file("lint-report.xml") // if true, generate an HTML report (with issue explanations, sourcecode, etc) htmlReport true // optional path to report (default will be lint-results.html in the builddir) htmlOutput file("lint-report.html") // set to true to have all release builds run lint on issues with severity=fatal // and abort the build (controlled by abortOnError above) if fatal issues are found checkReleaseBuilds true // Set the severity of the given issues to fatal (which means they will be // checked during release builds (even if the lint target is not included) fatal 'NewApi', 'InlineApi' // Set the severity of the given issues to error error 'Wakelock', 'TextViewEdits' // Set the severity of the given issues to warning warning 'ResourceAsColor' // Set the severity of the given issues to ignore (same as disabling the check) ignore 'TypographyQuotes' } } 

Tuve algunos errores de pelusa en Android Studio que ocurrieron sólo cuando generé un APK firmado.

Para evitarlo, agregué lo siguiente a build.gradle

 android { lintOptions { checkReleaseBuilds false } } 

Agregue estas líneas al archivo build.gradle:

 android { lintOptions { abortOnError false } } 

Luego limpie su proyecto: D

Si desea evitar la opción "abortInError false", eche un vistazo al archivo build / lint-results-release-fatal.html. Aquí están los errores detectados por pelusa.

Espero que esto pueda ayudar a alguien!

En Android Studio v1.2, le indica cómo solucionarlo:

Introduzca aquí la descripción de la imagen

Tienes el mismo error en AndroidStudio versión 0.51

Build estaba funcionando bien y de repente, después de sólo cambiar el valor del código de versión, recibí un error relacionado con Lint.

Intentó cambiar build.gradle , borró la caché de build.gradle y reinició, pero no cambió.

Finalmente volví al código original (causando el error), y quité android:debuggable="false" de AndroidManifest.xml , haciendo que la estructura android:debuggable="false" éxito.

Lo agregué de nuevo y sigue funcionando … No me preguntes por qué: S

En cuanto a mí, es una solución mala y rápida para su problema:

 android { lintOptions { abortOnError false } } 

La mejor solución es solucionar el problema en su código, ya que la herramienta de pelusa revisa los archivos fuente del proyecto de Android para posibles errores y mejoras de optimización para la corrección, la seguridad, el rendimiento, la facilidad de uso, la accesibilidad y la internacionalización.

Este problema ocurre con más frecuencia cuando:

  • El diseño incluye símbolos no resueltos o falta algún atributo
  • Otros problemas estructurales, como el uso de elementos obsoletos o llamadas de API que no son compatibles con las versiones de API de destino, pueden provocar que el código no se ejecute correctamente.

Encuentra tus bugs por Inspect Code en Android Studio: Mejora tu código con Lint

  • Cobertura androide jacoco vacía con gradle
  • ¿Cómo estructura el directorio de prueba del proyecto en Android Studio?
  • Android: No se pudo encontrar ni cargar la clase principal org.gradle.wrapper.GradleWrapperMain
  • Android Studio 0.4 Archivos duplicados copiados en APK META-INF / LICENSE.txt
  • Eliminar archivo / jar / class de una ruta gradle en android studio
  • Módulo de Android Studio que depende de las pruebas de otro módulo
  • Después de la actualización para Android Studio 2.1.1 Error: (30, 13)
  • Cómo agregar meta-datos a gradle / AndroidStudio generó manifiesto
  • Android Studio y Gradle - falla la compilación
  • No se puede construir el proyecto Gradle con Android Studio
  • ¿Cómo publicar las fuentes .aar de Android para que Android Studio las encuentre automáticamente?
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.