Skip to content

Commit b6aaba6

Browse files
authored
Merge pull request #97 from proyecto26/develop
Add gradle backward-compatibility with AndroidX support
2 parents 2b502da + 3dde945 commit b6aaba6

File tree

6 files changed

+75
-7
lines changed

6 files changed

+75
-7
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ in case of vulnerabilities.
2222

2323
## [Unreleased]
2424

25+
## [3.0.1] - 2019-08-16
26+
27+
### Added
28+
- Add gradle backward-compatibility for Android Support with Jetifier ([#96](https://github.com/proyecto26/react-native-inappbrowser/pull/97)).
29+
- Added **androidXAnnotation** and **androidXBrowser** properties from **rootProject.ext** for **AndroidX** with backward compatibility using **supportLibVersion** property instead.
30+
2531
## [3.0.0] - 2019-07-27
2632
### Added
2733
- **Android:** Migrate to AndroidX by [@jdnichollsc](https://github.com/jdnichollsc) ([8a083f2](https://github.com/proyecto26/react-native-inappbrowser/commit/8a083f24847ac5f49923c6217106628434634b4d)).

README.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,53 @@
3535

3636
### Mostly automatic installation
3737

38+
#### Using React Native >= 0.60
39+
Linking the package manually is not required anymore with [Autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md).
40+
41+
- **iOS Platform:**
42+
43+
`$ cd ios && pod install && cd ..` # CocoaPods on iOS needs this extra step
44+
45+
- **Android Platform for Android Support:**
46+
47+
Using [Jetifier tool](https://github.com/mikehardy/jetifier) for backward-compatibility.
48+
49+
Modify your **android/build.gradle** configuration:
50+
```
51+
buildscript {
52+
ext {
53+
buildToolsVersion = "28.0.3"
54+
minSdkVersion = 16
55+
compileSdkVersion = 28
56+
targetSdkVersion = 28
57+
# Only using Android Support libraries
58+
supportLibVersion = "28.0.0"
59+
}
60+
```
61+
62+
- **Android Platform for AndroidX:**
63+
64+
Modify your **android/build.gradle** configuration:
65+
```
66+
buildscript {
67+
ext {
68+
buildToolsVersion = "28.0.3"
69+
minSdkVersion = 16
70+
compileSdkVersion = 28
71+
targetSdkVersion = 28
72+
# Remove 'supportLibVersion' property and put specific versions for AndroidX libraries
73+
androidXAnnotation = "1.1.0"
74+
androidXBrowser = "1.0.0"
75+
// Put here other AndroidX dependencies
76+
}
77+
```
78+
79+
#### Using React Native < 0.60
80+
3881
`$ react-native link react-native-inappbrowser-reborn`
3982

4083
### Manual installation
4184

42-
4385
#### iOS
4486

4587
1. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`

android/build.gradle

+15-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,21 @@ repositories {
4242
dependencies {
4343
implementation fileTree(dir: 'libs', include: ['*.jar'])
4444
implementation 'com.facebook.react:react-native:+'
45-
implementation 'androidx.annotation:annotation:1.+'
46-
implementation 'androidx.browser:browser:1.+'
4745
implementation 'org.greenrobot:eventbus:3.+'
46+
def supportLibVersion = safeExtGet('supportLibVersion', safeExtGet('supportVersion', null))
47+
def androidXVersion = safeExtGet('androidXVersion', null)
48+
if (supportLibVersion && androidXVersion == null) {
49+
implementation "com.android.support:support-annotations:$supportLibVersion"
50+
implementation "com.android.support:customtabs:$supportLibVersion"
51+
} else {
52+
def defaultAndroidXVersion = "1.+"
53+
if (androidXVersion == null) {
54+
androidXVersion = defaultAndroidXVersion
55+
}
56+
def androidXAnnotation = safeExtGet('androidXAnnotation', androidXVersion)
57+
def androidXBrowser = safeExtGet('androidXBrowser', androidXVersion)
58+
implementation "androidx.annotation:annotation:$androidXAnnotation"
59+
implementation "androidx.browser:browser:$androidXBrowser"
60+
}
4861
}
4962

example/android/build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ buildscript {
66
minSdkVersion = 16
77
compileSdkVersion = 28
88
targetSdkVersion = 28
9-
supportLibVersion = "28.0.0"
9+
androidXVersion = "1.+" // Default AndroidX dependency
10+
androidXAnnotation = "1.1.0"
11+
androidXBrowser = "1.0.0"
1012
}
1113
repositories {
1214
google()

package-lock.json

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-inappbrowser-reborn",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "InAppBrowser for React Native",
55
"main": "index.js",
66
"readmeFilename": "README.md",
@@ -45,4 +45,4 @@
4545
"type": "opencollective",
4646
"url": "https://opencollective.com/proyecto26"
4747
}
48-
}
48+
}

0 commit comments

Comments
 (0)