나만의 웹브라우져 01 코딩 후 실행하면 아래와 같은 오류가 뜨네요
3220
작성한 질문수 67
We recommend using a newer Android Gradle plugin to use compileSdk = 34 This Android Gradle plugin (8.0.2) was tested up to compileSdk = 33. You are strongly encouraged to update your project to use a newer Android Gradle plugin that has been tested with compileSdk = 34. If you are already using the latest version of the Android Gradle plugin, you may need to wait until a newer version with support for compileSdk = 34 is available. To suppress this warning, add/update android.suppressUnsupportedCompileSdk=34 to this project's gradle.properties.
안드로이드 스튜디오버젼이 강사님과 달라 아직 헤메고 있습니다
MainActivity.kt
import android.os.Bundle
import android.webkit.WebView
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowForward
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
HomeScreen()
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen() {
Scaffold (
topBar = {
TopAppBar(
title = { Text("")},
actions = {
IconButton(onClick = {
}){
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "back",
tint = Color.White
)
}
IconButton(onClick = {
}){
Icon(
imageVector = Icons.Default.ArrowForward,
contentDescription = "forward",
tint = Color.White
)
}
}
)
}
) { paddingValues ->
OutlinedTextField(
value = "",
onValueChange = {},
label = { Text("https://")},
modifier = Modifier
.padding(paddingValues)
.fillMaxWidth(),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
keyboardActions = KeyboardActions(onSearch = {}),
)
Spacer(modifier = Modifier.height(16.dp))
MyWebView()
}
}
@Composable
fun MyWebView() {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = {
WebView(it).apply {
loadUrl("https://google.com")
}
},
update = {},
)
}
build.gradle(Project)
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
build.gradle(Module :app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.dongguntech.compose_mywebbrowser'
compileSdk 34
defaultConfig {
applicationId "com.dongguntech.compose_mywebbrowser"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
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.10'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.3'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
var lifecycle_version = "2.5.1" // 2.6.2 버젼은 오류가 남
var arch_version = "2.1.0"
// ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
// ViewModel utilities for Compose
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
// LiveData
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
// Lifecycles only (without ViewModel or LiveData)
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version")
// Saved state module for ViewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version")
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")
// optional - helpers for implementing LifecycleOwner in a Service
implementation("androidx.lifecycle:lifecycle-service:$lifecycle_version")
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation("androidx.lifecycle:lifecycle-process:$lifecycle_version")
// optional - ReactiveStreams support for LiveData
implementation("androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version")
// optional - Test helpers for LiveData
testImplementation("androidx.arch.core:core-testing:2.2.0:78")
// optional - Test helpers for Lifecycle runtime
testImplementation ("androidx.lifecycle:lifecycle-runtime-testing:$lifecycle_version")
implementation "androidx.compose.animation:animation:1.5.4"
implementation "androidx.compose.foundation:foundation:1.5.4"
implementation "androidx.compose.material:material:1.5.4"
implementation "androidx.compose.material3:material3:1.1.2"
implementation "androidx.compose.runtime:runtime:1.5.4"
implementation "androidx.compose.ui:ui:1.5.4"
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.core:core-ktx:1.12.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.8.1'
implementation "androidx.wear.compose:compose-foundation:1.2.1"
implementation "androidx.wear.compose:compose-material:1.2.1"
implementation "androidx.wear.compose:compose-navigation:1.2.1"
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
implementation platform('androidx.compose:compose-bom:2022.10.00')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
}참고로 제가 사용중인 안드로이드 스튜디오버젼은
Android Studio Flamingo | 2022.2.1 Patch 2
입니다
답변 2
1
말씀주신대로 안드로이드스튜디오를 업데이트 하니
오류가 사라졌습니다
다시한번 강사님의 노고에 감사드리고
늘 건강하시고 부자되세요
Android Studio Giraffe | 2022.3.1 Patch 4
0
에러 메시지만 보면 build.gradle(Module :app) 에서 complieSdk=33, targetSdk=33 으로 고치면 될 것 같습니다.
참고로 안드로이드 스튜디오를 최신으로 업데이트 하면 compileSdk=34로도 잘 되는 것을 확인했습니다.
현재 제 버전은 Giraffe, 2022.3.1 Patch 4 입니다.
https://github.com/junsuk5/android-compose/tree/master/examples/MyWebBrowser
ViewModel 사용 관련 질문
0
75
1
onTabFavorite 콜백 관련 질문
0
60
2
livedata가 왜 필요한 건지 궁금합니다
0
128
3
깃허브에 있는 MemoryTodoRepository 는 룸을 사용하는게 아닌 메모리에 저장, 수정, 삭제 하는건가요?
0
172
1
이젠 아래와 같은 오류가 뜨는데 KSP가 문제 인걸까요?
0
369
2
영상 1분쯤에서 MainActivity에서 viewModel이 저는 안되고 그래들 문제인거 같은데 해결 방법을 모르겠습니다.
0
186
1
전자액자에서 영상과 깃허브의 내용이 달라서 영상을 다보고 깃허브 내용으로 돌려봤는데 권한요청부터가 안됩니다.
0
188
2
Navigation수업에서 string대신 bitmap을 인자로 넘겨주는 방법?
0
177
1
TodoList - 04에서 recentlyDeleteTodo가 null일 경우 처리 방법 문의
0
171
1
나만의 웹 브라우저 03 - UI와 ViewModel 연동 강의에서 질문들이 있습니다.
0
205
2
Scaffold를 사용하면 Content padding parameter it is not used 에러
0
349
1
Material3로 바뀌면서 강의랑 다른 부분이 초반부터 있는데요.
0
221
1
강의에서 사용하는 리소스(이미지 등)을 다운 받을 수 있으면 좋겠어요.
0
248
2
Card Compose에서 elevation 옵션
1
347
1
구글맵 질문입니다
0
233
1
구글맵강의중에서 ..
0
578
7
drawCircle( color = Color.... 부분에서 빨간줄이 ...
0
269
2
val scaffoldState = rememberScaffoldState() 에서 빨간줄이 생기네요
0
524
1
나만의 웹브라우져 02 코드실행시 에뮬레이터에 따라
0
221
1
비만도계산기 로직작성 에서 문제가 발생했어요 ^^
0
338
3
viewModel() 오류 추가질문입니다
0
1118
2
viewModel: MainViewModel = viewModel() 에 오류있습니다
0
537
3
AAR metadata 관련오류발생
0
1437
3
모바일화면에 키보드가 사라지지 않아
0
250
1





