https://github.com/retrostreams/android-cfuture21-hack
A hackish attempt to provide CompletableFuture on Android API level 21 to level 23 in conjunction with google/desugar_jdk_libs and Android Gradle Plugin 4.x
https://github.com/retrostreams/android-cfuture21-hack
android completablefuture java8 java9 jep-266
Last synced: 4 months ago
JSON representation
A hackish attempt to provide CompletableFuture on Android API level 21 to level 23 in conjunction with google/desugar_jdk_libs and Android Gradle Plugin 4.x
- Host: GitHub
- URL: https://github.com/retrostreams/android-cfuture21-hack
- Owner: retrostreams
- License: gpl-2.0
- Created: 2020-09-19T19:12:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-19T21:34:04.000Z (almost 5 years ago)
- Last Synced: 2023-07-05T16:42:38.835Z (over 2 years ago)
- Topics: android, completablefuture, java8, java9, jep-266
- Language: Java
- Homepage:
- Size: 463 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://mvnrepository.com/artifact/net.sourceforge.streamsupport/android-cfuture21-hack)
[](https://javadoc.io/doc/net.sourceforge.streamsupport/android-cfuture21-hack)
# android-cfuture21-hack
An unsupported hackish attempt to provide CompletableFuture on Android API level 21 to level 23 in conjunction with google/desugar_jdk_libs and Android Gradle Plugin 4.x
Android Studio will display an error "Call requires API level 24 (current min is 21)". This error is just a warning that can be ignored. If you want to get rid of the error, just add `@SuppressLint("NewApi")` to your code.
Use at your **own risk**. This hack **won't** get support in any way!
### app/build.gradle:
```groovy
apply plugin: 'com.android.application'
android {
defaultConfig {
...
minSdkVersion 21 // has to be >= 21 and < 24, if you have 24+ this hack is not needed
...
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
implementation 'net.sourceforge.streamsupport:android-cfuture21-hack:1.0.5'
}
```
## LICENSE
GNU General Public License, version 2, [with the Classpath Exception](https://github.com/retrostreams/android-cfuture21-hack/blob/master/LICENSE) (and [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/) for JSR-166 derived code)