인프런 커뮤니티 질문&답변

IHC님의 프로필 이미지
IHC

작성한 질문수

[2024 최신] [코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

프로젝트 생성 후 기본 코드 실행 시 Null Check Operator 에러 발생

작성

·

905

0

안녕하세요.

안드로이드 스튜디오에서 프로젝트 생성 후 코드수정없이 바로 실행했는데, 아래와 같은 오류가 발생합니다. 도와주세요.

Oops; flutter has exited unexpectedly: "Null check operator used on a null value".

A crash report has been written to C:\Users\IHC\AndroidStudioProjects\dataprogram_flutter\flutter_01.log.

 

아래는 flutter_01.log 파일안의 내용입니다.

 

Flutter crash report.

Please report a bug at https://github.com/flutter/flutter/issues.

## command

flutter --no-color run --machine --track-widget-creation --device-id=emulator-5554 --start-paused --dart-define=flutter.inspector.structuredErrors=true lib\main.dart

## exception

_TypeError: Null check operator used on a null value

```

#0 AndroidStudioJavaGradleConflictMigration.migrate (package:flutter_tools/src/android/migrations/android_studio_java_gradle_conflict_migration.dart:107:39)

#1 ProjectMigration.run (package:flutter_tools/src/base/project_migrator.dart:84:16)

#2 AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:280:15)

#3 AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:208:11)

#4 AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:578:29)

<asynchronous suspension>

#5 FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:468:33)

<asynchronous suspension>

#6 Future.wait.<anonymous closure> (dart:async/future.dart:525:21)

<asynchronous suspension>

#7 HotRunner.run (package:flutter_tools/src/run_hot.dart:421:34)

<asynchronous suspension>

#8 AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:649:9)

<asynchronous suspension>

#9 AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:647:5)

<asynchronous suspension>

#10 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:638:15)

<asynchronous suspension>

#11 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1294:27)

<asynchronous suspension>

#12 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)

<asynchronous suspension>

#13 CommandRunner.runCommand (package:args/command_runner.dart:212:13)

<asynchronous suspension>

#14 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)

<asynchronous suspension>

#15 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)

<asynchronous suspension>

#16 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)

<asynchronous suspension>

#17 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)

<asynchronous suspension>

#18 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)

<asynchronous suspension>

#19 main (package:flutter_tools/executable.dart:91:3)

<asynchronous suspension>

```

## flutter doctor

```

[✓] Flutter (Channel master, 3.10.0-17.0.pre.31, on Microsoft Windows [Version 10.0.19044.1288], locale ko-KR)

• Flutter version 3.10.0-17.0.pre.31 on channel master at C:\flutter

• Upstream repository https://github.com/flutter/flutter.git

• Framework revision 3ed5f51208 (81 minutes ago), 2023-04-30 05:42:24 -0400

• Engine revision e99f31f443

• Dart version 3.1.0 (build 3.1.0-56.0.dev)

• DevTools version 2.23.1

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)

• Android SDK at C:\Users\IHC\AppData\Local\Android\sdk

• Platform android-33, build-tools 33.0.2

• Java binary at: c:\Program Files\Android\Android Studio\jbr\bin\java

• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

• All Android licenses accepted.

[✓] Chrome - develop for the web

• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✗] Visual Studio - develop for Windows

✗ Visual Studio not installed; this is necessary for Windows development.

Download at https://visualstudio.microsoft.com/downloads/.

Please install the "Desktop development with C++" workload, including all of its default components

[✓] Android Studio (version 2022.2)

• Android Studio at C:\Program Files\Android\Android Studio

• Flutter plugin can be installed from:

🔨 https://plugins.jetbrains.com/plugin/9212-flutter

• Dart plugin can be installed from:

🔨 https://plugins.jetbrains.com/plugin/6351-dart

• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[✓] Android Studio

• Android Studio at c:\Program Files\Android\Android Studio

• Flutter plugin can be installed from:

🔨 https://plugins.jetbrains.com/plugin/9212-flutter

• Dart plugin can be installed from:

🔨 https://plugins.jetbrains.com/plugin/6351-dart

• android-studio-dir = c:\Program Files\Android\Android Studio

• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[✓] Connected device (4 available)

• sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)

• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1288]

• Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.138

• Edge (web) • edge • web-javascript • Microsoft Edge 92.0.902.67

[✓] Network resources

• All expected network resources are available.

! Doctor found issues in 1 category.

```

 

 

 

 

답변 1

1

코드팩토리님의 프로필 이미지
코드팩토리
지식공유자

안녕하세요!

Null이 입력되면 안되는 요소에 Null이 입력돼서 생기는 에러입니다.

환경설정과 관계없이 코드상 문제입니다.

만약에 프로젝트를 생성한 후 바로 실행을 하셨다면 생기면 안되는 에러입니다.

한번 더 확인해보시고도 문제가 있다면 저희 카카오 커뮤니티로 오셔서 원격 신청 해주세요.

https://links.codefactory.ai

감사합니다!

IHC님의 프로필 이미지
IHC

작성한 질문수

질문하기