Build errors when switching from buildToolsVersion '24 .0.2 'to something higher

Build failed to switch to buildTooolsVersion 24.0.3 or higher with error messages related to default methods and static methods "not supported in Android API level less than 24"

Works great in previous versions of Build Tools, up to 24.0.2 I use Jack and Google play services. However, the complaints relate to the code in java.util and java.lang For example:

Error: SortedSet.java: 36-37: default method java.util.Spliterator spliterator () is not supported at Android API level less than 24.0.2

Error: Stream.java: 68-69: static method java.util.stream.Stream $ Builder builder () is not supported at Android API level less than 24

minSdkVersion 17 targetSdkVersion 24

+2
source share
1 answer

I switched my android studio to using a packaged version of java 8.

When I switched to java 8, I added that the connector is enabled and the version is up to 8, but this broke everything for the release build.

Then I switched this value from true to false.

jackOptions { enabled false } 

Then I set this value from 8 to 7.

 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } 

I assume that if your code and the libraries that you include in your project work for java 7, your code should be created for release.

If this does not work, and you should use these java functions, it seems to you that you will need to move the minimum version to 24.

+1
source

Source: https://habr.com/ru/post/1012778/


All Articles