Skip to content

Commit aa129af

Browse files
authored
Merge pull request #666 from journeyapps/update-readme-sdk-version
Update notes on minSdkVersion
2 parents 24d0294 + 90b5db5 commit aa129af

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ Features:
1313

1414
A sample application is available in [Releases](https://github.com/journeyapps/zxing-android-embedded/releases).
1515

16-
By default, Android SDK 24+ is required because of `zxing:core` 3.4.0. To support SDK 14+, see [Older SDK versions](#older-sdk-versions).
16+
By default, Android SDK 24+ is required because of `zxing:core` 3.4.x.
17+
SDK 19+ is supported with additional configuration, see [Older SDK versions](#older-sdk-versions).
1718

1819
## Adding aar dependency with Gradle
1920

20-
From version 4.x, only Android SDK 24+ is supported by default, and androidx is required.
21-
2221
Add the following to your `build.gradle` file:
2322

2423
```groovy
24+
// Config for SDK 24+
25+
2526
repositories {
2627
mavenCentral()
2728
}
@@ -33,11 +34,10 @@ dependencies {
3334

3435
## Older SDK versions
3536

36-
By default, only SDK 24+ is supported, even though the library specifies 19 as the minimum version.
37-
No guarantees are made on support for SDK versions below 24 - you'll have to test to make sure it's compatible.
37+
By default, only SDK 24+ will work, even though the library specifies 19 as the minimum version.
3838

39-
SDK versions 19 - 23 should also work, but one of the changes changes below are required,
40-
and this is not routinely tested.
39+
For SDK versions 19+, one of the changes changes below are required.
40+
Some older SDK versions below 19 may work, but this is not tested or supported.
4141

4242
### Option 1. Downgrade zxing:core to 3.3.0
4343

@@ -56,13 +56,40 @@ dependencies {
5656

5757
This option does not require changing library versions, but may complicate the build process.
5858

59+
This requires Android Gradle Plugin version 4.0.0 or later.
60+
5961
See [Java 8+ API desugaring support](https://developer.android.com/studio/write/java8-support#library-desugaring).
6062

63+
Example for SDK 21+:
64+
65+
```groovy
66+
android {
67+
defaultConfig {
68+
minSdkVersion 21
69+
}
70+
71+
compileOptions {
72+
// Flag to enable support for the new language APIs
73+
coreLibraryDesugaringEnabled true
74+
// Sets Java compatibility to Java 8
75+
sourceCompatibility JavaVersion.VERSION_1_8
76+
targetCompatibility JavaVersion.VERSION_1_8
77+
}
78+
}
79+
80+
dependencies {
81+
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
82+
83+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
84+
}
85+
```
86+
87+
SDK 19+ additionally requires multiDex. In addition to these gradle config changes, the Application
88+
class must also be changed. See for details: [Configure your app for multidex](https://developer.android.com/studio/build/multidex#mdex-gradle).
89+
6190
```groovy
6291
android {
6392
defaultConfig {
64-
// Important: multidex must be enabled
65-
// https://developer.android.com/studio/build/multidex#mdex-gradle
6693
multiDexEnabled true
6794
minSdkVersion 19
6895
}
@@ -77,6 +104,8 @@ android {
77104
}
78105
79106
dependencies {
107+
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
108+
80109
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
81110
implementation "androidx.multidex:multidex:2.0.1"
82111
}

0 commit comments

Comments
 (0)