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

Revert support for java 1.7 or figure a way to use java 8 features while maintaining compatibility for Android before N #832

Closed
freszu opened this issue Jun 7, 2018 · 3 comments

Comments

@freszu
Copy link
Contributor

freszu commented Jun 7, 2018

WHat kind of issue is this?
Bug Report

This issue was already brought up here : mapbox/mapbox-gl-native#11392 and solution was going back to 1.7, this is most likely the PR that caused this issue: #770

Expected Behavior

Everything compiles while supporting lowest android sdk supported by mapbox: 14.

Current Behavior

App won't compile unless i target Android N

AGPBI: {"kind":"error","text":"Static interface methods are only supported starting with Android N (--min-api 24): com.mapbox.geojson.Geometry com.mapbox.geojson.Geometry.fromJson(java.lang.String)","sources":[{}],"tool":"D8"}

Possible Solution

  • Revert support for Java8
  • figure a way to maintain 1.8 support using
    https://developer.android.com/studio/write/java8-support
    it might be that unless library is provided as AAR those do not apply - so maybe it would make sense to provide this part of mapbox also as aar dependency for android. I am not sure if that would solve the problem though - someone would need to confirm.

Context (Environment)

Build Tools: com.android.tools.build:gradle:3.1.2
MinSdk: 21
mapBoxServicesVersion = '3.2.0'

@tobrun
Copy link
Member

tobrun commented Jun 7, 2018

App won't compile unless i target Android N, the shown error can throw you off but you don't actually need to target Android N to use java8 language features.

From your java8-support link:

After that, for each module that uses Java 8 language features (either in its source code or through dependencies), update the Source Compatibility and Target Compatibility to 1.8 in the Project Structure dialog as shown in figure 2 (click File > Project Structure).

so you are required to use the following in your build.gradle:

android {
  ...
  // Configure only for each module that uses Java 8
  // language features (either in its source code or
  // through dependencies).
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

This issue is not actionable for us, java8 is the way forward.

@tobrun tobrun closed this as completed Jun 7, 2018
@osana
Copy link
Contributor

osana commented Jun 7, 2018

@freszu FYI https://github.com/mapbox/mapbox-java/issues/12041 brought Java8 back in gl-native as well

@freszu
Copy link
Contributor Author

freszu commented Jun 7, 2018

Haven't seen this was updated back to 1.8 in 12041. No one had a chance to cause him any issues there yet most likely though.
If MapBox decided to stay with 1.8 it would be nice to have it explicitly written to change the compile options in readme and other places (website) , this will be especially the case for main mapbox dependency when it gets updated as many people that are using kotlin and don't have java 1.8 options enabled will stumble upon this. The error logs from compiler are nowhere helpfull and suggest that only possible solution is jumping on 24 sdk and it's the first time i am coming across such issue.

Anyway for me that seems to fix the issue as the app started to compile back again thanks for fast response.

@osana osana mentioned this issue Aug 27, 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

3 participants