Skip to content

Commit 6bbc3c8

Browse files
authored
Add desugaring to getting-started (#5284)
1 parent 882ff6f commit 6bbc3c8

File tree

1 file changed

+24
-6
lines changed
  • src/fragments/start/getting-started/android

1 file changed

+24
-6
lines changed

src/fragments/start/getting-started/android/setup.mdx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,30 @@ You should now have an empty Android project without Amplify.
8484

8585
3. Under **Gradle Scripts**, open **build.gradle (Module :app)**.
8686

87-
Update the `dependencies` block in your file with the following lines:
88-
89-
```groovy
90-
implementation 'com.amplifyframework:aws-api:ANDROID_VERSION'
91-
implementation 'com.amplifyframework:aws-datastore:ANDROID_VERSION'
92-
```
87+
Add the following lines:
88+
89+
```groovy
90+
android {
91+
compileOptions {
92+
// Support for Java 8 features
93+
coreLibraryDesugaringEnabled true
94+
sourceCompatibility JavaVersion.VERSION_1_8
95+
targetCompatibility JavaVersion.VERSION_1_8
96+
}
97+
}
98+
99+
dependencies {
100+
// Amplify API and Datastore dependencies
101+
implementation 'com.amplifyframework:aws-api:ANDROID_VERSION'
102+
implementation 'com.amplifyframework:aws-datastore:ANDROID_VERSION'
103+
104+
// Support for Java 8 features
105+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
106+
}
107+
```
108+
109+
- Set `coreLibraryDesugaringEnabled`, `sourceCompatibility`, and `targetCompatibility` to allow your application to make use of Java 8 features like Lambda expressions
110+
- Add Amplify API, Datastore, and Desugaring libraries to the `dependencies` block
93111

94112
4. Run **Gradle Sync**
95113

0 commit comments

Comments
 (0)