본문 바로가기

개발하자

웹용 Flatter Build - "응용 프로그램을 컴파일하지 못했습니다."

반응형

웹용 Flatter Build - "응용 프로그램을 컴파일하지 못했습니다."

프로젝트에 대해 웹 지원을 사용하도록 설정했는데 실행 후 다음 오류가 표시됩니다.

Launching lib/main.dart on Chrome in debug mode...
Syncing files to device Chrome...                                                                                                                                                                    
Compiler message:                                  
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapiauth2.dart:26:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  GoogleAuth.fakeConstructor$();                                                                                   
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapiauth2.dart:216:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  SigninOptionsBuilder.fakeConstructor$();                                                                         
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:351:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  HttpRequestPromise.fakeConstructor$();                                                                           
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:378:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  HttpRequest.fakeConstructor$() : super.fakeConstructor$();                                                       
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:402:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  HttpBatch.fakeConstructor$();                                                                                    
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:440:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  RpcRequest.fakeConstructor$();                                                                                   
  ^                                                                                                                
Syncing files to device Chrome...                               19,442ms (!)                                       
Failed to compile application.
Tals-Macbook:matkonit talbarda$ flutter run -d chrome
Launching lib/main.dart on Chrome in debug mode...
Syncing files to device Chrome...                                                                                                                                                                    
Compiler message:                                  
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapiauth2.dart:26:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  GoogleAuth.fakeConstructor$();                                                                                   
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapiauth2.dart:216:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  SigninOptionsBuilder.fakeConstructor$();                                                                         
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:351:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  HttpRequestPromise.fakeConstructor$();                                                                           
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:378:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  HttpRequest.fakeConstructor$() : super.fakeConstructor$();                                                       
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:402:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  HttpBatch.fakeConstructor$();                                                                                    
  ^                                                                                                                
../../flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in_web-0.8.3+1/lib/src/generated/gapi.dart:440:3: Error: JS interop classes do not support non-external constructors.
Try annotating with `external`.                                                                                    
  RpcRequest.fakeConstructor$();                                                                                   
  ^                                                                                                                
Syncing files to device Chrome...                               17,899ms (!)                                       
Failed to compile application.

어떻게 고칠 수 있죠?




대신 베타 채널로 이동합니다.

flutter channel beta



이 문제는 Google_sign_in_web 0.9.0에서 해결되었습니다. 따라서 pubspec.yaml 파일의 버전을 변경하십시오.

google_sign_in_web: ^0.9.1

업데이트 20/04/2020: google_sign_in과 관련하여 종속성이 있는 경우 pubspec.yaml 파일에서 해당 버전을 변경하십시오.

google_sign_in: 4.4.3

이전: 하지만, 당신이 나와 같고 구글_sign_in과 관련하여 종속성이 있을 때, 당신은 변경해야 할 것들이 더 있습니다. google_sign_in_web을 0.9.0으로 변경하고 google_sign_in의 버전을 4.4.1로 변경하면 패키지 검색이 실패합니다.

Because ${your_project_name} depends on google_sign_in 4.4.1 which depends on google_sign_in_web ^0.8.2, google_sign_in_web ^0.8.2 is required.
So, because ${your_project_name} depends on google_sign_in_web ^0.9.0, version solving failed.
pub get failed (1; So, because  ${your_project_name} depends on google_sign_in_web ^0.9.0, version solving failed.)

이 경우 Google_sign_in이 업그레이드될 때까지 기다리거나(풀 요청을 생성했습니다) 일시적으로 다음 작업을 수행해야 합니다.

1) 다음에서 플러터 플러그인 복제

mkdir /src
cd /src
git clone https://github.com/flutter/plugins.git

2) /src/plugins/plugins/packages/google_sign_in/google_sign_in/pubspec.yaml 파일을 변경합니다.

  google_sign_in_web: ^0.9.0

3) 프로젝트의 종속성을 변경하여 Google_sign_in의 변경된 버전을 가리킵니다.

google_sign_in:
  path: ../../flutter/plugins/packages/google_sign_in/google_sign_in
google_sign_in_web: ^0.9.0



어떤 이유에서인지 새로운 버전의 플러터는 이 형식의 종속성을 지원하지 않습니다. 대신 pubspec.yaml을 확인하고 해당 형식의 종속성을 다음과 같이 변경하십시오. 나는 folding_cell을 예로 들었다. 이것으로 문제가 해결되었으니 누군가에게 도움이 되었으면 좋겠어요.




오래된 다트 펍을 사용하여 오래된 패키지 종속성을 식별하고 업데이트 방법에 대한 조언을 얻으십시오. 종속성 관리를 위한 모범 사례에는 최신 안정적인 패키지 버전을 사용하는 것이 포함되므로 최신 버그 수정 및 개선 사항을 얻을 수 있습니다.

앱 폴더의 터미널과 경로를 열고 flotterpub을 실행하여 오래된 패키지를 모두 나열합니다.

cmd: pub의 사용 기간이 표시됨

모든 오래된 패키지를 최신 버전 또는 해결 가능한 버전으로 업그레이드합니다. 터미널 플러터 펍 업그레이드에서 실행됩니다. 오래된 패키지를 최신 패키지로 업데이트합니다. 그런 다음 앱을 실행합니다.

추가 정보:https://timeout.dev/tools/pub/pub/pub-timeout


반응형