插件 cloud_firestore 和 firebase_auth 阻止与 android Emulator 同步
Posted
技术标签:
【中文标题】插件 cloud_firestore 和 firebase_auth 阻止与 android Emulator 同步【英文标题】:Plugins cloud_firestore and firebase_auth are preventing syncing with android Emulator 【发布时间】:2021-10-16 14:40:43 【问题描述】:我正在尝试在我的项目中实现 firebase 数据库,以便以后保存数据,但每次我添加时
cloud_firestore: firebase_auth:
到我的 pubspec.yaml 文件,无论我收到什么版本的各种错误
例如:
Plugin project :cloud_firestore_web not found. Please update settings.gradle.
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :firebase_auth_web not found. Please update settings.gradle.'
(这让我想到了一个新问题。为什么错误消息称它为 firbase_auth_WEB。我的意思是“web”这个词来自哪里以及为什么)
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.5\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.7\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.7\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.15.5+3\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D8: Cannot fit requested classes in a single dex file (# methods: 95560 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:132)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:119)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:432)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:242)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:57)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:67)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:63)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:63)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:60)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:200)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)``
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
at Version.fakeStackEntry(Version_2.1.62.java:0)
at com.android.tools.r8.utils.Y.a(SourceFile:78)
at com.android.tools.r8.D8.run(D8.java:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:117)
... 36 more
Caused by: com.android.tools.r8.utils.b: Cannot fit requested classes in a single dex file (# methods: 95560 > 65536)
at com.android.tools.r8.utils.T0.error(SourceFile:1)
at com.android.tools.r8.utils.T0.a(SourceFile:2)
at com.android.tools.r8.dex.P.a(SourceFile:740)
at com.android.tools.r8.dex.P$h.a(SourceFile:7)
at com.android.tools.r8.dex.b.a(SourceFile:14)
at com.android.tools.r8.dex.b.b(SourceFile:25)
at com.android.tools.r8.D8.d(D8.java:133)
at com.android.tools.r8.D8.b(D8.java:1)
at com.android.tools.r8.utils.Y.a(SourceFile:36)
... 38 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
* 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 1m 58s
[!] The shrinker may have failed to optimize the Java bytecode.
To disable the shrinker, pass the `--no-shrink` flag to this command.
To learn more, see: https://developer.android.com/studio/build/shrink-code
Exception: Gradle task assembleDebug failed with exit code 1
有人知道怎么解决吗?
是否有不一致的服务器来显示其他编码人员所说的问题?
提前致谢
【问题讨论】:
【参考方案1】:D8:单个 dex 文件中无法容纳请求的类
表示您需要raise your minSdkVersion to at least 21 or otherwise enable MultiDex。这在Firebase Android installation documentation中也有说明。
如果问题仍然存在,请分享您的 pubspec.yaml 的 sn-p,其中包含您的依赖项声明。
【讨论】:
以上是关于插件 cloud_firestore 和 firebase_auth 阻止与 android Emulator 同步的主要内容,如果未能解决你的问题,请参考以下文章
Flutter 应用程序未使用 cloud_firestore 插件编译
无法构建flutter插件cloud_firestore,因为CloudFirestorePlugin.java使用未经检查或不安全的操作[flutter build apk]