From 4cb15f1efa141f423c9fa8da97e320cf04d4fae3 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 28 Dec 2020 13:57:09 -0600 Subject: [PATCH] Migrating projects to Androidx. --- HelloSharedPrefs/app/build.gradle | 16 ++++++++-------- .../android/hellosharedprefs/MainActivity.java | 4 ++-- .../app/src/main/res/layout/activity_main.xml | 8 ++++---- HelloSharedPrefs/build.gradle | 2 +- HelloSharedPrefs/gradle.properties | 2 ++ .../gradle/wrapper/gradle-wrapper.properties | 4 ++-- MaterialMe-Starter/app/build.gradle | 10 +++++----- .../android/materialme/MainActivity.java | 6 +++--- .../android/materialme/SportsAdapter.java | 2 +- .../app/src/main/res/layout/activity_main.xml | 2 +- MaterialMe-Starter/build.gradle | 2 +- MaterialMe-Starter/gradle.properties | 4 +++- .../gradle/wrapper/gradle-wrapper.properties | 4 ++-- PhoneNumberSpinner/app/build.gradle | 18 +++++++++--------- .../ExampleInstrumentedTest.java | 4 ++-- .../phonenumberspinner/MainActivity.java | 2 +- .../app/src/main/res/layout/activity_main.xml | 4 ++-- PhoneNumberSpinner/build.gradle | 2 +- PhoneNumberSpinner/gradle.properties | 2 ++ .../gradle/wrapper/gradle-wrapper.properties | 4 ++-- SimpleCalc/app/build.gradle | 12 ++++++------ SimpleCalc/build.gradle | 2 +- SimpleCalc/gradle.properties | 4 +++- .../gradle/wrapper/gradle-wrapper.properties | 4 ++-- 24 files changed, 66 insertions(+), 58 deletions(-) diff --git a/HelloSharedPrefs/app/build.gradle b/HelloSharedPrefs/app/build.gradle index f943273..a4dbd4c 100644 --- a/HelloSharedPrefs/app/build.gradle +++ b/HelloSharedPrefs/app/build.gradle @@ -1,14 +1,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 27 + compileSdkVersion 29 defaultConfig { applicationId "com.example.android.hellosharedprefs" minSdkVersion 16 - targetSdkVersion 27 + targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { release { @@ -20,9 +20,9 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.2' - 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' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.13' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' } diff --git a/HelloSharedPrefs/app/src/main/java/com/example/android/hellosharedprefs/MainActivity.java b/HelloSharedPrefs/app/src/main/java/com/example/android/hellosharedprefs/MainActivity.java index b7b08c8..5bc6e27 100644 --- a/HelloSharedPrefs/app/src/main/java/com/example/android/hellosharedprefs/MainActivity.java +++ b/HelloSharedPrefs/app/src/main/java/com/example/android/hellosharedprefs/MainActivity.java @@ -16,8 +16,8 @@ package com.example.android.hellosharedprefs; import android.graphics.drawable.ColorDrawable; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; diff --git a/HelloSharedPrefs/app/src/main/res/layout/activity_main.xml b/HelloSharedPrefs/app/src/main/res/layout/activity_main.xml index 289c2f2..5315f86 100644 --- a/HelloSharedPrefs/app/src/main/res/layout/activity_main.xml +++ b/HelloSharedPrefs/app/src/main/res/layout/activity_main.xml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - \ No newline at end of file + diff --git a/HelloSharedPrefs/build.gradle b/HelloSharedPrefs/build.gradle index 1a3d812..2426268 100644 --- a/HelloSharedPrefs/build.gradle +++ b/HelloSharedPrefs/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong diff --git a/HelloSharedPrefs/gradle.properties b/HelloSharedPrefs/gradle.properties index 743d692..8de5058 100644 --- a/HelloSharedPrefs/gradle.properties +++ b/HelloSharedPrefs/gradle.properties @@ -6,6 +6,8 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/HelloSharedPrefs/gradle/wrapper/gradle-wrapper.properties b/HelloSharedPrefs/gradle/wrapper/gradle-wrapper.properties index 9ccce64..dc2ef3d 100644 --- a/HelloSharedPrefs/gradle/wrapper/gradle-wrapper.properties +++ b/HelloSharedPrefs/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jul 02 14:40:58 PDT 2018 +#Mon Dec 28 13:39:37 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/MaterialMe-Starter/app/build.gradle b/MaterialMe-Starter/app/build.gradle index 0c41e29..6c0f893 100755 --- a/MaterialMe-Starter/app/build.gradle +++ b/MaterialMe-Starter/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 27 + compileSdkVersion 29 defaultConfig { applicationId "com.ngamolsky.android.materialme" minSdkVersion 15 - targetSdkVersion 27 + targetSdkVersion 29 versionCode 1 versionName "1.0" } @@ -20,7 +20,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - testImplementation 'junit:junit:4.12' - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support:recyclerview-v7:27.1.1' + testImplementation 'junit:junit:4.13' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' } diff --git a/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/MainActivity.java b/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/MainActivity.java index 50f6e9a..b3d890e 100755 --- a/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/MainActivity.java +++ b/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/MainActivity.java @@ -17,9 +17,9 @@ package com.example.android.materialme; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; diff --git a/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/SportsAdapter.java b/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/SportsAdapter.java index 73ef25d..331c291 100755 --- a/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/SportsAdapter.java +++ b/MaterialMe-Starter/app/src/main/java/com/example/android/materialme/SportsAdapter.java @@ -17,7 +17,7 @@ package com.example.android.materialme; import android.content.Context; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/MaterialMe-Starter/app/src/main/res/layout/activity_main.xml b/MaterialMe-Starter/app/src/main/res/layout/activity_main.xml index 97aa058..3588262 100755 --- a/MaterialMe-Starter/app/src/main/res/layout/activity_main.xml +++ b/MaterialMe-Starter/app/src/main/res/layout/activity_main.xml @@ -24,7 +24,7 @@ android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.android.materialme.MainActivity"> - - - + diff --git a/PhoneNumberSpinner/build.gradle b/PhoneNumberSpinner/build.gradle index e6b32bc..2426268 100644 --- a/PhoneNumberSpinner/build.gradle +++ b/PhoneNumberSpinner/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong diff --git a/PhoneNumberSpinner/gradle.properties b/PhoneNumberSpinner/gradle.properties index aac7c9b..9e6fce1 100644 --- a/PhoneNumberSpinner/gradle.properties +++ b/PhoneNumberSpinner/gradle.properties @@ -9,6 +9,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. diff --git a/PhoneNumberSpinner/gradle/wrapper/gradle-wrapper.properties b/PhoneNumberSpinner/gradle/wrapper/gradle-wrapper.properties index 461e904..810187e 100644 --- a/PhoneNumberSpinner/gradle/wrapper/gradle-wrapper.properties +++ b/PhoneNumberSpinner/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Nov 14 15:42:29 PST 2017 +#Mon Dec 28 13:52:51 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/SimpleCalc/app/build.gradle b/SimpleCalc/app/build.gradle index f9c1392..a649be1 100644 --- a/SimpleCalc/app/build.gradle +++ b/SimpleCalc/app/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 27 + compileSdkVersion 29 defaultConfig { applicationId "com.example.android.SimpleCalc" minSdkVersion 15 - targetSdkVersion 27 + targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } buildTypes { release { @@ -21,8 +21,8 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support:support-annotations:27.1.1' - testImplementation 'junit:junit:4.12' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.annotation:annotation:1.1.0' + testImplementation 'junit:junit:4.13' testImplementation 'org.hamcrest:hamcrest-library:1.3' } diff --git a/SimpleCalc/build.gradle b/SimpleCalc/build.gradle index 55db43f..c95742a 100644 --- a/SimpleCalc/build.gradle +++ b/SimpleCalc/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/SimpleCalc/gradle.properties b/SimpleCalc/gradle.properties index 1d3591c..acf164f 100644 --- a/SimpleCalc/gradle.properties +++ b/SimpleCalc/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # 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 \ No newline at end of file +# org.gradle.parallel=true +android.enableJetifier=true +android.useAndroidX=true diff --git a/SimpleCalc/gradle/wrapper/gradle-wrapper.properties b/SimpleCalc/gradle/wrapper/gradle-wrapper.properties index 51176f7..5310389 100644 --- a/SimpleCalc/gradle/wrapper/gradle-wrapper.properties +++ b/SimpleCalc/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Sep 11 11:19:59 PDT 2018 +#Mon Dec 28 13:55:42 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip