App worked fine for the whole day, while I was frequently rebuilding it, then once I tried to build it again, I kept getting these errors. I didn't add any new dependencies, nor did I do any major changes to the code. I probably tried everything you can find when googling some of these error messages but nothing helped me. If I try to migrate code to new project, it faces the same problem.
The problem seems to be somehow related to cloud firestore as indicated by error messages, when I remove all the refferences to it in my app leaving just firebase auth it builds just fine. debug console looke like this :
Launching lib\main.dart on Android SDK built for x86 in debug mode... Invalid depfile: C:\FlutterProjects\table_tennis_app\.dart_tool\flutter_build\742478cdbb2672c05d106c6da3c117ec\kernel_snapshot.d Invalid depfile: C:\FlutterProjects\table_tennis_app\.dart_tool\flutter_build\742478cdbb2672c05d106c6da3c117ec\kernel_snapshot.d /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js.dart:8:1: Error: Not found: 'dart:js' export 'dart:js' show allowInterop, allowInteropCaptureThis; ^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html';
^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart:2:8: Error: Not found: 'dart:html' import 'dart:html';
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util' export 'dart:js_util'; ^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart:102:32: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
- 'Firestore' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final updateFunctionWrap = allowInterop((transaction) =>
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart:300:9: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart:304:26: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
- 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) => controller.addError(e));
^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart:441:9: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart:445:26: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) => controller.addError(e));
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart:761:9: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
- 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/firestore.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:51:29: Error: Method not found: 'getProperty'.
map[key] = dartify(util.getProperty(jsObject, key));
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:73:24: Error: Method not found: 'newObject'.
final jsMap = util.newObject();
^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:75:12: Error: Method not found: 'setProperty'.
util.setProperty(jsMap, key, jsify(value));
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:97:12: Error: Method not found: 'allowInterop'.
return allowInterop(dartObject);
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:105:10: Error: Method not found: 'callMethod'.
util.callMethod(jsObject, method, args);
^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:120:24: Error: Method not found: 'promiseToFuture'.
value = await util.promiseToFuture(thenable);
^^^^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:122:14: Error: Method not found: 'hasProperty'.
if (util.hasProperty(e, 'code')) {
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:133:22: Error: Method not found: 'allowInterop'.
PromiseJsImpl<S>(allowInterop((
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:145:5: Error: Method not found: 'allowInterop'.
allowInterop(c.completeError);
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:153:27: Error: Method not found: 'getProperty'.
String get code => util.getProperty(_source, 'code');
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:156:30: Error: Method not found: 'getProperty'. String get message => util.getProperty(_source, 'message');
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:159:27: Error: Method not found: 'getProperty'. String get name => util.getProperty(_source, 'name');
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:162:37: Error: Method not found: 'getProperty'.
Object get serverResponse => util.getProperty(_source, 'serverResponse');
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:165:28: Error: Method not found: 'getProperty'.
String get stack => util.getProperty(_source, 'stack');
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:176:15: Error: Method not found: 'instanceof'. return util.instanceof(object, type);
^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:180:19: Error: Undefined name 'window'. Object? start = window;
^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/utils.dart:185:18: Error: Method not found: 'getProperty'.
start = util.getProperty(start, item);
^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart:330:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop((firebase_interop.UserJsImpl? user) {
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart:334:26: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final errorWrapper = allowInterop((e) => changeController.addError(e));
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart:362:9: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((firebase_interop.UserJsImpl? user) {
^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart:365:9: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
- 'Auth' is from 'package:firebase/src/auth.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/auth.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop(idTokenChangedController.addError),
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart:156:9: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop((update) => jsify(transactionUpdate(dartify(update))));
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart:158:28: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
- 'DatabaseReference' is from 'package:firebase/src/database.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final onCompleteWrap = allowInterop(
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart:291:26: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final callbackWrap = allowInterop((
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart:320:30: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
- 'Query' is from 'package:firebase/src/database.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
jsObject.once(eventType, allowInterop(
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart:397:24: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
- 'DataSnapshot' is from 'package:firebase/src/database.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/database.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart:312:25: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final nextWrapper = allowInterop(
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart:318:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
final onCompletion = allowInterop(() {
^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart:329:9: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
- 'UploadTask' is from 'package:firebase/src/storage.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-9.0.2/lib/src/storage.dart'). Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
allowInterop(_changeController.addError),
^^^^^^^^^^^^ Unhandled exception: FileSystemException(uri=org-dartlang-untranslatable-uri:dart:js; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:623:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:763:21) <asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9) <asynchronous suspension>
#4 starter (package:flutter_frontend_server/server.dart:85:12)
<asynchronous suspension>
#5 main (file:///C:/b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
<asynchronous suspension>
FAILURE: Build failed with an exception.
* Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
* What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 13s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)
CodePudding user response:
Put this in your pubspec.yaml
dependency_overrides:
firebase_messaging_platform_interface: 3.1.6 firebase_storage_platform_interface: 4.0.14 cloud_functions_platform_interface: 5.0.21 cloud_firestore_platform_interface: 5.4.13 firebase_auth_platform_interface: 6.1.11 firebase_database_platform_interface: 0.2.0 5
CodePudding user response:
It might happen due to multiple reasons. You can try:
Delete
kernel_snapshot.d
andkernel_snapshot.stamp
files at
flutter project\.dart_tool\flutter_build\742478cdbb2672c05d106c6da3c117ec
.You might have imported web-only dependency in my pubspec file or check if by mistake you have imported wrong file like
import 'dart:html';
.Try
flutter pub get
because it looks like one of your packages is not found if this did not works then tryflutter clean
.
Seems like you are using firebase: ^9.0.2
which only supports Web platform and you are trying to build app on Android Device.
Hope this works!