Flutter not building the android dependencies - flutter

Folks,
I am re-building an already built flutter application upon changing of the laptop. However I have strangely observed that the dependencies that we mention in the pubspec, not all of them are getting compiled. Those ones which has native dependencies and eventually have android code base in the dependencies fail to compile. I am cluless how this is happening and where should i look forward to get this going. The only error I get is as below. The contentious dependencies were share and connectivity
warning: [options] source value 7 is obsolete and will be removed in a future release
[ +5 ms] warning: [options] target value 7 is obsolete and will be removed in a future release
[ +1 ms] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[ +1 ms] error: warnings found and -Werror specified
[ +190 ms] FAILURE: Build failed with an exception.
[ ] * What went wrong:
[ ] Execution failed for task ':share:compileDebugJavaWithJavac'.
[ +97 ms] > Compilation failed; see the compiler error output for details.
[ ] * 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.
[ +3 ms] * Get more help at https://help.gradle.org
[ +1 ms] BUILD FAILED in 1m 41s
[ +1 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[ +1 ms] Use '--warning-mode all' to show the individual deprecation warnings.
[ +5 ms] See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
[ ] 410 actionable tasks: 4 executed, 406 up-to-date
[ +794 ms] Running Gradle task 'assembleDebug'... (completed in 103.9s)
[ +9 ms] Exception: Gradle task assembleDebug failed with exit code 1
[ +4 ms] "flutter run" took 1,08,191ms.
[ +9 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:836:33)
<asynchronous suspension>
#4 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart)
#5 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
#6 _rootRun (dart:async/zone.dart:1190:13)
#7 _CustomZone.run (dart:async/zone.dart:1093:19)
#8 _runZoned (dart:async/zone.dart:1630:10)
#9 runZoned (dart:async/zone.dart:1550:10)
#10 AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
#11 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:825:20)
#12 CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#13 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:335:21)
#14 _rootRunUnary (dart:async/zone.dart:1198:47)
#15 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
#16 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#17 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#18 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#19 Future._completeWithValue (dart:async/future_impl.dart:529:5)
#20 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#21 _rootRun (dart:async/zone.dart:1190:13)
#22 _CustomZone.run (dart:async/zone.dart:1093:19)
#23 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#24 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#25 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#26 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#27 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#28 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
[ +6 ms] ensureAnalyticsSent: 3ms
[ +3 ms] Running shutdown hooks
[ ] Shutdown hook priority 4
[ +12 ms] Shutdown hooks complete
[ +1 ms] exiting with code 1
I am using flutter 1.22.6 stable
dart 2.10.5
Gradle 6.5
I have tried it out with 1.22.3 and also with 1.20.4, still this is not taking me anywhere. All that it ends up is not compiling the dependencies having android code in it. gradlew assembleDebug --info and likes of it has resulted in me understanding that the java symbols are not created which eventually are not found by the compilation script, hence it is generating error.

things ive done so far:
run with --no-sound-null-safety and --verbose
find dependencies that complain and check for updates, then update to latest in pubspec
one dependency complained about android min sdk version in gradle.build, so i updated accordingly
now i can build to my test machine and work out the runtime bugs!
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Flutter

Related

Incompatible types: MainActivity cannot be converted to FlutterEngine, GeneratedPluginRegistrant.registerWith(this);

I had an old project kind off like a POC 2-3 years old in flutter,
Now when I try to run it on the latest version I get the following error:
On Flutter Run:
/Users/jci/Documents/Projects/Flutter/dicee/android/app/src/main/java/co/appbrewery/dicee/MainActivity.java:11: error: incompatible types: MainActivity cannot be converted to FlutterEngine
GeneratedPluginRegistrant.registerWith(this);
^
Note: /Users/jci/Documents/Projects/Flutter/dicee/android/app/src/main/java/co/appbrewery/dicee/MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 21s
Exception: Gradle task assembleDebug failed with exit code 1
Flutter Run -v:
[ +1 ms] /Users/jci/Documents/Projects/Flutter/dicee-flutter/android/app/src/main/java/co/appbrewery/dicee/MainActivity.java:11: error: incompatible types:
MainActivity cannot be converted to FlutterEngine
[ +2 ms] GeneratedPluginRegistrant.registerWith(this);
[ ] ^
[ ] Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
[ ] 1 error
[ ] FAILURE: Build failed with an exception.
[ ] * What went wrong:
[ ] Execution failed for task ':app:compileDebugJavaWithJavac'.
[ ] > Compilation failed; see the compiler error output for details.
[ ] * 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
[ ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[ ] Use '--warning-mode all' to show the individual deprecation warnings.
[ ] See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
[ ] 17 actionable tasks: 5 executed, 12 up-to-date
[ +379 ms] Running Gradle task 'assembleDebug'... (completed in 4.3s)
[+2421 ms] Exception: Gradle task assembleDebug failed with exit code 1
[ +1 ms] "flutter run" took 21,908ms.
[ +3 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:699:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
Not quite certain if it's a single error or multiple, my guess is it has something to do with my gradle any help whatsoever is appreciated.
It's been a while since I have not checked flutter so I am not sure what the error means...
After putting in some hours into this I realized that the issue was with my Activity having the old flutter engine config code, to fix this all i had to do was go from this:
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
where it was registering PluginRegistrant to that:
import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
}
More information in the Flutter Github Upgradation document

Flutter VS Code Emulator stuck at Running Gradle task 'assembleDebug'

Since yesterday evening I've been unable to open my app in emulator. It worked fine till then.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
It usually takes about 2 mins to open but it was just stuck there for like 15 mins. So I looked up for answers and the first one said to use gradlew clean and gradlew build. I did that and still was stuck but with another error.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_android-2.0.12\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Then I tried an answer from a similar question here that suggested to do flutter pub cache repair. Still no luck.
Then I tried another suggestion from an answer here to upgrade flutter. I hadn't upgraded flutter for a couple months since so I did that but still the issue persists.
I read from a comment to a question here that when they run the project using flutter run -v in terminal it opened up after about 20 mins. So I started it and because my laptop is like 6 years old running 6th gen i5 with 8gb ram I thought it might take a bit longer. So I left it there and now after about 2 hours my terminal is stuck at:
I hit the question character limit so I put the terminal's output in
an online notepad at: https://anotepad.com/notes/3jri4gpc
I just closed the emulator and the terminal added this to the above
[+7331895 ms] executing: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages com.example.myapp
[ +90 ms] adb.exe: device offline
[ +27 ms] ProcessException: Process exited abnormally:
adb.exe: device offline
Command: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages com.example.myapp
[ +3 ms] Installing APK.
[ +17 ms] Installing build\app\outputs\flutter-apk\app.apk...
[ +8 ms] executing: C:\Users\hp\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install -t -r
D:\myapp\front\myapp\build\app\outputs\flutter-apk\app.apk
[ +114 ms] Performing Push Install
adb: error: failed to get feature set: device 'emulator-5554' not found
[ +6 ms] Installing build\app\outputs\flutter-apk\app.apk... (completed in 115ms)
[ +5 ms] Error: ADB exited with exit code -1
[ +4 ms] Performing Push Install
adb: error: failed to get feature set: device 'emulator-5554' not found
[ +1 ms] Warning: Failed to install APK.
[ +4 ms] Error launching application on Android SDK built for x86.
[ +9 ms] "flutter run" took 7,368,695ms.
[ +23 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:687:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[ +172 ms] ensureAnalyticsSent: 163ms
[ +10 ms] Running shutdown hooks
[ +2 ms] Shutdown hooks complete
[ +2 ms] exiting with code 1
From [+7331895 ms] executing: in the first line after closing the emulator I can see that this was running for about 122 minutes.
I don't understand what's wrong here. Why did the emulator stop working normally all of a sudden?
How to make it work so that I can continue with my app development? Please help.

Could not resolve all artifacts for configuration ':classpath' in flutter

Yesterday i woke up and found my Visual studio misbehaving. I had to delete all my file in .graddle folder and then re-download them but it's giving the errors below, i have tried googling for solutions but all in vain.
I am using Graddle:
gradle-6.7-all.zip
I am using linux mint distro.
-Pfilesystem-scheme=org-dartlang-root assembleDebug
[+454406 ms] FAILURE: Build failed with an exception.
[ +7 ms] * What went wrong:
[ +1 ms] A problem occurred configuring root project 'android'.
[ +1 ms] > Could not resolve all artifacts for configuration ':classpath'.
[ +2 ms] > Could not download builder-4.1.0.jar (com.android.tools.build:builder:4.1.0)
[ +1 ms] > Could not get resource
'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/4.1.0/builder-4.1.0.jar'.
[ +9 ms] > Premature end of Content-Length delimited message body (expected: 9,546,513; received: 4,456,416)
[ +2 ms] > Could not download kotlin-compiler-embeddable-1.3.50.jar
(org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50)
[ +11 ms] > Could not get resource
'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.3.50/kotlin-compiler-embeddable-1.3.50.jar'.
[ +4 ms] > Premature end of Content-Length delimited message body (expected: 36,615,572; received: 4,456,416)
[ +1 ms] > Could not download fastutil-7.2.0.jar (it.unimi.dsi:fastutil:7.2.0)
[ +2 ms] > Could not get resource 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'.
[ +5 ms] > Premature end of Content-Length delimited message body (expected: 17,309,408; received: 6,553,552)
[ +2 ms] * Try:
[ +2 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
[ +1 ms] BUILD FAILED in 7m 33s
[ +627 ms] Running Gradle task 'assembleDebug'... (completed in 455.5s)
[ +10 ms] Exception: Gradle task assembleDebug failed with exit code 1
[ +4 ms] "flutter run" took 461,160ms.
[ +14 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:644:9)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1009:27)
<asynchronous suspension>
#4 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#5 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#6 CommandRunner.runCommand (package:args/command_runner.dart:197:13)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
<asynchronous suspension>
#8 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#10 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
<asynchronous suspension>
#11 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#12 run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#15 runInContext (package:flutter_tools/src/context_runner.dart:73:10)
<asynchronous suspension>
#16 main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>
[ +260 ms] ensureAnalyticsSent: 252ms
[ +3 ms] Running shutdown hooks
[ ] Shutdown hook priority 4
[ +14 ms] Shutdown hooks complete
[ +1 ms] exiting with code 1

Objectbox Generator Detailed Info about Issues?

When I run the objectbox_generator with flutter packages pub run build_runner watch the classes are being generated in the JSON, but shortly after that the Generation fails due to a null check issue. I checked my code and couldn't find any null check issues. Is there a way to show more detailed logs (e.g. where it is located) ?
[INFO] Starting Build
[INFO] Updating asset graph...
[INFO] Updating asset graph completed, took 0ms
[INFO] Running build...
[INFO] 1.0s elapsed, 14/20 actions completed.
[INFO] 2.1s elapsed, 38/54 actions completed.
[INFO] Running build completed, took 2.4s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 100ms
// Here the failing info
[SEVERE] objectbox_generator:generator on lib/$lib$ (cached):
Null check operator used on a null value
[SEVERE] Failed after 2.5s
Same command with additional info flutter packages pub run build_runner build --verbose:
[INFO] Build:Running build...
[INFO] objectbox_generator:generator on lib/$lib$:Package: fit_x
[INFO] objectbox_generator:generator on lib/$lib$:Found 15 entities in: (lib/domain/ob/collection_exercise.objectbox.info, lib/domain/ob/equipment.objectbox.info, lib/domain/ob/equipment_setting.objectbox.info, ..., lib/domain/ob/workout_collection.objectbox.info, lib/domain/ob/workout_log.objectbox.info)
[INFO] objectbox_generator:generator on lib/$lib$:Using model: lib/objectbox-model.json
[SEVERE] objectbox_generator:generator on lib/$lib$:
Null check operator used on a null value
package:objectbox_generator/src/code_chunks.dart 444:38 CodeChunks.backlinkRelInfo
package:objectbox_generator/src/code_chunks.dart 488:18 CodeChunks.toManyRelations.<fn>
dart:_internal ListIterable.join
package:objectbox_generator/src/code_chunks.dart 489:12 CodeChunks.toManyRelations
package:objectbox_generator/src/code_chunks.dart 134:46 CodeChunks.entityBinding
package:objectbox_generator/src/code_chunks.dart 32:71 CodeChunks.objectboxDart.<fn>
package:collection/src/iterable_extensions.dart 173:20 IterableExtension.mapIndexed
dart:core Iterable.join
package:objectbox_generator/src/code_chunks.dart 32:99 CodeChunks.objectboxDart
package:objectbox_generator/src/code_builder.dart 97:27 CodeBuilder.updateCode
package:objectbox_generator/src/code_builder.dart 57:5 CodeBuilder.build
[INFO] Build:Running build completed, took 349ms
[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 117ms
[SEVERE] Build:
Failed after 476ms
[+3823 ms] "flutter run" took 3.927ms.
[ +5 ms] pub finished with exit code 1
[ +2 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:366:7)
<asynchronous suspension>
#2 PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:241:5)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
<asynchronous suspension>
#4 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#5 CommandRunner.runCommand (package:args/command_runner.dart:196:13)
<asynchronous suspension>
#6 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
<asynchronous suspension>
#7 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#8 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
<asynchronous suspension>
#9 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
[ +74 ms] ensureAnalyticsSent: 67ms
[ +1 ms] Running shutdown hooks
[ ] Shutdown hooks complete
[ ] exiting with code 1
From the code it looks like you have a #Backlink() to an unknown entity (one that is not stored in the DB)... try to check those backlinks (and comment them out to see if that works) and when you've found which one triggers this, consider opening an issue on objectbox-dart's GitHub with the minimal example.
P. S. as for the null check failure - yeah, needs a better error (one that tells you about the missing entity) - https://github.com/objectbox/objectbox-dart/commit/00aabe224eaa9bb88ab2bc18a5c31f00b4f3bdc0

Gradle build failed to produce an .apk file

After upgrading Flutter from 1.9.7 to v1.12.13+hotfix.5 my application build failed. I got the following exception:
[ +124 ms] > Task :draw:compileFossDebugSources UP-TO-DATE
[ +5 ms] > Task :draw:assembleFossDebug UP-TO-DATE
[ +136 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
[ ] Use '--warning-mode all' to show the individual deprecation warnings.
[ ] See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
[ ] BUILD SUCCESSFUL in 5m 30s
[ ] 396 actionable tasks: 16 executed, 380 up-to-date
[ +529 ms] Running Gradle task 'assembleFossDebug'... (completed in 331.1s, longer than expected)
[ +35 ms] "flutter run" took 332,133ms.
Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\flutter_projects\my_branch\iamflexi_app\build, but the tool couldn't find it.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 _exitWithExpectedFileNotFound (package:flutter_tools/src/android/gradle.dart:827:3)
#2 findApkFiles (package:flutter_tools/src/android/gradle.dart:765:5)
#3 buildGradleApp (package:flutter_tools/src/android/gradle.dart:451:35)
#4 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#5 _rootRunUnary (dart:async/zone.dart:1134:38)
#6 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#7 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#8 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#9 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#10 Future._completeWithValue (dart:async/future_impl.dart:524:5)
#11 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:32:15)
#12 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:290:13)
#13 _DefaultProcessUtils.stream (package:flutter_tools/src/base/process.dart)
#14 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#15 _rootRunUnary (dart:async/zone.dart:1134:38)
#16 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#17 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#18 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#19 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#20 Future._completeWithValue (dart:async/future_impl.dart:524:5)
#21 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:554:7)
#22 _rootRun (dart:async/zone.dart:1126:13)
#23 _CustomZone.run (dart:async/zone.dart:1023:19)
#24 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#25 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#26 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#27 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#28 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#29 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)
However when i open my application in Android module in Android Studio then it runs fine but when i tried to run with Flutter i got that error.
Using Android Studio may prompt you to upgrade the project's settings (i.e. gradle version). A quick fix for this issue is by downgrading to the project's previous gradle version as previously mentioned in the comments. You can also try going through suggestions posted on this GitHub issue thread ahttps://github.com/flutter/flutter/issues/45681 and see if anything works for you.