{"action":"closed","issue":{"url":"https://api.github.com/repos/grpc/grpc-java/issues/2397","repository_url":"https://api.github.com/repos/grpc/grpc-java","labels_url":"https://api.github.com/repos/grpc/grpc-java/issues/2397/labels{/name}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/2397/comments","events_url":"https://api.github.com/repos/grpc/grpc-java/issues/2397/events","html_url":"https://github.com/grpc/grpc-java/issues/2397","id":186748922,"number":2397,"title":"Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code.","user":{"login":"DreaminginCodeZH","id":4469895,"avatar_url":"https://avatars.githubusercontent.com/u/4469895?v=3","gravatar_id":"","url":"https://api.github.com/users/DreaminginCodeZH","html_url":"https://github.com/DreaminginCodeZH","followers_url":"https://api.github.com/users/DreaminginCodeZH/followers","following_url":"https://api.github.com/users/DreaminginCodeZH/following{/other_user}","gists_url":"https://api.github.com/users/DreaminginCodeZH/gists{/gist_id}","starred_url":"https://api.github.com/users/DreaminginCodeZH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DreaminginCodeZH/subscriptions","organizations_url":"https://api.github.com/users/DreaminginCodeZH/orgs","repos_url":"https://api.github.com/users/DreaminginCodeZH/repos","events_url":"https://api.github.com/users/DreaminginCodeZH/events{/privacy}","received_events_url":"https://api.github.com/users/DreaminginCodeZH/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-02T09:23:17Z","updated_at":"2016-11-05T01:46:40Z","closed_at":"2016-11-05T01:46:40Z","body":"When I'm trying to build an APK for my project, I encountered the following error.\r\n\r\n```\r\nError: Error converting bytecode to dex:\r\nCause: Dex cannot parse version 52 byte code.\r\nThis is caused by library dependencies that have been compiled using Java 8 or above.\r\nIf you are using the 'java' gradle plugin in a library submodule add \r\ntargetCompatibility = '1.7'\r\nsourceCompatibility = '1.7'\r\nto that submodule's build.gradle file.\r\n```\r\n\r\nSeems that some of the libraries are getting compiled into Java 8 bytecode, which won't be compatible with current `javac`. I had to use `jack` with the new bytecode which takes minutes on a debug build and it is very annoying.\r\n\r\nMy `app/build.gradle` is set up according to [the one in protobuf-gradle-plugin](https://github.com/google/protobuf-gradle-plugin/blob/master/testProjectAndroid/build.gradle):\r\n\r\n```gradle\r\napply plugin: 'com.android.application'\r\n\r\ndef gitSha1 = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()\r\n\r\napply from: '../signing.gradle'\r\n\r\nandroid {\r\n    compileSdkVersion 25\r\n    buildToolsVersion \"25\"\r\n    defaultConfig {\r\n        applicationId \"<some.application.id>\"\r\n        minSdkVersion 15\r\n        targetSdkVersion 25\r\n        versionCode 2\r\n        versionName \"1.0.0\"\r\n        buildConfigField \"String\", \"GIT_SHA1\", \"\\\"${gitSha1}\\\"\"\r\n        resValue 'string', 'application_id', applicationId\r\n        jackOptions {\r\n            enabled false\r\n        }\r\n    }\r\n    buildTypes {\r\n        release {\r\n            minifyEnabled true\r\n            shrinkResources true\r\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\r\n            signingConfig signingConfigs.release\r\n        }\r\n    }\r\n    compileOptions {\r\n        sourceCompatibility = JavaVersion.VERSION_1_7\r\n        targetCompatibility = JavaVersion.VERSION_1_7\r\n    }\r\n}\r\n\r\nbuildscript {\r\n    repositories {\r\n        mavenCentral()\r\n    }\r\n    dependencies {\r\n        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0'\r\n    }\r\n}\r\napply plugin: 'com.google.protobuf'\r\nprotobuf {\r\n    protoc {\r\n        artifact = 'com.google.protobuf:protoc:3.0.2'\r\n    }\r\n    plugins {\r\n        grpc {\r\n            artifact = 'io.grpc:protoc-gen-grpc-java:1.0.1'\r\n        }\r\n        javalite {\r\n            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'\r\n        }\r\n    }\r\n    generateProtoTasks {\r\n        all()*.plugins {\r\n                grpc {\r\n                    option 'lite'\r\n                }\r\n                javalite {}\r\n        }\r\n    }\r\n}\r\n\r\nbuildscript {\r\n    repositories {\r\n        jcenter()\r\n    }\r\n    dependencies {\r\n        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'\r\n    }\r\n}\r\napply plugin: 'android-apt'\r\n\r\ndependencies {\r\n    compile fileTree(dir: 'libs', include: ['*.jar'])\r\n\r\n    compile 'com.android.support:appcompat-v7:25.0.0'\r\n    compile 'com.android.support:design:25.0.0'\r\n\r\n    compile 'com.google.android.gms:play-services-auth:9.8.0'\r\n\r\n    compile 'com.google.protobuf:protobuf-lite:3.0.0'\r\n    compile 'com.squareup.okhttp:okhttp:2.7.5'\r\n    compile 'io.grpc:grpc-core:1.0.1'\r\n    compile 'io.grpc:grpc-okhttp:1.0.1'\r\n    compile ('io.grpc:grpc-protobuf-lite:1.0.1') {\r\n        // Otherwise Android compile will complain \"Multiple dex files define ...\"\r\n        exclude module: 'protobuf-lite'\r\n    }\r\n    compile 'io.grpc:grpc-stub:1.0.1'\r\n    compile 'javax.annotation:javax.annotation-api:1.3'\r\n\r\n    compile \"com.andkulikov:transitionseverywhere:1.6.9\"\r\n    compile 'com.github.bumptech.glide:glide:3.7.0'\r\n    compile 'com.github.bumptech.glide:okhttp-integration:1.4.0@aar'\r\n    compile 'com.jakewharton:butterknife:8.4.0'\r\n    compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'\r\n    apt 'com.jakewharton:butterknife-compiler:8.4.0'\r\n    compile 'com.squareup.okhttp3:okhttp:3.4.1'\r\n    compile 'org.greenrobot:eventbus:3.0.0'\r\n    compile 'me.zhanghai.android.materialedittext:library:1.0.5'\r\n    compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'\r\n}\r\n```\r\n\r\n```\r\n$ uname -a\r\nLinux ZH-Laptop 4.8.4-1-ARCH #1 SMP PREEMPT Sat Oct 22 18:26:57 CEST 2016 x86_64 GNU/Linux\r\n$ java -version\r\nopenjdk version \"1.8.0_112\"\r\nOpenJDK Runtime Environment (build 1.8.0_112-b15)\r\nOpenJDK 64-Bit Server VM (build 25.112-b15, mixed mode)\r\n```\r\n"}}
{"actor":{"display_login":"DreaminginCodeZH"}}