使用或覆盖已弃用的

使用或覆盖已弃用的

本文介绍了Flutter:Java 使用或覆盖已弃用的 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在 Android/IOS Flutter 应用程序中使用 auth、firestore firebase,并且在测试了几个不同的版本后遇到了许多不同的问题.现在它在构建日志中向我显示了几条消息.

构建日志

注意:D:FlutterSDKflutter.pub-cachehostedpub.dartlang.orgfirebase_core-0.4.3+1androidsrcmainjavaioflutterpluginsfirebasecoreFirebaseCorePlugin.java使用或覆盖已弃用的 API.注意:重新编译-Xlint:弃用详细信息.注意:D:FlutterSDKflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-0.13.0+1androidsrcmainjavaioflutterpluginsfirebasecloudfirestoreCloudFirestorePlugin.java使用未经检查或不安全的操作.注意:重新编译-Xlint:未选中详细信息.D8:无法在单个 dex 文件中容纳请求的类(# 方法:81454 > 65536)com.android.builder.dexing.DexArchiveMergerException: 时出错合并 dex 档案:.dex 文件中方法引用的数量不能超过 64K.了解如何解决此问题,请访问https://developer.android.com/tools/building/multidex.html在 com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)在 com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)在 com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)在 com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)在 com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)在 org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)在 org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)在 org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)

 在 org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)在 org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)在 org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)在 org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)在 org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)在 org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)在 org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)在 org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)在 org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)在 org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)在 org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)在 org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)在 org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)在 org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)在 java.util.concurrent.FutureTask.run(FutureTask.java:266)在 org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)在 org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)在 org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)在 java.util.concurrent.FutureTask.run(FutureTask.java:266)在 org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)在 org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)在 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)在 java.lang.Thread.run(Thread.java:748) 引起:com.android.tools.r8.CompilationFailedException:编译失败

完成在 com.android.tools.r8.utils.t.a(:55)在 com.android.tools.r8.D8.run(:11)在 com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)... 34 更多 引起:com.android.tools.r8.utils.AbortException:错误:空,无法适应在单个 dex 文件中请求的类(# 方法:81454 > 65536)在 com.android.tools.r8.utils.Reporter.a(:21)在 com.android.tools.r8.utils.Reporter.a(:7)在 com.android.tools.r8.dex.VirtualFile.a(:33)在 com.android.tools.r8.dex.VirtualFile$h.a(:5)在 com.android.tools.r8.dex.ApplicationWriter.a(:13)在 com.android.tools.r8.dex.ApplicationWriter.write(:35)在 com.android.tools.r8.D8.d(:44)在 com.android.tools.r8.D8.b(:1)在 com.android.tools.r8.utils.t.a(:23)... 36个

FAILURE:构建失败,出现异常.

  • 出了什么问题:任务:app:mergeDexDebug"的执行失败.

    执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障com.android.builder.dexing.DexArchiveMergerException:合并 dex 档案时出错:.dex 文件中方法引用的数量不能超过 64K.在 https://developer.android.com/tools/building/了解如何解决此问题multidex.html

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪.使用 --info 或 --debug 选项运行以获得更多日志输出.使用 --scan 运行以获得完整的见解.

  • https://help.gradle.org
  • 获得更多帮助

在 4m 33s 内构建失败

颤动医生 -v

[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows[版本 10.0.18362.535],语言环境 en-IN)

  • • Flutter 版本 1.12.13+hotfix.5 位于 D:FlutterSDKflutter

    • 框架修订版 27321ebbad(3 周前),2019-12-10 18:15:01 -0800• 引擎修订版 2994f7e1e6• Dart 版本 2.7.0

[√] Android 工具链 - 为 Android 设备开发(Android SDK版本 29.0.2)

  • • Android SDK 位于 C:UsersadminAppDataLocalAndroidsdk

    • 未配置 Android NDK 位置(可选;对于本机分析支持很有用)• 平台 android-29,构建工具 29.0.2• Java 二进制文件位于:D:Android SDKjreinjava• Java 版 OpenJDK 运行时环境(构建 1.8.0_202-release-1483-b03)• 接受所有Android 许可证.

[√] Android Studio(3.5 版)

  • • Android Studio 位于 D:Android SDK

    • Flutter 插件版本 41.1.2• Dart 插件版本 191.8593• Java 版 OpenJDK 运行时环境(构建 1.8.0_202-release-1483-b03)

发布规范

依赖项:扑:SDK:颤动firebase_auth:^0.15.3云火商店:^0.13.0+1

build.gradle(android)

依赖项{类路径 'com.android.tools.build:gradle:3.5.0'类路径org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"类路径 'com.google.gms:google-services:4.3.0'}
解决方案

需要使用以下插件:

依赖项:firebase_auth:^0.15.3云火商店:^0.13.0+1

不要忘记配置firebase:

https://pub.dev/packages/cloud_firestore#setup

https://pub.dev/packages/firebase_auth#usage

也在你的app/build.gradle中,增加minSdkVersion:

改变这个:

minSdkVersion 16

进入这个:

minSdkVersion 23

I've been trying to use the auth, firestore firebase in an Android / IOS flutter application, and have been experiencing many different issues, after testing several different versions. Now it's showing me several messages in the build log.

build log

  • 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 4m 33s

    flutter doctor -v

    • • Flutter version 1.12.13+hotfix.5 at D:FlutterSDKflutter

    • • Android SDK at C:UsersadminAppDataLocalAndroidsdk

    • • Android Studio at D:Android SDK

    pubspec

    dependencies:
      flutter:
        sdk: flutter
      firebase_auth: ^0.15.3
      cloud_firestore: ^0.13.0+1
    

    build.gradle(android)

    dependencies {
            classpath 'com.android.tools.build:gradle:3.5.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:4.3.0'
        }
    
    解决方案

    You need to use the following plugin:

    dependencies:
      firebase_auth: ^0.15.3
      cloud_firestore: ^0.13.0+1
    

    Don't forget to configure firebase:

    https://pub.dev/packages/cloud_firestore#setup

    https://pub.dev/packages/firebase_auth#usage

    Also in your app/build.gradle, increase the minSdkVersion:

    Change this:

    minSdkVersion 16
    

    into this:

    minSdkVersion 23
    

    这篇关于Flutter:Java 使用或覆盖已弃用的 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    08-23 11:57