|
| 1 | +plugins { |
| 2 | + alias(libs.plugins.android.application) |
| 3 | + alias(libs.plugins.kotlin.android) |
| 4 | + alias(libs.plugins.kotlin.compose) |
| 5 | +} |
| 6 | + |
| 7 | +android { |
| 8 | + namespace = "com.pureswift.swiftandroid" |
| 9 | + compileSdk = 35 |
| 10 | + |
| 11 | + defaultConfig { |
| 12 | + applicationId = "com.pureswift.swiftandroid" |
| 13 | + minSdk = 29 |
| 14 | + targetSdk = 35 |
| 15 | + versionCode = 1 |
| 16 | + versionName = "1.0" |
| 17 | + ndk { |
| 18 | + //noinspection ChromeOsAbiSupport |
| 19 | + abiFilters += listOf("arm64-v8a") |
| 20 | + } |
| 21 | + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 22 | + } |
| 23 | + |
| 24 | + buildTypes { |
| 25 | + release { |
| 26 | + isMinifyEnabled = false |
| 27 | + proguardFiles( |
| 28 | + getDefaultProguardFile("proguard-android-optimize.txt"), |
| 29 | + "proguard-rules.pro" |
| 30 | + ) |
| 31 | + } |
| 32 | + } |
| 33 | + compileOptions { |
| 34 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 35 | + targetCompatibility = JavaVersion.VERSION_11 |
| 36 | + } |
| 37 | + kotlinOptions { |
| 38 | + jvmTarget = "11" |
| 39 | + } |
| 40 | + buildFeatures { |
| 41 | + compose = true |
| 42 | + } |
| 43 | + packaging { |
| 44 | + resources { |
| 45 | + excludes += listOf("/META-INF/{AL2.0,LGPL2.1}") |
| 46 | + } |
| 47 | + jniLibs { |
| 48 | + keepDebugSymbols += listOf( |
| 49 | + "*/arm64-v8a/*.so", |
| 50 | + "*/armeabi-v7a/*.so", |
| 51 | + "*/x86_64/*.so" |
| 52 | + ) |
| 53 | + } |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +// Compile native Swift code for the demo app with `skip android build`. |
| 58 | +val buildSwift by tasks.registering(Exec::class) { |
| 59 | + group = "build" |
| 60 | + description = "Build native Swift sources for Android" |
| 61 | + workingDir(rootProject.projectDir) |
| 62 | + commandLine("bash", "build-swift.sh") |
| 63 | +} |
| 64 | + |
| 65 | +tasks.named("preBuild") { |
| 66 | + dependsOn(buildSwift) |
| 67 | +} |
| 68 | + |
| 69 | +dependencies { |
| 70 | + |
| 71 | + implementation(libs.androidx.core.ktx) |
| 72 | + implementation(libs.androidx.lifecycle.runtime.ktx) |
| 73 | + implementation(libs.androidx.activity.compose) |
| 74 | + implementation(platform(libs.androidx.compose.bom)) |
| 75 | + implementation(libs.androidx.ui) |
| 76 | + implementation(libs.androidx.ui.graphics) |
| 77 | + implementation(libs.androidx.ui.tooling.preview) |
| 78 | + implementation(libs.androidx.recyclerview) |
| 79 | + implementation(libs.androidx.navigation.runtime) |
| 80 | + implementation(libs.androidx.material3) |
| 81 | + implementation(libs.material) |
| 82 | + testImplementation(libs.junit) |
| 83 | + androidTestImplementation(libs.androidx.junit) |
| 84 | + androidTestImplementation(libs.androidx.espresso.core) |
| 85 | + androidTestImplementation(platform(libs.androidx.compose.bom)) |
| 86 | + androidTestImplementation(libs.androidx.ui.test.junit4) |
| 87 | + debugImplementation(libs.androidx.ui.tooling) |
| 88 | + debugImplementation(libs.androidx.ui.test.manifest) |
| 89 | +} |
0 commit comments