Giter VIP home page Giter VIP logo

Comments (3)

jsotuyod avatar jsotuyod commented on September 26, 2024

Ok, just tried your project and reproduced the error.

Running with -debug I see this:

00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing archive /home/jmsotuyo/.gradle/caches/modules-2/files-2.1/com.android.databinding/compiler/2.2.0-alpha5/173b5ba5ec9d2a71350da24c7c239ed5a54179bb/compiler-2.2.0-alpha5.jar...
00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/...
00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/MANIFEST.MF...
00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/compiler-compileKotlin.kotlin_module...
00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/kotlin-runtime.kotlin_module...
00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/kotlin-stdlib.kotlin_module...
00:42:23.798 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/services/...
00:42:23.808 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing META-INF/services/javax.annotation.processing.Processor...
00:42:23.811 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing NOTICE...
00:42:23.811 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing NOTICE.txt...
00:42:23.811 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing android/...
00:42:23.811 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing android/databinding/...
00:42:23.811 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing android/databinding/annotationprocessor/...
00:42:23.811 [DEBUG] [com.android.build.gradle.internal.ApplicationTaskManager] processing android/databinding/annotationprocessor/AnnotationUtil.class...
00:42:23.812 [ERROR] [org.gradle.api.Project] Dex: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.

I opened the compiler-2.2.0-alpha5.jar, extracted android/databinding/annotationprocessor/AnnotationUtil.class and by using javap -v on it found that, unsurprisingly, it's compiled for JRE 8.

This jar is used for annotation processing, so it's not to be included on the dex. This is clearly a bug on Android's plugin 2.2.0-alpha5, and is not present in version 2.1.2.

For the time being, I recomend you switch back to Android plugin 2.1.2, and report the issue on http://b.android.com/

Remember, android-24 requires Java 8:

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

compileSdkVersion 'android-24' requires JDK 1.8 or later to compile.

I still can't reproduce your first error (Unsupported major.minor version 52.0 on Java 7). I'm leaving this issue open until we can reproduce it or finally dismiss it. Could you provide a sample on which Java 7 produces such output?

from static-code-analysis-plugin.

jsotuyod avatar jsotuyod commented on September 26, 2024

I got to reproduce your error, it's the Android Gradle plugin itself that is built for JRE 8. Even without SCA I get that error on java 7.

So, both issues here are with Android or your setup.

Bottomline:

  • Android 24 / Android Gradle 2.2.0+ require JRE 8
  • Android Gradle 2.2.0-alpha5 is incorrectly including databinding's annotation processing in the dex

Solution:

  • Stick to Android Gradle 2.1.2 for the time being, report the issue to Google
  • Use Java 8, or stick to Android 23

from static-code-analysis-plugin.

jsotuyod avatar jsotuyod commented on September 26, 2024

Android Gradle plugin 2.2.0-alpha6 has just been released, and it seems to fix this dexing issue. You could use it safely.

from static-code-analysis-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.