diff --git a/.circleci/config.yml b/.circleci/config.yml index 31cacf9561..e5c091c583 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,7 +47,7 @@ jobs: steps: - checkout - run: - command: ./gradlew clean build -b capacitor/build.gradle + command: ./gradlew clean build -b capacitor/build.gradle -Pandroid.useAndroidX=true -Pandroid.enableJetifier=true working_directory: /tmp/workspace/android workflows: diff --git a/android-template/app/build.gradle b/android-template/app/build.gradle index d930d899cd..3d25b4adc3 100644 --- a/android-template/app/build.gradle +++ b/android-template/app/build.gradle @@ -8,7 +8,7 @@ android { targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -29,11 +29,11 @@ repositories { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' implementation project(':capacitor-android') testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation project(':capacitor-cordova-android-plugins') } diff --git a/android-template/app/src/main/AndroidManifest.xml b/android-template/app/src/main/AndroidManifest.xml index de4589027e..9e28b68d49 100644 --- a/android-template/app/src/main/AndroidManifest.xml +++ b/android-template/app/src/main/AndroidManifest.xml @@ -32,7 +32,7 @@ diff --git a/android-template/app/src/main/res/layout/activity_main.xml b/android-template/app/src/main/res/layout/activity_main.xml index 03c6eedd96..b5ad138701 100644 --- a/android-template/app/src/main/res/layout/activity_main.xml +++ b/android-template/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - + diff --git a/android-template/gradle.properties b/android-template/gradle.properties index aac7c9b461..2dbcb07109 100644 --- a/android-template/gradle.properties +++ b/android-template/gradle.properties @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +# Supports AndroidX +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/android/capacitor/build.gradle b/android/capacitor/build.gradle index c7ac7b3822..3710c0c0a9 100644 --- a/android/capacitor/build.gradle +++ b/android/capacitor/build.gradle @@ -21,7 +21,7 @@ android { targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -42,15 +42,15 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:support-compat:28.0.0' - implementation 'com.android.support:design:28.0.0' - implementation 'com.android.support:customtabs:28.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'androidx.core:core:1.2.0' + implementation 'com.google.android.material:material:1.1.0-rc02' + implementation 'androidx.browser:browser:1.2.0' implementation 'com.google.firebase:firebase-messaging:18.0.0' implementation 'com.google.android.gms:play-services-location:16.0.0' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' implementation 'org.apache.cordova:framework:7.0.0' } diff --git a/android/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java b/android/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java index 2df2882eaa..302326d185 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java +++ b/android/capacitor/src/main/java/com/getcapacitor/BridgeActivity.java @@ -4,9 +4,11 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.webkit.WebView; + +import androidx.appcompat.app.AppCompatActivity; + import com.getcapacitor.android.R; import com.getcapacitor.cordova.MockCordovaInterfaceImpl; import com.getcapacitor.cordova.MockCordovaWebViewImpl; diff --git a/android/capacitor/src/main/java/com/getcapacitor/Dialogs.java b/android/capacitor/src/main/java/com/getcapacitor/Dialogs.java index 97bbf2e14f..8022e7c68f 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/Dialogs.java +++ b/android/capacitor/src/main/java/com/getcapacitor/Dialogs.java @@ -6,10 +6,10 @@ import android.content.DialogInterface; import android.os.Handler; import android.os.Looper; -import android.support.v4.app.ActivityCompat; -import android.support.v7.app.AppCompatActivity; import android.widget.EditText; +import androidx.appcompat.app.AppCompatActivity; + import com.getcapacitor.ui.ModalsBottomSheetDialogFragment; import org.json.JSONException; diff --git a/android/capacitor/src/main/java/com/getcapacitor/Plugin.java b/android/capacitor/src/main/java/com/getcapacitor/Plugin.java index 94e325b8e8..76af8b86d7 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/Plugin.java +++ b/android/capacitor/src/main/java/com/getcapacitor/Plugin.java @@ -6,9 +6,11 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; -import android.support.v4.app.ActivityCompat; -import android.support.v7.app.AppCompatActivity; import android.util.Log; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; + import org.json.JSONException; import org.json.JSONObject; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Browser.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Browser.java index d10698b6af..ceb8112f29 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Browser.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Browser.java @@ -5,12 +5,14 @@ import android.graphics.Color; import android.net.Uri; import android.os.Bundle; -import android.support.customtabs.CustomTabsCallback; -import android.support.customtabs.CustomTabsClient; -import android.support.customtabs.CustomTabsIntent; -import android.support.customtabs.CustomTabsServiceConnection; -import android.support.customtabs.CustomTabsSession; import android.util.Log; + +import androidx.browser.customtabs.CustomTabsCallback; +import androidx.browser.customtabs.CustomTabsClient; +import androidx.browser.customtabs.CustomTabsIntent; +import androidx.browser.customtabs.CustomTabsServiceConnection; +import androidx.browser.customtabs.CustomTabsSession; + import com.getcapacitor.JSArray; import com.getcapacitor.JSObject; import com.getcapacitor.NativePlugin; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java index 6a4a5e091f..f8eed9732e 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Camera.java @@ -10,9 +10,11 @@ import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; -import android.support.v4.content.FileProvider; import android.util.Base64; import android.util.Log; + +import androidx.core.content.FileProvider; + import com.getcapacitor.Dialogs; import com.getcapacitor.FileUtils; import com.getcapacitor.JSObject; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java index 21f1eb25f3..828e38efb5 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java @@ -1,20 +1,7 @@ package com.getcapacitor.plugin; -import android.annotation.SuppressLint; import android.app.Activity; -import android.app.Dialog; -import android.graphics.Color; -import android.support.annotation.NonNull; -import android.support.design.widget.BottomSheetBehavior; -import android.support.design.widget.BottomSheetDialogFragment; -import android.support.design.widget.CoordinatorLayout; -import android.util.Log; -import android.view.View; -import android.view.Window; -import android.widget.LinearLayout; -import android.widget.TextView; - -import com.getcapacitor.Bridge; + import com.getcapacitor.Dialogs; import com.getcapacitor.JSArray; import com.getcapacitor.JSObject; @@ -24,11 +11,6 @@ import com.getcapacitor.PluginMethod; import com.getcapacitor.ui.ModalsBottomSheetDialogFragment; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.List; - /** * Common popup modals */ diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Permissions.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Permissions.java index 9d9efc1477..59ae8e20ef 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Permissions.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Permissions.java @@ -2,8 +2,9 @@ import android.Manifest; import android.content.pm.PackageManager; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.content.ContextCompat; + +import androidx.core.app.NotificationManagerCompat; +import androidx.core.content.ContextCompat; import com.getcapacitor.JSObject; import com.getcapacitor.NativePlugin; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java index 2795687441..6e74621150 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/PushNotifications.java @@ -10,11 +10,11 @@ import android.os.Build; import android.os.Bundle; import android.service.notification.StatusBarNotification; -import android.support.v4.app.NotificationCompat; +import androidx.core.app.NotificationCompat; import android.net.Uri; - import android.util.Log; + import com.getcapacitor.Bridge; import com.getcapacitor.JSArray; import com.getcapacitor.JSObject; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Share.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Share.java index d9c5d37537..70d8ab877d 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Share.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Share.java @@ -2,9 +2,10 @@ import android.content.Intent; import android.net.Uri; -import android.support.v4.content.FileProvider; import android.webkit.MimeTypeMap; +import androidx.core.content.FileProvider; + import com.getcapacitor.NativePlugin; import com.getcapacitor.Plugin; import com.getcapacitor.PluginCall; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTask.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTask.java index 3be2d03917..c08c88a65a 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTask.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTask.java @@ -5,8 +5,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.support.v4.content.LocalBroadcastManager; -import android.util.Log; + +import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.getcapacitor.Bridge; import com.getcapacitor.JSObject; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTaskService.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTaskService.java index 95ed6d2025..460da214f8 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTaskService.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/background/BackgroundTaskService.java @@ -2,8 +2,10 @@ import android.app.IntentService; import android.content.Intent; -import android.support.v4.content.LocalBroadcastManager; import android.util.Log; + +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + import com.getcapacitor.LogUtils; public class BackgroundTaskService extends IntentService { diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java index e39025301d..d1f41d4d88 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/camera/CameraUtils.java @@ -3,9 +3,10 @@ import android.app.Activity; import android.net.Uri; import android.os.Environment; -import android.support.v4.content.FileProvider; import android.util.Log; +import androidx.core.content.FileProvider; + import com.getcapacitor.LogUtils; import java.io.File; diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/LocalNotificationManager.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/LocalNotificationManager.java index 20289a40c9..e128c69f72 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/LocalNotificationManager.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/notification/LocalNotificationManager.java @@ -10,12 +10,14 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.app.RemoteInput; import android.util.Log; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; +import androidx.core.app.RemoteInput; + import com.getcapacitor.JSObject; import com.getcapacitor.LogUtils; import com.getcapacitor.PluginCall; @@ -27,6 +29,8 @@ import java.util.Date; import java.util.List; +import static androidx.core.app.NotificationCompat.VISIBILITY_PRIVATE; + /** * Contains implementations for all notification actions */ diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/util/AssetUtil.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/util/AssetUtil.java index 78392b795d..d38664649a 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/util/AssetUtil.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/util/AssetUtil.java @@ -8,8 +8,10 @@ import android.graphics.BitmapFactory; import android.net.Uri; import android.os.StrictMode; -import android.support.v4.content.FileProvider; import android.util.Log; + +import androidx.core.content.FileProvider; + import com.getcapacitor.LogUtils; import java.io.File; diff --git a/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java b/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java index 4a3c3c3e11..f3ef5b6108 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java +++ b/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java @@ -3,18 +3,21 @@ import android.annotation.SuppressLint; import android.app.Dialog; import android.graphics.Color; -import android.support.annotation.NonNull; -import android.support.design.widget.BottomSheetBehavior; -import android.support.design.widget.BottomSheetDialogFragment; -import android.support.design.widget.CoordinatorLayout; import android.util.Log; import android.view.View; import android.view.Window; import android.widget.LinearLayout; import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.coordinatorlayout.widget.CoordinatorLayout; + import com.getcapacitor.JSArray; import com.getcapacitor.JSObject; import com.getcapacitor.LogUtils; +import com.google.android.material.bottomsheet.BottomSheetBehavior; +import com.google.android.material.bottomsheet.BottomSheetDialogFragment; + import org.json.JSONException; import org.json.JSONObject; diff --git a/android/capacitor/src/main/res/layout/bridge_layout_main.xml b/android/capacitor/src/main/res/layout/bridge_layout_main.xml index 1a6f336cd7..12f0b8fc88 100644 --- a/android/capacitor/src/main/res/layout/bridge_layout_main.xml +++ b/android/capacitor/src/main/res/layout/bridge_layout_main.xml @@ -1,5 +1,5 @@ - - + diff --git a/android/gradle.properties b/android/gradle.properties index aac7c9b461..2dbcb07109 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +# Supports AndroidX +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/example/android/app/src/main/res/layout/activity_main.xml b/example/android/app/src/main/res/layout/activity_main.xml index 980b7ade86..f5d3888774 100644 --- a/example/android/app/src/main/res/layout/activity_main.xml +++ b/example/android/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - + diff --git a/example/android/gradle.properties b/example/android/gradle.properties index aac7c9b461..2dbcb07109 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +# Supports AndroidX +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/plugin-template/android/gradle.properties b/plugin-template/android/gradle.properties index aac7c9b461..2dbcb07109 100644 --- a/plugin-template/android/gradle.properties +++ b/plugin-template/android/gradle.properties @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +# Supports AndroidX +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/plugin-template/android/src/main/res/layout/bridge_layout_main.xml b/plugin-template/android/src/main/res/layout/bridge_layout_main.xml index b69e589a91..56fec1546a 100644 --- a/plugin-template/android/src/main/res/layout/bridge_layout_main.xml +++ b/plugin-template/android/src/main/res/layout/bridge_layout_main.xml @@ -1,5 +1,5 @@ - - +