Open faithinker opened 2 weeks ago
안녕하세요,
compileSdk 34
minSdkVersion 23
으로 잘 동작하시는지 확인 부탁드리겠습니다.
변경했으나 동일한 에러가 발생하고 있습니다.
android/app/build.gradle 파일
def flutterMinSdkVersion = localProperties.getProperty('flutter.flutterMinSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = '23'
}
def fluttercompileSdkVersion = localProperties.getProperty('flutter.compileSdkVersion')
if (fluttercompileSdkVersion == null) {
fluttercompileSdkVersion = '34'
}
// TODO: 삭제예정
def printFluttercompileSdkVersion = "fluttercompileSdkVersion: $fluttercompileSdkVersion"
def printFlutterMinSdkVersion = "flutterMinSdkVersion: $flutterMinSdkVersion"
android {
println printFluttercompileSdkVersion
println printFlutterMinSdkVersion
namespace "com.joohyupkim.ddocdoc.ddocdoc_clone"
compileSdk fluttercompileSdkVersion.toInteger() // flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.joohyupkim.ddocdoc.ddocdoc_clone"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutterMinSdkVersion.toInteger() //flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
실행결과
fluttercompileSdkVersion: 34
flutterMinSdkVersion: 23
e: file:///Users/jhkim/.pub-cache/hosted/pub.dev/flutter_naver_map-1.2.2/android/src/main/kotlin/dev/note11/flutter_naver_map/flutter_naver_map/view/NaverMapView.kt:134:29 Unresolved reference: style
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_naver_map:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 3s
Running Gradle task 'assembleDebug'... 3.5s
Error: Gradle task assembleDebug failed with exit code 1
flutterMinSdkVersion과 fluttercompileSdkVersion 출력까지 확인해봤습니다.
android {
compileSdk 34
defaultConfig {
minSdkVersion 23
}
}
로 직접 숫자 명시해봐도 똑같은 빌드 에러가 떴습니다.
커밋 리스트: https://github.com/faithinker/ddocdoc_clone/commits/main
안녕하세요,
compileSdk 34 minSdkVersion 23
으로 잘 동작하시는지 확인 부탁드리겠습니다.
android gradle plugin (AGP)의 버전 정보를 받아볼 수 있을까요? 해당 정보는 build.gradle file에 com.android.tools.build:gralde에 명시되어 있습니다!
app/build.gradle 파일과 android/build.gradle 파일 두개를 모두 봤지만 com.android.tools.build:gralde 의 경우 아예 명시가 되어있지 않습니다.
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def flutterMinSdkVersion = localProperties.getProperty('flutter.flutterMinSdkVersion')
if (flutterMinSdkVersion == null) {
flutterMinSdkVersion = '23'
}
def fluttercompileSdkVersion = localProperties.getProperty('flutter.compileSdkVersion')
if (fluttercompileSdkVersion == null) {
fluttercompileSdkVersion = '34'
}
android {
namespace "com.joohyupkim.ddocdoc.ddocdoc_clone"
compileSdk 34 // fluttercompileSdkVersion.toInteger() // flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.joohyupkim.ddocdoc.ddocdoc_clone"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23 //flutterMinSdkVersion.toInteger() //flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {}
app/build.gradle 파일 전문 소스코드입니다.
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
}
include ":app"
AGP의 경우 빈값으로 뜨고 있으나 추가를 해줘도
첫번째 사진과 같이 빈 값으로 뜹니다.
NDK 설치버전
Android SDK와 NDK 설정 local.properties에서 직접 명시 = Finder와 일치
안드로이드스튜디오에서 ndk와 gradle version 8.2로 설정하고 나니 다른 에러가 뜨는데... 이거는 naver map 하고 연관 없어보이네요...
One or more plugins require a higher Android NDK version.
Fix this issue by adding the following to /Volumes/samsung/Flutter/myGit/ddocdoc_clone/android/app/build.gradle:
android {
ndkVersion "25.1.8937393"
...
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> An issue was found when checking AAR metadata:
1. Dependency ':flutter_local_notifications' requires core library desugaring to be enabled
for :app.
See https://developer.android.com/studio/write/java8-support.html for more
details.
gradle-wrapper.properties 입니다.
동료 안드로이드 개발자분한테 여쭤봐도 잘 모르시더라구요... 정 안되면 새 프로젝트에서 다시 네이버 맵 pub 추가해서 해볼려고 합니다...
원인을 찾았습니다.
android gradle plugin 8.0부터는 android.nonTransitiveRClass
의 기본값이 false
에서 true
로 변경됩니다.
해당 속성은 현재 모듈에 정의된 R Class가 아니면 생성하지 않도록 하는 옵션입니다만, 이것의 기본값이 true로 변경되며 기존 flutter_naver_map에서 flutter앱의 R을 통해 참조하고 있던 appcompat 테마 강제 활성화 기능이 R.style을 더 이상 flutter_naver_map 모듈에서 생성하지 않음에 따라 오류가 발생하는 것입니다. (Reference: Android Developers)
이 속성의 기본값이 바뀐 이유는 모듈화로 apk를 최대한 쪼개서 용량을 줄이겠다는 목적으로 보입니다. (android developer page comment: AGP 8.0은 현재 모듈에만 정의된 리소스의 R 클래스를 생성합니다.)
따라서 임시 방편으로 빌드되도록 하는 조치는 다음과 같습니다. (앱에 따로 오류나 악영향을 초래하지는 않습니다. 안심하세요)
[Flutter 프로젝트 루트]/android/gradle.properties
// ... 여러 옵션들이 이미 있을 것입니다. 아래에 추가하세요.
android.nonTransitiveRClass=false
일단 오늘은 자야해서, 여기까지만 해두고 라이브러리 단에서 해결할 수 있는 방법이 있는지 찾아보도록 하겠습니다.
두가지 방안을 생각중입니다.
android.nonTransitiveRClass=false
코드 추가하니 정상적으로 안드로이드에서도 빌드가 가능합니다.
위에서 언급했던 flutter_local_notifications 빌드 에러는 pub에서 제거하니 정상적으로 빌드 되고요... => 이것도 그쪽 오픈소스 가서 이슈 올려야 하는데.. 😂😂
앱에 따로 오류나 악영향을 초래하지는 않습니다.
사이드 프로젝트로 연습 공부중인 부분이라 괜찮습니다...
도움주셔서 감사합니다.
해당 이슈는 해야할 작업으로 등록해두기 위해 다시 열었습니다.
안녕하세요. 네이버 지도앱 유용하게 잘 쓰고 있습니다. 안드로이드에서 네이버 지도가 동작하지 않습니다.
minSdkVersion을 명시하라 해서
이렇게 수정했고 그다음 빌드를 하니 아래와 같이 fail이 뜹니다.
e: file:///jhkim/userName/.pub-cache/hosted/pub.dev/flutter_naver_map-1.2.2/android/src/main/kotlin/dev/note11/flutter_naver_map/flutter_naver_map/view/NaverMapView.kt:134:29 Unresolved reference: style
FAILURE: Build failed with an exception.
NaverMapView.kt 파일 스샷 입니다.
아래 프로젝트에서 네이버 지도앱 사용 중입니다. https://github.com/faithinker/ddocdoc_clone
flutter clean 이후 flutter run을 해도 똑같습니다. iOS 개발자라서 안드로이드로는 빌드를 잘 안하다가 중간에 안드로이드를 빌드 해보니 빌드가 안됐습니다..
flutter location에서 빌드에러가 나서 https://github.com/Lyokone/flutterlocation/issues/948
app/build.gradle, android/build.gradle, android/settigns.gradle 부분의 gradle. AGP, kotlin 등 버전을 올렸는데 이부분에서 혹시 문제가 되는 것인지도 함께 봐주시면 좋을 것 같습니다.
감사합니다.