Skip to content

Commit 10ea6ee

Browse files
committed
Fix compose kotlin
1 parent 8077478 commit 10ea6ee

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

app/build.gradle.kts

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ android {
3737
kotlinOptions {
3838
jvmTarget = "11"
3939
}
40+
buildFeatures {
41+
compose = true
42+
}
4043
}
4144

4245
dependencies {

app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<activity
1717
android:name=".MainActivity"
18-
android:exported="false">
18+
android:exported="true">
1919

2020
<intent-filter>
2121
<action android:name="android.intent.action.MAIN" />
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
package com.peterfarlow
22

33
import android.os.Bundle
4+
import androidx.activity.compose.setContent
45
import androidx.appcompat.app.AppCompatActivity
6+
import androidx.compose.material.Text
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.tooling.preview.Preview
59
import dagger.hilt.android.AndroidEntryPoint
610

711
@AndroidEntryPoint
812
class MainActivity : AppCompatActivity() {
913

1014
override fun onCreate(savedInstanceState: Bundle?) {
1115
super.onCreate(savedInstanceState)
12-
setContentView(R.layout.activity_main)
16+
setContent {
17+
HomeScreen()
18+
}
1319
}
1420
}
21+
22+
@Composable
23+
fun HomeScreen() {
24+
Text("Hello, world!")
25+
}
26+
27+
@Composable
28+
@Preview
29+
fun DefaultPreview() {
30+
HomeScreen()
31+
}

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66
dependencies {
77
classpath("com.android.tools.build:gradle:7.0.0")
8-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
8+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32")
99
classpath("com.google.dagger:hilt-android-gradle-plugin:2.38.1")
1010
}
1111
}

0 commit comments

Comments
 (0)