From b12fe238f40fe6d0599d04cdad18f0bed6f427bd Mon Sep 17 00:00:00 2001 From: Maksim Lin Date: Mon, 14 Sep 2026 19:39:58 +1000 Subject: [PATCH 1/3] get app building with updated SDK, deps --- app/build.gradle | 107 ------------------ app/build.gradle.kts | 107 ++++++++++++++++++ .../com/manichord/mgit/dialogs/ErrorDialog.kt | 5 +- .../mgit/repolist/RepoListActivity.java | 26 ++--- build.gradle | 28 ----- build.gradle.kts | 22 ++++ gradle.properties | 5 + gradle/wrapper/gradle-wrapper.properties | 3 +- settings.gradle | 1 - settings.gradle.kts | 1 + 10 files changed, 153 insertions(+), 152 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 824a8ac4..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,107 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -android { - compileSdkVersion 31 - buildToolsVersion '30.0.3' - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - - defaultConfig { - applicationId "com.manichord.mgit" - minSdkVersion 21 - targetSdkVersion 31 - - vectorDrawables.useSupportLibrary = true - - versionCode 240 - versionName "1.7.0" - } - - buildFeatures { - dataBinding true - } - - lintOptions { - abortOnError false - } - - signingConfigs { - if (project.hasProperty('special')) { - release { - keyAlias alias - keyPassword password - storeFile file(keystore) - storePassword password - } - } else { - release { - keyAlias '' - keyPassword '' - storeFile file('/empty') - storePassword '' - } - } - } - - buildTypes { - release { - signingConfig signingConfigs.release - } - } -} - -configurations.all { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - if (details.requested.group == "com.jcraft" && details.requested.name == "jsch") { - details.useTarget("com.github.mwiede:jsch:0.2.0") - } - - } - exclude module: 'httpclient' -} - - -dependencies { - def supportLib_version = "28.0.0" - def lifecycle_version = "1.1.1" - - def acraVersion = '5.8.4' - - implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' - implementation 'androidx.fragment:fragment:1.4.0' - implementation 'androidx.annotation:annotation:1.3.0' - implementation 'androidx.appcompat:appcompat:1.4.0' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.recyclerview:recyclerview:1.2.1' - implementation 'androidx.vectordrawable:vectordrawable:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.2' - - // ViewModel and LiveData - implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - kapt 'androidx.lifecycle:lifecycle-compiler:2.4.0' - - implementation 'com.jakewharton.timber:timber:4.5.1' - implementation 'com.github.mwiede:jsch:0.2.0' - implementation 'commons-io:commons-io:2.5' - implementation 'org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r' - implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' - implementation 'com.scottyab:secure-preferences-lib:0.1.7' - implementation 'org.conscrypt:conscrypt-android:2.5.2' - implementation 'org.bouncycastle:bcprov-jdk15on:1.70' - - implementation "ch.acra:acra-mail:$acraVersion" - implementation "ch.acra:acra-dialog:$acraVersion" - - debugImplementation 'com.facebook.stetho:stetho:1.5.0' - debugImplementation 'com.facebook.stetho:stetho-timber:1.5.0' - testImplementation 'junit:junit:4.12' - testImplementation 'org.robolectric:robolectric:3.5' - testImplementation 'org.robolectric:shadows-support-v4:3.4-rc2' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..684860e0 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,107 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.jetbrains.kotlin.kapt") +} + +android { + namespace = "me.sheimi.sgit" + compileSdk = 36 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = "1.8" + } + + defaultConfig { + applicationId = "com.manichord.mgit" + minSdk = 21 + targetSdk = 31 + + vectorDrawables.useSupportLibrary = true + + versionCode = 240 + versionName = "1.7.0" + } + + buildFeatures { + dataBinding = true + buildConfig = true + } + + lint { + abortOnError = false + } + + signingConfigs { + create("release") { + if (project.hasProperty("special")) { + keyAlias = project.property("alias") as String + keyPassword = project.property("password") as String + storeFile = file(project.property("keystore") as String) + storePassword = project.property("password") as String + } else { + keyAlias = "" + keyPassword = "" + storeFile = file("/empty") + storePassword = "" + } + } + } + + buildTypes { + getByName("release") { + signingConfig = signingConfigs.getByName("release") + } + } +} + +configurations.all { + resolutionStrategy.eachDependency { + if (requested.group == "com.jcraft" && requested.name == "jsch") { + useTarget("com.github.mwiede:jsch:0.2.0") + } + } + exclude(group = "org.apache.httpcomponents", module = "httpclient") +} + +dependencies { + val acraVersion = "5.8.4" + + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation("androidx.fragment:fragment:1.4.0") + implementation("androidx.annotation:annotation:1.3.0") + implementation("androidx.appcompat:appcompat:1.4.0") + implementation("com.google.android.material:material:1.4.0") + implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation("androidx.vectordrawable:vectordrawable:1.1.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.2") + + // ViewModel and LiveData + implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") + kapt("androidx.lifecycle:lifecycle-compiler:2.4.0") + + implementation("com.jakewharton.timber:timber:4.5.1") + implementation("com.github.mwiede:jsch:0.2.0") + implementation("commons-io:commons-io:2.5") + implementation("org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r") + implementation("com.nostra13.universalimageloader:universal-image-loader:1.9.5") + implementation("com.scottyab:secure-preferences-lib:0.1.7") + // 2.6.0+ ships 16 KB page-aligned native libs (built with NDK r27, minSdk 21). + // Older versions (<= 2.5.x) have 4 KB LOAD alignment and fail Play's 16 KB check. + implementation("org.conscrypt:conscrypt-android:2.7.0") + implementation("org.bouncycastle:bcprov-jdk15on:1.70") + + implementation("ch.acra:acra-mail:$acraVersion") + implementation("ch.acra:acra-dialog:$acraVersion") + + debugImplementation("com.facebook.stetho:stetho:1.5.0") + debugImplementation("com.facebook.stetho:stetho-timber:1.5.0") + testImplementation("junit:junit:4.12") + testImplementation("org.robolectric:robolectric:3.5") + testImplementation("org.robolectric:shadows-support-v4:3.4-rc2") +} diff --git a/app/src/main/java/com/manichord/mgit/dialogs/ErrorDialog.kt b/app/src/main/java/com/manichord/mgit/dialogs/ErrorDialog.kt index f19577c9..84461065 100644 --- a/app/src/main/java/com/manichord/mgit/dialogs/ErrorDialog.kt +++ b/app/src/main/java/com/manichord/mgit/dialogs/ErrorDialog.kt @@ -5,7 +5,7 @@ import android.app.Dialog import android.os.Bundle import androidx.annotation.StringRes import android.widget.Button -import kotlinx.android.synthetic.main.dialog_error.view.* +import android.widget.TextView import me.sheimi.android.views.SheimiDialogFragment import me.sheimi.sgit.BuildConfig import me.sheimi.sgit.R @@ -32,7 +32,8 @@ class ErrorDialog : SheimiDialogFragment() { } else -> "" } - layout.error_message.setText(getString(mErrorRes) + "\n" + details) + val errorMessage = layout.findViewById(R.id.error_message) + errorMessage.text = getString(mErrorRes) + "\n" + details builder.setView(layout) diff --git a/app/src/main/java/com/manichord/mgit/repolist/RepoListActivity.java b/app/src/main/java/com/manichord/mgit/repolist/RepoListActivity.java index 4912a61b..ec448ea4 100644 --- a/app/src/main/java/com/manichord/mgit/repolist/RepoListActivity.java +++ b/app/src/main/java/com/manichord/mgit/repolist/RepoListActivity.java @@ -158,19 +158,19 @@ public boolean onCreateOptionsMenu(Menu menu) { @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent; - switch (item.getItemId()) { - case R.id.action_new: - showCloneView(); - return true; - case R.id.action_import_repo: - intent = new Intent(this, ImportRepositoryActivity.class); - startActivityForResult(intent, REQUEST_IMPORT_REPO); - forwardTransition(); - return true; - case R.id.action_settings: - intent = new Intent(this, UserSettingsActivity.class); - startActivity(intent); - return true; + int itemId = item.getItemId(); + if (itemId == R.id.action_new) { + showCloneView(); + return true; + } else if (itemId == R.id.action_import_repo) { + intent = new Intent(this, ImportRepositoryActivity.class); + startActivityForResult(intent, REQUEST_IMPORT_REPO); + forwardTransition(); + return true; + } else if (itemId == R.id.action_settings) { + intent = new Intent(this, UserSettingsActivity.class); + startActivity(intent); + return true; } return super.onOptionsItemSelected(item); } diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 65e14e82..00000000 --- a/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -buildscript { - ext.kotlin_version = '1.5.31' - ext.android_plugin_version = '3.5.3' - - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..29b68161 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,22 @@ +buildscript { + val kotlin_version = "2.1.0" + repositories { + google() + mavenCentral() + } + dependencies { + classpath("com.android.tools.build:gradle:8.13.2") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/gradle.properties b/gradle.properties index bab85ac0..37b912b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,8 @@ android.enableJetifier=true +# AGP 8+ generates R fields as non-final by default, which breaks +# "case R.id.xxx:" labels in switch statements (constant expression required). +# Keep them final so the existing Java sources compile unchanged. +android.nonFinalResIds=false android.useAndroidX=true android.jetifier.ignorelist=shadows-support-v4-3.4-rc2.jar +org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 29e41345..4cab187c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Sep 14 16:48:41 AEST 2026 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index e7b4def4..00000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..15a801b1 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +include(":app") From a79d9fd9686c3a94c58d1259a58ee4ecdb125b5a Mon Sep 17 00:00:00 2001 From: Maksim Lin Date: Mon, 14 Sep 2026 20:07:10 +1000 Subject: [PATCH 2/3] update to new AGP --- build.gradle.kts | 4 ++-- gradle.properties | 10 ++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 29b68161..d2235691 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ buildscript { - val kotlin_version = "2.1.0" + val kotlin_version = "2.2.10" repositories { google() mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:8.13.2") + classpath("com.android.tools.build:gradle:9.0.1") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") } } diff --git a/gradle.properties b/gradle.properties index 37b912b9..48bfddd7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,13 @@ android.nonFinalResIds=false android.useAndroidX=true android.jetifier.ignorelist=shadows-support-v4-3.4-rc2.jar org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m +android.defaults.buildfeatures.resvalues=true +android.sdk.defaultTargetSdkToCompileSdkIfUnset=false +android.enableAppCompileTimeRClass=false +android.usesSdkInManifest.disallowed=false +android.uniquePackageNames=false +android.dependency.useConstraints=true +android.r8.strictFullModeForKeepRules=false +android.r8.optimizedResourceShrinking=false +android.builtInKotlin=false +android.newDsl=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4cab187c..fac57a37 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Sep 14 16:48:41 AEST 2026 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 747f0e3054cf00a557aa03099f0fdac2356fc6f6 Mon Sep 17 00:00:00 2001 From: Maksim Lin Date: Mon, 14 Sep 2026 20:07:28 +1000 Subject: [PATCH 3/3] target latest API level --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 684860e0..9978c0a7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,7 +20,7 @@ android { defaultConfig { applicationId = "com.manichord.mgit" minSdk = 21 - targetSdk = 31 + targetSdk = 36 vectorDrawables.useSupportLibrary = true