Skip to content

Commit 007a831

Browse files
committed
Improve README.md
1 parent ac2f4c0 commit 007a831

File tree

1 file changed

+44
-7
lines changed

1 file changed

+44
-7
lines changed

README.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,30 @@
22

33
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?color=brightgreen&label=gradle%20plugin&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fm2%2Fcom%2Fgithub%2Fsgtsilvio%2Fgradle%2Fandroid-retrofix%2Fcom.github.sgtsilvio.gradle.android-retrofix.gradle.plugin%2Fmaven-metadata.xml)](https://plugins.gradle.org/plugin/com.github.sgtsilvio.gradle.android-retrofix)
44

5-
Backports Java 8 APIs to Android APIs < 24 (Android 7.0 Nougat)
5+
Seamlessly backports Java 8 APIs to Android below API 24 (Android 7.0 Nougat)
66

7-
## [android-retrostreams](https://github.com/retrostreams/android-retrostreams)
7+
Seamless means that you use the official Java 8 APIs, or libraries that internally use the official Java 8 APIs,
8+
and the plugin replaces the official Java 8 APIs with backport libraries only in the generated artifact.
9+
When you increase the minimum Android API level to 24 or higher in the future,
10+
you will only need to remove the plugin and the backport dependencies.
11+
You do not have to change your code.
12+
13+
Although Android by now supports
14+
[some Java 8 APIs through desugaring](https://developer.android.com/studio/write/java8-support-table),
15+
some important APIs are still not possible to use on Android APIs below 24 - for example `CompletableFuture`.
16+
17+
## Backport Libraries
18+
19+
The following sections list the backported APIs when adding the respective backport library as dependency.
20+
21+
### [android-retrostreams](https://github.com/retrostreams/android-retrostreams)
22+
23+
Dependency:
24+
```groovy
25+
dependencies {
26+
implementation("net.sourceforge.streamsupport:android-retrostreams:1.7.4")
27+
}
28+
```
829

930
Backported new types:
1031
- `java.lang.FuncionalInterface`
@@ -37,14 +58,30 @@ Backported static/default methods of:
3758
- `java.util.Map$Entry`
3859
- `java.util.concurrent.ConcurrentMap`
3960

40-
## [android-retrofuture](https://github.com/retrostreams/android-retrostreams)
61+
### [android-retrofuture](https://github.com/retrostreams/android-retrofuture)
62+
63+
Dependency:
64+
```groovy
65+
dependencies {
66+
implementation("net.sourceforge.streamsupport:android-retrofuture:1.7.4")
67+
}
68+
```
4169

4270
Backported new types:
4371
- `java.util.concurrent.CompletableFuture`
4472
- `java.util.concurrent.CompletionException`
4573
- `java.util.concurrent.CompletionStage`
4674

47-
## [threetenbp](https://github.com/ThreeTen/threetenbp)
75+
### [threetenbp](https://github.com/ThreeTen/threetenbp) or [threetenabp](https://github.com/JakeWharton/ThreeTenABP)
76+
77+
Dependency:
78+
```groovy
79+
dependencies {
80+
implementation("org.threeten:threetenbp:1.5.1")
81+
// or
82+
implementation("com.jakewharton.threetenabp:threetenabp:1.3.1")
83+
}
84+
```
4885

4986
Backported new types:
5087
- `java.time.**`
@@ -63,7 +100,7 @@ Backported conversion methods of:
63100
- `java.sql.Timestamp`
64101

65102

66-
# How to use
103+
## How to Use
67104

68105
Configure your `app/build.gradle` like the following:
69106

@@ -78,7 +115,7 @@ buildscript {
78115
}
79116
}
80117
81-
apply plugin: 'com.android.application' // mandatory for android apps
118+
apply plugin: 'com.android.application'
82119
apply plugin: 'com.github.sgtsilvio.gradle.android-retrofix'
83120
...
84121
@@ -101,7 +138,7 @@ dependencies {
101138
implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.4' // for backporting streams
102139
implementation 'net.sourceforge.streamsupport:android-retrofuture:1.7.4' // for backporting future
103140
implementation 'org.threeten:threetenbp:1.5.1' // for backporting time
104-
// or implementation 'com.jakewharton.threetenabp:threetenabp:1.3.1' // https://github.com/JakeWharton/ThreeTenABP
141+
// or implementation 'com.jakewharton.threetenabp:threetenabp:1.3.1'
105142
...
106143
}
107144
```

0 commit comments

Comments
 (0)