From 4cada7963a286f3d32eb1e300d9e686bc8f3f71d Mon Sep 17 00:00:00 2001 From: Darshan Parajuli Date: Sun, 22 Nov 2020 12:07:10 -0800 Subject: [PATCH] Update target sdk and compile sdk to 30 --- app/build.gradle | 16 ++++++++------- .../java/com/dp/logcatapp/util/SuCommander.kt | 6 ++++-- build.gradle | 20 +++++++++---------- collections/build.gradle | 1 + logcat/build.gradle | 5 +++-- logger/build.gradle | 1 + 6 files changed, 28 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5342b43..758ad08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,13 +6,13 @@ apply plugin: 'kotlin-kapt' def fileProvider = "file_provider" android { - compileSdkVersion 29 - buildToolsVersion "29.0.3" + compileSdkVersion 30 + buildToolsVersion "30.0.3" defaultConfig { applicationId "com.dp.logcatapp" minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 32 versionName "1.7.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -79,16 +79,18 @@ dependencies { implementation "com.google.android.material:material:$material_version" implementation "androidx.preference:preference-ktx:$preference_version" implementation "androidx.legacy:legacy-preference-v14:$legacy_preference_v14_version" - implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_common_java8_version" - implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_extensions_version" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_viewmodel_ktx_version" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_runtime_version" + implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_ext" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version" implementation "androidx.room:room-runtime:$room_version" implementation "androidx.documentfile:documentfile:$documentfile_version" kapt "androidx.room:room-compiler:$room_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_core_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_android_version" + testImplementation "junit:junit:$junit_version" androidTestImplementation "androidx.test:runner:$runner_version" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version" diff --git a/app/src/main/java/com/dp/logcatapp/util/SuCommander.kt b/app/src/main/java/com/dp/logcatapp/util/SuCommander.kt index d8ca85c..c2e2486 100644 --- a/app/src/main/java/com/dp/logcatapp/util/SuCommander.kt +++ b/app/src/main/java/com/dp/logcatapp/util/SuCommander.kt @@ -1,8 +1,10 @@ package com.dp.logcatapp.util +import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.withContext import java.io.BufferedReader import java.io.BufferedWriter import java.io.InputStreamReader @@ -21,7 +23,7 @@ class SuCommander(private val cmd: String) { suspend fun run() = coroutineScope { try { val processBuilder = ProcessBuilder("su") - val process = processBuilder.start() + val process = withContext(IO) { processBuilder.start() } val stdoutWriter = BufferedWriter(OutputStreamWriter(process.outputStream)) val stdinReader = BufferedReader(InputStreamReader(process.inputStream)) @@ -65,7 +67,7 @@ class SuCommander(private val cmd: String) { stdoutWriter.writeCmd("exit") - process.waitFor() + withContext(IO) { process.waitFor() } process.destroy() stderrReaderResult.await() diff --git a/build.gradle b/build.gradle index 578f5e7..794d6df 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.4.10' + ext.kotlin_version = '1.4.31' repositories { google() + mavenCentral() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:4.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong @@ -18,6 +19,7 @@ buildscript { allprojects { repositories { google() + mavenCentral() jcenter() } } @@ -27,20 +29,18 @@ ext { constraint_layout_version = "2.0.4" core_ktx_version = "1.3.2" documentfile_version = "1.0.1" - fragment_ktx_version = "1.2.5" + fragment_ktx_version = "1.3.0" kotlin_coroutines_android_version = "1.3.7" kotlin_coroutines_core_version = "1.3.7" legacy_preference_v14_version = "1.0.0" - lifecycle_common_java8_version = "2.2.0" - lifecycle_extensions_version = "2.2.0" - lifecycle_runtime_version = "2.2.0" - lifecycle_viewmodel_ktx_version = "2.2.0" - material_version = "1.2.1" + lifecycle_ext = "2.2.0" + lifecycle_version = "2.3.0" + material_version = "1.3.0" preference_version = "1.1.1" - room_version = "2.2.5" + room_version = "2.2.6" // test dependencies - junit_version = "4.13" + junit_version = "4.13.2" runner_version = "1.3.0" espresso_core_version = "3.3.0" } diff --git a/collections/build.gradle b/collections/build.gradle index 5657985..86e6105 100644 --- a/collections/build.gradle +++ b/collections/build.gradle @@ -29,6 +29,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "androidx.appcompat:appcompat:$appcompat_version" + testImplementation "junit:junit:$junit_version" androidTestImplementation "androidx.test:runner:$runner_version" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version" diff --git a/logcat/build.gradle b/logcat/build.gradle index 22db67d..e94eb35 100644 --- a/logcat/build.gradle +++ b/logcat/build.gradle @@ -34,9 +34,10 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" implementation "androidx.appcompat:appcompat:$appcompat_version" - implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_common_java8_version" - implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_extensions_version" + implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" + implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_ext" implementation "androidx.documentfile:documentfile:$documentfile_version" + testImplementation "junit:junit:$junit_version" androidTestImplementation "androidx.test:runner:$runner_version" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version" diff --git a/logger/build.gradle b/logger/build.gradle index a8392dd..4c37175 100644 --- a/logger/build.gradle +++ b/logger/build.gradle @@ -30,6 +30,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + testImplementation "junit:junit:$junit_version" androidTestImplementation "androidx.test:runner:$runner_version" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version"