Search code examples
androidfluttergradleflutter-pluginflutter-build

how do you resolve flutter build errors?


I am trying to build the APK file for this app but I'm getting some errors I don't understand. I have searched this platform and Github but none are helping. How can I resolve this issue?

[+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) 

I think the plugin causing this error maybe this: sqflite: ^1.3.2+1.

UPDATE: I used flutter clean and it resolved the above issue.

However, another came up:

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'.

What went wrong here? and why is the backward slash missing from the path C:UsersZZZjkskey.jks'?


Solution

  • I made a mistake in the key.properties file. In the file, I changed storeFile variable from the path where key.jks was stored to just key.jks and the build succeeded.