From e4d3e85111e09e738ac0727142942d245d39fd5f Mon Sep 17 00:00:00 2001 From: Parmesh Mahore Date: Sat, 28 Sep 2024 23:26:26 +0530 Subject: [PATCH 1/3] libs version update to support latest android studio --- .idea/compiler.xml | 2 +- app/build.gradle | 35 +++++++-------- app/src/main/AndroidManifest.xml | 3 +- .../PerformSingleNetworkRequestViewModel.kt | 2 +- build.gradle | 4 +- gradle.properties | 3 ++ gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 44 +++++++++++++------ 8 files changed, 59 insertions(+), 38 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8a..b86273d9 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 09eda296..c9c4fa87 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,15 +4,13 @@ apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-parcelize' android { - compileSdkVersion 32 + compileSdkVersion 34 defaultConfig { applicationId "com.lukaslechner.coroutineusecasesonandroid" - minSdkVersion 21 - targetSdkVersion 32 versionCode 1 versionName "1.0" - + minSdk 26 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -49,12 +47,13 @@ android { checkReleaseBuilds false } } + namespace 'com.lukaslechner.coroutineusecasesonandroid' } dependencies { - def lifecycle_version = "2.4.1" - def coroutines_version = "1.6.3" + def lifecycle_version = "2.8.6" + def coroutines_version = "1.8.1" implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" @@ -62,24 +61,24 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'com.google.android.material:material:1.12.0' - implementation 'androidx.core:core-ktx:1.8.0' - implementation "androidx.activity:activity-ktx:1.4.0" + implementation 'androidx.core:core-ktx:1.13.1' + implementation "androidx.activity:activity-ktx:1.9.2" - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'androidx.recyclerview:recyclerview:1.2.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'androidx.cardview:cardview:1.0.0' implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" - implementation 'com.squareup.retrofit2:retrofit:2.9.0' + implementation 'com.squareup.retrofit2:retrofit:2.11.0' implementation 'com.squareup.retrofit2:adapter-rxjava2:2.7.1' - implementation 'com.google.code.gson:gson:2.8.9' - implementation 'com.squareup.retrofit2:converter-gson:2.9.0' + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'com.squareup.retrofit2:converter-gson:2.11.0' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxjava:2.2.19' @@ -87,13 +86,13 @@ dependencies { implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" - def work_manager_version = "2.7.1" + def work_manager_version = "2.9.1" implementation "androidx.work:work-runtime:$work_manager_version" implementation "androidx.work:work-runtime-ktx:$work_manager_version" implementation 'com.jakewharton.timber:timber:5.0.1' - def room_version = "2.4.2" + def room_version = "2.6.1" implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" kapt "androidx.room:room-compiler:$room_version" @@ -104,7 +103,7 @@ dependencies { testImplementation project(path: ':app') testImplementation 'junit:junit:4.13.2' - testImplementation 'androidx.arch.core:core-testing:2.1.0' + testImplementation 'androidx.arch.core:core-testing:2.2.0' testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" testImplementation 'com.squareup.retrofit2:retrofit-mock:2.7.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8601ea8a..b8ebebd1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + () { fun performSingleNetworkRequest() { - + uiState.value = UiState.Error("something went wrong!") } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index e362a613..f24196ee 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.21' + ext.kotlin_version = '1.9.21' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle.properties b/gradle.properties index 23339e0d..9e73ebcb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,6 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c684..09523c0e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,12 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. From 00293fa961ca844583a3d03b933838ff564f9065 Mon Sep 17 00:00:00 2001 From: Parmesh Mahore Date: Fri, 25 Oct 2024 19:32:59 +0530 Subject: [PATCH 2/3] review comment addressed by reverting added code --- .../coroutines/usecase1/PerformSingleNetworkRequestViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/usecases/coroutines/usecase1/PerformSingleNetworkRequestViewModel.kt b/app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/usecases/coroutines/usecase1/PerformSingleNetworkRequestViewModel.kt index 989e6edf..ae782c7e 100644 --- a/app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/usecases/coroutines/usecase1/PerformSingleNetworkRequestViewModel.kt +++ b/app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/usecases/coroutines/usecase1/PerformSingleNetworkRequestViewModel.kt @@ -8,6 +8,6 @@ class PerformSingleNetworkRequestViewModel( ) : BaseViewModel() { fun performSingleNetworkRequest() { - uiState.value = UiState.Error("something went wrong!") + } } \ No newline at end of file From 2d36b1d38146d751289de7e2f759a7e2223a72a5 Mon Sep 17 00:00:00 2001 From: Parmesh Mahore Date: Sat, 26 Oct 2024 09:54:47 +0530 Subject: [PATCH 3/3] Update build_and_test.yml updated jdk version to 17 --- .github/workflows/build_and_test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 26149c71..b5bc21fb 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -10,13 +10,14 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set Up JDK - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 1.11 + distribution: 'temurin' + java-version: '17' - name: Run Tests run: ./gradlew test - name: Build Project - run: ./gradlew assemble \ No newline at end of file + run: ./gradlew assemble