Skip to content

Commit bb87b5b

Browse files
committed
Add androidApp to prevent Compose issue
1 parent dcdb459 commit bb87b5b

File tree

7 files changed

+90
-16
lines changed

7 files changed

+90
-16
lines changed

kmp/androidApp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

kmp/androidApp/build.gradle.kts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.compose.compiler)
5+
}
6+
7+
android {
8+
namespace = "com.example.kmp.snippets"
9+
compileSdk = libs.versions.compileSdk.get().toInt()
10+
11+
defaultConfig {
12+
applicationId = "com.example.kmp.snippets"
13+
minSdk = libs.versions.minSdk.get().toInt()
14+
targetSdk = libs.versions.targetSdk.get().toInt()
15+
versionCode = 1
16+
versionName = "1.0"
17+
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
}
20+
21+
buildTypes {
22+
release {
23+
isMinifyEnabled = false
24+
proguardFiles(
25+
getDefaultProguardFile("proguard-android-optimize.txt"),
26+
"proguard-rules.pro"
27+
)
28+
}
29+
}
30+
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_17
33+
targetCompatibility = JavaVersion.VERSION_17
34+
}
35+
36+
kotlin {
37+
jvmToolchain(17)
38+
}
39+
40+
buildFeatures {
41+
compose = true
42+
}
43+
}
44+
45+
dependencies {
46+
val composeBom = project.dependencies.platform(libs.androidx.compose.bom)
47+
implementation(composeBom)
48+
implementation(project(":kmp:shared"))
49+
50+
implementation(libs.androidx.compose.runtime)
51+
implementation(libs.androidx.compose.ui)
52+
implementation(libs.androidx.compose.foundation)
53+
implementation(libs.androidx.compose.foundation.layout)
54+
implementation(libs.androidx.compose.ui.util)
55+
implementation(libs.androidx.compose.material)
56+
implementation(libs.androidx.lifecycle.runtime)
57+
implementation(libs.androidx.lifecycle.viewModelCompose)
58+
}

kmp/androidApp/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
File renamed without changes.

kmp/shared/build.gradle.kts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ plugins {
22
alias(libs.plugins.kotlin.multiplatform)
33
alias(libs.plugins.android.kotlin.multiplatform.library)
44
alias(libs.plugins.android.lint)
5-
alias(libs.plugins.compose.compiler)
65
}
76

87
kotlin {
9-
108
// Target declarations - add or remove as needed below. These define
119
// which platforms this KMP module supports.
1210
// See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
1311
androidLibrary {
14-
namespace = "com.example.kmp.snippets"
15-
compileSdk = 36
16-
minSdk = 24
12+
namespace = "com.example.kmp.snippets.shared"
13+
compileSdk = libs.versions.compileSdk.get().toInt()
14+
minSdk = libs.versions.minSdk.get().toInt()
1715

1816
withHostTestBuilder {
1917
}
@@ -25,6 +23,8 @@ kotlin {
2523
}
2624
}
2725

26+
jvmToolchain(17)
27+
2828
// For iOS targets, this is also where you should
2929
// configure native binary output. For more information, see:
3030
// https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks
@@ -65,16 +65,7 @@ kotlin {
6565

6666
androidMain {
6767
dependencies {
68-
val composeBom = project.dependencies.platform(libs.androidx.compose.bom)
69-
implementation(composeBom)
70-
implementation(libs.androidx.compose.runtime)
71-
implementation(libs.androidx.compose.ui)
72-
implementation(libs.androidx.compose.foundation)
73-
implementation(libs.androidx.compose.foundation.layout)
74-
implementation(libs.androidx.compose.ui.util)
75-
implementation(libs.androidx.compose.material)
76-
implementation(libs.androidx.lifecycle.runtime)
77-
implementation(libs.androidx.lifecycle.viewModelCompose)
68+
7869
}
7970
}
8071

settings.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ include(
3939
":identity:credentialmanager",
4040
":xr",
4141
":watchfacepush:validator",
42-
":kmp:shared",
42+
":kmp:androidApp",
43+
":kmp:shared"
4344
)

0 commit comments

Comments
 (0)