From 2a4ac9788088aa5660116f0cecad0afb919b4570 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Wed, 1 Jul 2020 07:25:02 +0530 Subject: [PATCH] Add Java 8 API desugaring support. --- build.gradle | 8 ++++++++ gradle.properties | 9 --------- src/org/kde/kdeconnect/MyApplication.java | 5 ++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 14fe783c..a6880aa2 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,8 @@ android { minSdkVersion 14 targetSdkVersion 29 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + + multiDexEnabled true } dexOptions { javaMaxHeapSize "2g" @@ -27,6 +29,9 @@ android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 + + // Flag to enable support for the new language APIs + coreLibraryDesugaringEnabled true } sourceSets { main { @@ -130,6 +135,9 @@ dependencies { */ } + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9' + implementation 'androidx.multidex:multidex:2.0.1' + implementation 'androidx.media:media:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.preference:preference:1.1.1' diff --git a/gradle.properties b/gradle.properties index c87083bf..dbb7bf70 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,2 @@ android.enableJetifier=true android.useAndroidX=true -### -# This 'android.enableR8' property only matters when the current -# build variant has 'minifyEnabled true'. -# -# Set this to false to use ProGuard. -# Set this to true to use R8. -# -# Default: true -android.enableR8=false diff --git a/src/org/kde/kdeconnect/MyApplication.java b/src/org/kde/kdeconnect/MyApplication.java index caabcb66..51e23430 100644 --- a/src/org/kde/kdeconnect/MyApplication.java +++ b/src/org/kde/kdeconnect/MyApplication.java @@ -1,13 +1,12 @@ package org.kde.kdeconnect; -import android.app.Application; - import androidx.annotation.NonNull; import androidx.lifecycle.DefaultLifecycleObserver; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.ProcessLifecycleOwner; +import androidx.multidex.MultiDexApplication; -public class MyApplication extends Application { +public class MyApplication extends MultiDexApplication { private static class LifecycleObserver implements DefaultLifecycleObserver { private boolean inForeground = false;