Sachin
Sachin

Reputation: 9

Flutter not running on Android Device

I just created a new project using command palletes in vsCode. then i start android simulator and then flutter run. it's running perfectly on ios not on android .

this debug console response

Launching lib/main.dart on Android SDK built for x86 in debug mode... FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugAidl'.

java.lang.IllegalStateException: aidl is missing from '/Users/sachin/Library/Android/sdk/build-tools/26.0.2/aidl' * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 1s Gradle build failed: 1 Exited (sigterm)

Upvotes: 1

Views: 1525

Answers (1)

Muhammad Fauzi Masykur
Muhammad Fauzi Masykur

Reputation: 2232

Just now I encounter the same problem. It happened because after doing "flutter run" there's still some file that needs to be downloaded, the build tools, but didn't get downloaded correctly, because I stopped it in the middle, since I thought the process was stuck.

So, these are the steps that solve the problem:

  1. open terminal
  2. change directory to /Users/[USERNAME]/Library/Android/sdk/build-tools/, in your case, type cd /Users/sachin/Library/Android/sdk/build-tools/
  3. remove the folder that causes the error, in your case the 26.0.2 folder, so in your terminal type rm -r 26.0.2 to remove it.
  4. go back to your code, make sure the android simulator is detected, and re run the project
  5. now, wait patiently, it may takes sometime (depends on internet connection), but it's downloading the build tools, you can watch this in the finder by typing open .
  6. make sure that in the 26.0.2 folder there's aidl file added when the process is finished.
  7. it should be working, if not, just rebuild/re-run your code one more time. Done!

Upvotes: 0

Related Questions