flatter:java使用或覆盖不推荐的api

lsmepo6l  于 2021-08-25  发布在  Java
关注(0)|答案(2)|浏览(354)

我一直在尝试在android/iosFlutter应用程序中使用auth、firestore firebase,在测试了几个不同版本后,遇到了许多不同的问题。现在,它向我显示了构建日志中的几条消息。
构建日志
注意:d:\flatter\sdk\flatter.pub cache\hosted\pub.dartlang.org\firebase\u core-0.4.3+1\android\src\main\java\io\flatter\plugins\firebase\core\firebasecoreplugin.java使用或覆盖不推荐使用的api。注意:有关详细信息,请使用-xlint:deprecation重新编译。注意:d:\flatter\sdk\flatter.pub cache\hosted\pub.dartlang.org\cloud\u firestore-0.13.0+1\android\src\main\java\io\flatter\plugins\firebase\cloudfirestore\cloudfirestoreplugin.java使用未经检查或不安全的操作。注意:使用-xlint重新编译:未选中以获取详细信息。d8:无法在单个dex文件中容纳请求的类(#methods:81454>65536)com.android.builder.dexing.dexarchivemergerexception:合并dex存档时出错:.dex文件中的方法引用数不能超过64k。了解如何在上解决此问题https://developer.android.com/tools/building/multidex.html 在com.android.builder.dexing.d8dexarchivemerge.getexceptiontorethrow(d8dexarchivemerge.java:131)在com.android.builder.dexing.d8dexarchivemerge.mergedexarchives(d8dexarchivemerge.java:118)在com.android.build.gradle.internal.transforms.dexmergerttransferormcallable.call(dexmergerttransferormcallable.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)

at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)

    at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
    at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
    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.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
    at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)

    at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
    at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    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.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)

    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    at java.lang.Thread.run(Thread.java:748) Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to

在com.android.tools.r8.utils.t.a(:55)在com.android.tools.r8.d8.run(:11)在com.android.builder.dexing.d8dexarchivemerge.mergedexarchives(d8dexarchivemerge.java:116)完成。。。34更多原因:com.android.tools.r8.utils.abortexception:错误:null,无法在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)的单个dex文件中容纳请求的类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多
失败:生成失败,出现异常。
错误:任务“: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中失败
Flutter医生-v
[√] Flutter(通道稳定,v1.12.13+修补程序.5,在microsoft windows[version 10.0.18362.535]上,语言环境为en-in)
•Flutter版本1.12.13+修补程序.5,位于d:\flatter\sdk\flatter

• Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0

[√] android工具链-为android设备开发(android sdk版本29.0.2)
•位于c:\users\admin\appdata\local\android\sdk的android sdk

• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android SDK\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.

[√] android studio(3.5版)
•位于d:\android sdk的android studio

• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

公共规范

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'
    }
laximzn5

laximzn51#

您需要使用以下插件:

dependencies:
  firebase_auth: ^0.15.3
  cloud_firestore: ^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
5cnsuln7

5cnsuln72#

要使用低于21的minsdkversion,您必须将应用程序配置为多索引,如下所示:

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 28
        multiDexEnabled true
    }
    ...
}

dependencies {
  implementation "androidx.multidex:multidex:2.0.1"
}

在此之后,请运行

flutter pub upgrade
flutter pub get
flutter clean
flutter run

在Flutter清理之后,它仍然会抛出警告,但至少支持早期版本是可能的。更多关于官方文件的信息

相关问题