gradle 在1分41秒内构建成功531个可操作的任务:530个已执行,1个最新

1hdlvixo  于 2023-11-18  发布在  其他
关注(0)|答案(1)|浏览(139)

当我在android studio中运行我的flutter代码时,我得到了这个错误:

Task :app:compileFlutterBuildDebug lib/features/auth/authRepository.dart:5:1: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. import 'package:flutterquiz/features/auth/cubits/authCubit.dart'; ^^^^^^^^^^^^ lib/features/auth/authRemoteDataSource.dart:7:1: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. import 'package:flutterquiz/features/auth/cubits/authCubit.dart'; ^^^^^^^^^^^^ lib/features/auth/cubits/signInCubit.dart:6:1: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. import 'authCubit.dart'; ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:62:27: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. if (authProvider == AuthProvider.email) { ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:136:15: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. signOut(AuthProvider.email); ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:159:21: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. if (provider == AuthProvider.fb) { ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:161:28: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. } else if (provider == AuthProvider.gmail) { ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:163:28: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. } else if (provider == AuthProvider.mobile) { ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:165:28: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. } else if (provider == AuthProvider.apple) { ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:199:15: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. signOut(AuthProvider.mobile); ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:207:22: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. authProvider = AuthProvider.fb; ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:209:22: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. authProvider = AuthProvider.gmail; ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:211:22: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. authProvider = AuthProvider.mobile; ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:213:22: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. authProvider = AuthProvider.apple; ^^^^^^^^^^^^ lib/features/auth/authRepository.dart:215:22: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. authProvider = AuthProvider.email; ^^^^^^^^^^^^ lib/ui/screens/auth/otp_screen.dart:385:23: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. AuthProvider.mobile, ^^^^^^^^^^^^ lib/ui/screens/auth/otp_screen.dart:398:31: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. authProvider: AuthProvider.mobile, ^^^^^^^^^^^^ lib/features/auth/authRemoteDataSource.dart:167:27: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. if (authProvider == AuthProvider.gmail) { ^^^^^^^^^^^^ lib/features/auth/authRemoteDataSource.dart:172:34: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. } else if (authProvider == AuthProvider.mobile) { ^^^^^^^^^^^^ lib/features/auth/authRemoteDataSource.dart:178:34: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. } else if (authProvider == AuthProvider.email) { ^^^^^^^^^^^^ lib/features/auth/authRemoteDataSource.dart:184:34: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. } else if (authProvider == AuthProvider.apple) { ^^^^^^^^^^^^ lib/features/auth/authRemoteDataSource.dart:294:25: Error: 'AuthProvider' is imported from both 'package:firebase_auth_platform_interface/src/auth_provider.dart' and 'package:flutterquiz/features/auth/cubits/authCubit.dart'. if (authProvider == AuthProvider.gmail) { ^^^^^^^^^^^^ Target kernel_snapshot failed: Exception

任务:app:compileFlutterBuildFlutter
原因:org.gradle.process.internal.ExecException:Process 'command '/Users/macbook/development/flutter/bin/flutter '' finished with non-zero exit value 1

[enter image description here](https://i.stack.imgur.com/cA9Ji.png)

字符串
原因:org.gradle.process.internal.ExecException:Process 'command '/Users/macbook/development/flutter/bin/flutter '' finished with non-zero exit value 1 enter image description here

ulydmbyx

ulydmbyx1#

此问题是由于最近对firebase_auth包的更新(特别是版本4.13.0)引起的命名冲突造成的,该版本现在导出AuthProvider类。此更改在this pull request中引入,并在2023年11月9日的release notes中提到。
Shahed Emon在上面的评论中指出了可能的修复方法:

  • 重新编译你自己的AuthProvider类以避免冲突,或者...
  • firebase_auth包导入冲突类时使用别名,如下所示:
import 'package:firebase_auth_platform_interface/src/auth_provider.dart' as firebase;

字符串
通过在导入firebase_auth包时使用别名,可以防止该包中的AuthProvider被无意中合并到现有代码中,这些代码没有引用firebase_authAuthProvider
作为参考,这是我得到的错误:
无法构建iOS应用程序
无法为设备生成预编译的应用程序。
错误(Xcode):lib/feature/auth/provider/firebase_auth_provider.dart:3:1:错误:“AuthProvider”是从“package:app/feature/auth/provider/auth_provider.dart”和“package:firebase_auth_platform_interface/src/auth_provider. dart”导入的。

相关问题