我正在尝试为此应用构建 APK 文件,但遇到了一些我不明白的错误。我已经搜索了这个平台和 Github,但没有任何帮助。 我该如何解决这个问题?
[+391809 ms] FAILURE: Build failed with an exception.
[ +8 ms] * What went wrong:
[ +4 ms] A problem occurred configuring project ':sqflite'.
[ +679 ms] > Could not resolve all artifacts for configuration ':sqflite:classpath'.
[ +76 ms] > Could not download tensorflow-lite-metadata.jar (org.tensorflow:tensorflow-lite-metadata:0.1.0-rc1)
[ +2 ms] > Could not get resource
'https://jcenter.bintray.com/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc1/tensorflow-lite-metadata-0.1.0-rc1.jar'.
[ +8 ms] > Could not GET
'https://jcenter.bintray.com/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc1/tensorflow-lite-metadata-0.1.0-rc1.jar'.
[ +5 ms] > Remote host closed connection during handshake
[ +3 ms] > Could not download flatbuffers-java.jar (com.google.flatbuffers:flatbuffers-java:1.12.0)
[ +8 ms] > Could not get resource
'https://jcenter.bintray.com/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.jar'.
[ +5 ms] > Could not GET
'https://jcenter.bintray.com/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.jar'.
[ +37 ms] > Remote host closed connection during handshake
[ +3 ms] > Could not get unknown property 'android' for project ':sqflite' of type org.gradle.api.Project.
[ +2 ms] * Try:
[ +3 ms] 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.
[ +3 ms] * Get more help at https://help.gradle.org
[ +4 ms] BUILD FAILED in 7m 21s
[+4489 ms] Running Gradle task 'assembleRelease'... (completed in 463.3s, longer than expected)
[ +93 ms] "flutter apk" took 495,189ms.
[ +62 ms] Gradle task assembleRelease failed with exit code 1
[ +160 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 buildGradleApp (package:flutter_tools/src/android/gradle.dart:416:7)
#2 _rootRunUnary (dart:async/zone.dart:1198:47)
#3 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#4 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#6 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#7 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#8 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#9 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#10 _DefaultProcessUtils.stream (package:flutter_tools/src/base/process.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 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#18 _rootRun (dart:async/zone.dart:1190:13)
#19 _CustomZone.run (dart:async/zone.dart:1093:19)
#20 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#21 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#22 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#23 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#24 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#25 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
我认为导致此错误的插件可能是:sqflite: ^1.3.2+1
。
更新:我使用了 flutter clean
并解决了上述问题。
然而,另一个出现了:
Execution failed for task ':app:validateSigningRelease'.
[ +64 ms] > Keystore file 'C:\Users\ZZZ\FlutterProjects\trivia\android\app\C:UsersZZZjkskey.jks' not found for signing config
'release'.
这里出了什么问题?为什么路径 C:UsersZZZjkskey.jks'
中缺少反斜杠?
答案 0 :(得分:0)
尝试使用以下内容:
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2'
答案 1 :(得分:0)
一周前我遇到了同样的问题,我执行了以下步骤来从此错误中恢复。
在文件夹 <select id="countryBirth"></select>
<select id="cityBirth"></select>
<br/>
<select id="countryBirth1"></select>
<select id="cityBirth1"></select>
中将 distributionUrl 更改为 android > gradle > wrapper > gradle-wrapper.properties
此后运行 https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
。
一旦完成,没有任何错误。从模拟器/测试手机卸载后,触发 flutter pub cache repair
命令并重新运行应用程序,错误应该已经消失了。
答案 2 :(得分:0)
我在 key.properties
文件中犯了一个错误。
在文件中,我将 storeFile
变量从存储 key.jks
的路径更改为 key.jks 并且构建成功。