Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

update graddle

Acho Arnold6bf738402461
diff --git a/android/app/build.gradle b/android/app/build.gradle
deleted file mode 100644
index b64e834f..00000000
--- a/android/app/build.gradle
+++ /dev/null
@@ -1,69 +0,0 @@
-plugins {
- id 'com.android.application'
- id 'org.jetbrains.kotlin.android'
- id 'com.google.gms.google-services'
- id "io.sentry.android.gradle" version "6.2.0"
-}
-
-def gitHash = providers.exec {
- commandLine 'git', 'rev-parse', '--short', 'HEAD'
-}.standardOutput.asText.map { it.trim() }.getOrElse("unknown")
-
-android {
- compileSdk = 36
-
- defaultConfig {
- applicationId "com.httpsms"
- minSdk 28
- targetSdk 35
- versionCode 1
- versionName gitHash
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
-
- buildTypes {
- debug {
- manifestPlaceholders["sentryEnvironment"] = "development"
- }
- release {
- manifestPlaceholders["sentryEnvironment"] = "production"
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- kotlinOptions {
- jvmTarget = '1.8'
- }
- namespace 'com.httpsms'
-
- buildFeatures {
- buildConfig = true
- }
-}
-
-dependencies {
- implementation platform('com.google.firebase:firebase-bom:34.11.0')
- implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
- implementation 'com.google.firebase:firebase-analytics-ktx'
- implementation 'com.google.firebase:firebase-messaging-ktx'
- implementation 'com.squareup.okhttp3:okhttp:5.3.2'
- implementation 'com.jakewharton.timber:timber:5.0.1'
- implementation 'androidx.preference:preference-ktx:1.2.1'
- implementation 'androidx.work:work-runtime-ktx:2.11.1'
- implementation 'androidx.core:core-ktx:1.18.0'
- implementation "androidx.cardview:cardview:1.0.0"
- implementation 'com.beust:klaxon:5.6'
- implementation 'androidx.appcompat:appcompat:1.7.1'
- implementation 'org.apache.commons:commons-text:1.15.0'
- implementation 'com.google.android.material:material:1.13.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
- implementation 'com.googlecode.libphonenumber:libphonenumber:9.0.26'
- implementation 'com.klinkerapps:android-smsmms:5.2.6'
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.3.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
-}
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
new file mode 100644
index 00000000..2069551b
--- /dev/null
+++ b/android/app/build.gradle.kts
@@ -0,0 +1,65 @@
+plugins {
+ id("com.android.application")
+ id("com.google.gms.google-services")
+ id("io.sentry.android.gradle") version "6.2.0"
+}
+
+val gitHash = providers.exec {
+ commandLine("git", "rev-parse", "--short", "HEAD")
+}.standardOutput.asText.map { it.trim() }
+
+android {
+ compileSdk = 36
+
+ defaultConfig {
+ applicationId = "com.httpsms"
+ minSdk = 28
+ targetSdk = 35
+ versionCode = 1
+ versionName = gitHash.getOrElse("unknown")
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ getByName("debug") {
+ manifestPlaceholders["sentryEnvironment"] = "development"
+ }
+ getByName("release") {
+ manifestPlaceholders["sentryEnvironment"] = "production"
+ isMinifyEnabled = false
+ proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+ namespace = "com.httpsms"
+
+ buildFeatures {
+ buildConfig = true
+ }
+}
+
+dependencies {
+ implementation(platform("com.google.firebase:firebase-bom:34.11.0"))
+ implementation("com.journeyapps:zxing-android-embedded:4.3.0")
+ implementation("com.google.firebase:firebase-analytics")
+ implementation("com.google.firebase:firebase-messaging")
+ implementation("com.squareup.okhttp3:okhttp:5.3.2")
+ implementation("com.jakewharton.timber:timber:5.0.1")
+ implementation("androidx.preference:preference-ktx:1.2.1")
+ implementation("androidx.work:work-runtime-ktx:2.11.1")
+ implementation("androidx.core:core-ktx:1.18.0")
+ implementation("androidx.cardview:cardview:1.0.0")
+ implementation("com.beust:klaxon:5.6")
+ implementation("androidx.appcompat:appcompat:1.7.1")
+ implementation("org.apache.commons:commons-text:1.15.0")
+ implementation("com.google.android.material:material:1.13.0")
+ implementation("androidx.constraintlayout:constraintlayout:2.2.1")
+ implementation("com.googlecode.libphonenumber:libphonenumber:9.0.26")
+ implementation("com.klinkerapps:android-smsmms:5.2.6")
+ testImplementation("junit:junit:4.13.2")
+ androidTestImplementation("androidx.test.ext:junit:1.3.0")
+ androidTestImplementation("androidx.test.espresso:espresso-core:3.7.0")
+}
diff --git a/android/app/src/main/java/com/httpsms/MainActivity.kt b/android/app/src/main/java/com/httpsms/MainActivity.kt
index 5f76ada8..94332f6f 100644
--- a/android/app/src/main/java/com/httpsms/MainActivity.kt
+++ b/android/app/src/main/java/com/httpsms/MainActivity.kt
@@ -28,7 +28,6 @@ import com.google.android.material.card.MaterialCardView
import com.google.android.material.progressindicator.LinearProgressIndicator
import com.httpsms.services.StickyNotificationService
import com.httpsms.worker.HeartbeatWorker
-import okhttp3.internal.format
import timber.log.Timber
import java.time.Instant
import java.time.ZoneId
@@ -79,7 +78,7 @@ class MainActivity : AppCompatActivity() {
private fun setVersion() {
val appVersionView = findViewById<TextView>(R.id.mainAppVersion)
- appVersionView.text = format(getString(R.string.app_version), BuildConfig.VERSION_NAME)
+ appVersionView.text = getString(R.string.app_version, BuildConfig.VERSION_NAME)
}
private fun setCardContent(context: Context) {
diff --git a/android/build.gradle b/android/build.gradle
deleted file mode 100644
index eeed1cc3..00000000
--- a/android/build.gradle
+++ /dev/null
@@ -1,27 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-buildscript {
- ext {
- kotlin_version = '2.2.10'
- }
- repositories {
- // Check that you have the following line (if not, add it):
- google()
- mavenCentral() // Google's Maven repository
-
- }
- dependencies {
- // Add this line
- classpath 'com.google.gms:google-services:4.4.2'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- }
-}
-
-plugins {
- id 'com.android.application' version '9.1.0' apply false
- id 'com.android.library' version '9.1.0' apply false
- id 'org.jetbrains.kotlin.android' version '2.3.20' apply false
-}
-
-tasks.register('clean', Delete) {
- delete rootProject.buildDir
-}
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
new file mode 100644
index 00000000..095d0884
--- /dev/null
+++ b/android/build.gradle.kts
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath("com.google.gms:google-services:4.4.2")
+ }
+}
+
+plugins {
+ id("com.android.application") version "9.1.0" apply false
+ id("com.android.library") version "9.1.0" apply false
+}
+
+tasks.register<Delete>("clean") {
+ delete(rootProject.layout.buildDirectory)
+}
diff --git a/android/gradle.properties b/android/gradle.properties
index 8665be9a..1f124546 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -30,5 +30,3 @@ android.uniquePackageNames=false
android.dependency.useConstraints=true
android.r8.strictFullModeForKeepRules=false
android.r8.optimizedResourceShrinking=false
-android.builtInKotlin=false
-android.newDsl=false
diff --git a/android/settings.gradle b/android/settings.gradle.kts
similarity index 95%
rename from android/settings.gradle
rename to android/settings.gradle.kts
index baf72e29..75be430a 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle.kts
@@ -13,4 +13,4 @@ dependencyResolutionManagement {
}
}
rootProject.name = "httpSMS"
-include ':app'
+include(":app")