質問編集履歴

1

build.gradleのコードを追加しました。

2024/04/22 15:51

投稿

mimimimimi_
mimimimimi_

スコア5

test CHANGED
File without changes
test CHANGED
@@ -21,9 +21,8 @@
21
21
 
22
22
  ### 該当のソースコード
23
23
 
24
+ [MainActivity.kt]
24
25
  ```kotlin
25
- [MainActivity.kt]
26
-
27
26
  package com.example.todoapp
28
27
 
29
28
  import 省略
@@ -45,10 +44,8 @@
45
44
  }
46
45
  }
47
46
  ```
48
-
47
+ [AndroidManifest.xml]
49
48
  ```xml
50
- [AndroidManifest.xml]
51
-
52
49
  <?xml version="1.0" encoding="utf-8"?>
53
50
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
54
51
  xmlns:tools="http://schemas.android.com/tools">
@@ -79,6 +76,99 @@
79
76
 
80
77
  </manifest>
81
78
  ```
79
+ [build.gradle:app]
80
+ ```kotlin
81
+ plugins {
82
+ id("com.android.application")
83
+ id("org.jetbrains.kotlin.android")
84
+ alias(libs.plugins.ksp.gradle.plugin)
85
+ alias(libs.plugins.hilt.android.gradle.plugin)
86
+ }
87
+
88
+ android {
89
+ namespace = "com.example.todoapp"
90
+ compileSdk = 34
91
+
92
+ defaultConfig {
93
+ applicationId = "com.example.todoapp"
94
+ minSdk = 24
95
+ targetSdk = 34
96
+ versionCode = 1
97
+ versionName = "1.0"
98
+
99
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
100
+ vectorDrawables {
101
+ useSupportLibrary = true
102
+ }
103
+ }
104
+
105
+ buildTypes {
106
+ release {
107
+ isMinifyEnabled = false
108
+ proguardFiles(
109
+ getDefaultProguardFile("proguard-android-optimize.txt"),
110
+ "proguard-rules.pro"
111
+ )
112
+ }
113
+ }
114
+ compileOptions {
115
+ sourceCompatibility = JavaVersion.VERSION_1_8
116
+ targetCompatibility = JavaVersion.VERSION_1_8
117
+ }
118
+ kotlinOptions {
119
+ jvmTarget = "1.8"
120
+ }
121
+ buildFeatures {
122
+ compose = true
123
+ }
124
+ composeOptions {
125
+ kotlinCompilerExtensionVersion = "1.5.1"
126
+ }
127
+ packaging {
128
+ resources {
129
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
130
+ }
131
+ }
132
+ }
133
+
134
+ dependencies {
135
+ implementation(libs.androidx.core.ktx)
136
+ implementation(libs.androidx.lifecycle.runtime.ktx)
137
+ implementation(libs.androidx.activity.compose)
138
+ implementation(platform(libs.androidx.compose.bom))
139
+ implementation(libs.androidx.ui)
140
+ implementation(libs.androidx.ui.graphics)
141
+ implementation(libs.androidx.ui.tooling.preview)
142
+ implementation(libs.androidx.material3)
143
+ testImplementation(libs.junit)
144
+ androidTestImplementation(libs.androidx.junit)
145
+ androidTestImplementation(libs.androidx.espresso.core)
146
+ androidTestImplementation(platform(libs.androidx.compose.bom))
147
+ androidTestImplementation(libs.androidx.ui.test.junit4)
148
+ debugImplementation(libs.androidx.ui.tooling)
149
+ debugImplementation(libs.androidx.ui.test.manifest)
150
+ // hilt
151
+ implementation(libs.lifecycle.viewmodel.ktx)
152
+ implementation(libs.hilt.android)
153
+ ksp(libs.hilt.compiler)
154
+ implementation(libs.hilt.navigation.compose)
155
+ // room
156
+ implementation(libs.room.runtime)
157
+ implementation(libs.room.ktx)
158
+ annotationProcessor(libs.room.compiler)
159
+ ksp(libs.room.compiler)
160
+ }
161
+ ```
162
+ [build.gradle]
163
+ ```kotlin
164
+ plugins {
165
+ alias(libs.plugins.androidApplication) apply false
166
+ alias(libs.plugins.jetbrainsKotlinAndroid) apply false
167
+ alias(libs.plugins.ksp.gradle.plugin) apply false
168
+ alias(libs.plugins.hilt.android.gradle.plugin) apply false
169
+ }
170
+ ```
171
+
82
172
 
83
173
  ### 試したこと・調べたこと
84
174
  - [x] teratailやGoogle等で検索した