Flutter无法建立发布APK

时间:2020-10-04 09:05:29

标签: android flutter dart apk

我运行了抖动.flow_from_directory()一切正常,我运行了一个调试apk,但它运行正常,但是在运行发行版apk时出现了这个问题

build apk --release

尽管我的项目使用Running Gradle task 'assembleRelease'... 386,9s (!) The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility. Building plugin audioplayers... Running Gradle task 'assembleAarRelease'... 6,2s FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'audioplayers'. > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. * 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 5s The plugin audioplayers could not be built due to the issue above. Process finished with exit code 1 ,因为错误表示该软件包存在问题,我未使用它,但又出现了另一个相同的问题,直到我删除了所有软件包 我需要帮助

2 个答案:

答案 0 :(得分:0)

在准备发布APK时,您无需运行-release 命令。 假设您已按照文档(https://flutter.dev/docs/deployment/android)正确设置了build.gradle,只需运行此命令:(here

flutter build apk

[编辑] 您可以上传看到的整个日志条目吗?除非确保增加日志的详细程度。因此,在这种情况下:

flutter build apk -v

然后将其上传到线程。您使用的软件包与您当前的Android版本(最低)不兼容。您在gradle.build文件中设置的最低Android SDK版本是什么?确保设置为所有软件包都支持的数字。根据包装的不同,但根据我的经验,21岁就足以涵盖整个领域。

答案 1 :(得分:0)

 FAILURE: Build failed with an exception.

                    * What went wrong:
                    A problem occurred configuring root project 'audioplayers'.
                    > SDK location not found. Define location with sdk.dir in the local.properties file or
                    with an ANDROID_HOME environment variable.

                    * 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 3s
[   +2 ms] Running Gradle task 'assembleAarRelease'... (completed in 3,9s)
[   +2 ms] 
           FAILURE: Build failed with an exception.
           
           * What went wrong:
           A problem occurred configuring root project 'audioplayers'.
           > SDK location not found. Define location with sdk.dir in the local.properties file or with an
ANDROID_HOME environment variable.
           
           * 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 3s
           
[  +10 ms] "flutter apk" took 184 621ms.
[   +8 ms] The plugin audioplayers could not be built due to the issue above.
[   +2 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      buildPluginsAsAar (package:flutter_tools/src/android/gradle.dart:848:7)
           #2      _asyncErrorWrapperHelper.errorCallback (dart:async-patch/async_patch.dart:91:64)
           #3      _rootRunBinary (dart:async/zone.dart:1214:47)
           #4      _CustomZone.runBinary (dart:async/zone.dart:1107:19)
           #5      _FutureListener.handleError (dart:async/future_impl.dart:157:20)
           #6      Future._propagateToListeners.handleError (dart:async/future_impl.dart:708:47)
           #7      Future._propagateToListeners (dart:async/future_impl.dart:729:24)
           #8      Future._completeError (dart:async/future_impl.dart:537:5)
           #9      _AsyncAwaitCompleter.completeError (dart:async-patch/async_patch.dart:47:15)
           #10     buildGradleAar (package:flutter_tools/src/android/gradle.dart)
           #11     _rootRunUnary (dart:async/zone.dart:1198:47)
           #12     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #13     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #14     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #15     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #16     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #17     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #18     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #19     _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart)
           #20     _rootRunUnary (dart:async/zone.dart:1198:47)
           #21     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #22     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #23     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #24     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #25     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #26     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #27     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #28     _run (package:flutter_tools/src/base/error_handling_io.dart)
           #29     _rootRunUnary (dart:async/zone.dart:1198:47)
           #30     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #31     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #32     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #33     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #34     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #35     Future.wait.<anonymous closure> (dart:async/future.dart:414:23)
           #36     _rootRunUnary (dart:async/zone.dart:1198:47)
           #37     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #38     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #39     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #40     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #41     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #42     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #43     _rootRun (dart:async/zone.dart:1190:13)
           #44     _CustomZone.run (dart:async/zone.dart:1093:19)
           #45     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #46     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #47     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #48     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #49     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #50     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
           
           
[ +263 ms] ensureAnalyticsSent: 257ms
[   +6 ms] Running shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +1 ms] exiting with code 1
相关问题