[태그:] 플러터

  • Flutter 에서 flutter pub upgrade 후 빌드 에러 해결하기

    Flutter 에서 flutter pub upgrade 후 빌드 에러 해결하기

    아무 생각없이 flutter pub upgrade 이후 아래와 같은 오류가 발생하네요.

    $ flutter run
    Launching lib/main.dart on SM S***N in debug mode...
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/FollowChannelHandlerActivity.kt:5:38 Unresolved reference: CustomTabsActivity
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/FollowChannelHandlerActivity.kt:6:5 'onNewIntent' overrides nothing
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/FollowChannelHandlerActivity.kt:7:15 Unresolved reference: onNewIntent
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/FollowChannelHandlerActivity.kt:11:9 Unresolved reference: setResult
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/FollowChannelHandlerActivity.kt:11:19 Unresolved reference: RESULT_OK
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/FollowChannelHandlerActivity.kt:12:9 Unresolved reference: finish
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/IntentFactory.kt:59:27 Unresolved reference: AuthCodeCustomTabsActivity
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:41:40 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:51:36 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:57:36 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:82:55 Unresolved reference: AuthCodeCustomTabsActivity
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:100:26 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:121:36 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:130:36 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:143:22 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:171:55 Type argument is not within its bounds: should be subtype of 'Activity'
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:218:49 Unresolved reference: IntentResolveClient
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:237:21 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:258:21 Unresolved reference: Utility
    e: file:///home/doogle/.pub-cache/hosted/pub.dev/kakao_flutter_sdk_common-1.8.0/android/src/main/kotlin/com/kakao/sdk/flutter/KakaoFlutterSdkPlugin.kt:274:40 Unresolved reference: Utility
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':kakao_flutter_sdk_common: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 8s
    Running Gradle task 'assembleDebug'...                              8.9s
    Exception: Gradle task assembleDebug failed with exit code 1
    

    갑자기 에러가 나서 구글링해보는데 app/build.gradle 파일에 있는 ex.kotlin_version 을 올려보라는 말이 있어서 해보니 정상적으로 빌드가 됩니다. 휴…

    buildscript {
        ext.kotlin_version = '1.9.21'
    
        ...
    
    }

    위 ext.kotlin_version = ‘1.9.21’ 부분을 ext.kotlin_version = ‘1.9.22’ 로 변경하고 다시 flutter run 을 실행해보니 잘 빌드되네요. 순간 당황했습니다.

    참고자료