Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timber 4.7.1 appears to require JDK 1.8 #327

Closed
byencho opened this issue Jul 24, 2018 · 6 comments
Closed

Timber 4.7.1 appears to require JDK 1.8 #327

byencho opened this issue Jul 24, 2018 · 6 comments

Comments

@byencho
Copy link

byencho commented Jul 24, 2018

We have a project that is currently not compatible with JDK 1.8. When updating from version 4.7.0 to 4.7.1 we get the following error:

Error: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.

This appears to be related to the version bump for the Jetbrains annotations (28aa40a#diff-c197962302397baf3a4cc36463dce5eaL29). The docs for the annotations starting with version 16.0.1 mention they require JDK 1.8:

annotations artifact require JDK 1.8 or higher. If your project is compiled using JDK 1.5, 1.6 or 1.7 you can use annotations-java5 artifact instead.

This is first mentioned at JetBrains/java-annotations@fda1bd2#diff-04c6e90faac2675aa89e2176d2eec7d8 .

Is JDK 1.8 meant to be an intentional dependency for Timber 4.7.1 and up?

@dgadelha
Copy link

Hey,

Can you check if adding this to your build.gradle works for your project?

implementation 'org.jetbrains:annotations-java5:16.0.2'
implementation ('com.jakewharton.timber:timber:4.7.1') {
    exclude group: 'org.jetbrains'
}

The plain Timber implementation worked fine for me in a Kotlin-only project (with no explicit targetCompatibility set to 1.8), but it could be probably because Kotlin might include the needed stuff for JetBrains Annotations. Just wanted to check if this method works with your project.

Thanks!

@byencho
Copy link
Author

byencho commented Jul 30, 2018

@dgadelha Thanks for the suggestion but that didn't seem to help. I should note that I'm using an older version of gradle so technically I used:

    compile 'org.jetbrains:annotations-java5:16.0.2'
    compile ('com.jakewharton.timber:timber:4.7.1') {
        exclude group: 'org.jetbrains'
    }

but that should be equivalent. I also tried other variations on forcing a different version of the annotations, such as

    compile ('org.jetbrains:annotations:15.0') { force = true }
    compile 'com.jakewharton.timber:timber:4.7.1'

Based on the output of gradlew dependencies, that seemed to successfully override the dependency but I'm still getting the build error.

@dgadelha
Copy link

@byencho Sad to hear it didn't help. Looks like we'd need to wait for an update from @JakeWharton then.

Until a solution comes, I guess you can keep using the previous version of Timber.

Thanks!

@dabitdev
Copy link

dabitdev commented Sep 5, 2018

confirmed here too :(

@JakeWharton
Copy link
Owner

I don't think I'm going to "fix" this. With AS / AGP 3.2 desugar has moved into D8 and should just work. With AS / AGP 3.1 you can enable it by setting android.enableD8.desugaring=true in gradle.properties. The Android toolchain is long overdue in making Java 8 the default, and with 3.2 becoming stable it's finally time where libraries don't have to worry about it anymore.

@byencho
Copy link
Author

byencho commented Sep 6, 2018

OK, seems fair. Thanks for checking! I'll close this out.

@byencho byencho closed this as completed Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants