본문 바로가기
개발 공부/Flutter

[Flutter]Flutter 각종 오류 관련 - 추가 예정

by 깐테 2022. 1. 21.

Cloud_firestore와 관련하여 sdk 버전 오류가 발생하는 경우

  • android/app/build.gradle에서 minSdk 버전을 19 이상으로 변경.

 

The number of method references in a .dex file cannot exceed 64K. 오류 발생 시

  • build.gradle에서 multiDexEnabled 활성화
android {
    compileSdkVersion 30

    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.example.radishmarket.radish_market"
        minSdkVersion 19
        targetSdkVersion 30
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

 

Firebase 초기화가 되지 않았다는 오류가 발생하는 경우

  • build.gradle에서 classpath에 google-services 추가
  • app/build.gradle → apply plugin: 'com.google.gms.google-services 추가

 

추가 오류 해결 사항

An InputDecorator, which is typically created by a TextField, cannot have an unbounded width. 
This happens when the parent widget does not provide a finite width constraint. 
For example, if the InputDecorator is contained by a Row, then its width must be constrained. 
An Expanded widget or a SizedBox can be used to constrain the width of the InputDecorator or the TextField that contains it.
  • Column 내부에 Row 작성 시, Row 내부에 InputDecoration 또는 텍스트 필드 삽입 시 발생하는 오류
  • SizedBox로 width 값을 고정시키거나 Expanded를 사용하여 너비 값을 고정시키면 해당 오류 해결 가능

 

If this widget is always nested in a scrollable widget there is no need to use a viewport because there will always be enough vertical space for the children. 
In this case, consider using a Column instead. 
Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size the height of the viewport to the sum of the heights of its children.
  • ListView 내부에 ListView와 같은 Children을 갖는 레이아웃을 사용 시 발생하는 문제
  • 수직 뷰포트의 높이를 설정해주지 않아 레이아웃이 겹칠 때 발생함
  • shrinkWrap 을 true로 설정해주면 오류 해결.

 

기본 설정 오류 관련

Flutter 사용 시 JAVA_HOME 에러가 발생하는 경우

안드로이드 스튜디오에서 플러터 앱 실행시 JAVA_HOME PATH 문제가 발생한다면?

JAVA_HOME is set to an invalid directory, Please set the JAVA_HOME variable in your environment to match the location of your Java installation

  • JAVA_HOME 에러가 발생하는 경우 보통 환경변수 설정에서 경로를 잘못잡아주었기 때문
  • bin 을 포함한 경로는 안되고, bin 폴더 이전까지의 경로를 경로로 설정한다.

 

cmdline-tools 설정 오류가 발생하는 경우

I am getting this errors "cmdline-tools component is missing" after installing flutter and android studio... i added andorid sdk. how to solve them?

  • 안드로이드 스튜디오의 SDK Tools 탭에서 해당 툴 설치
반응형