Home > Blockchain >  Unable to compile Flutter demo script in Android Studio
Unable to compile Flutter demo script in Android Studio

Time:12-29

I am new to app development and started learning Flutter. But when I try to run the default dummy script in Nexux 6 Virtual Phone, it gives me error and quits! Here is the code:

Running Gradle task 'assembleDebug'...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Checking the license for package Android SDK Build-Tools 29.0.2 in C:\Users\Raghaw Panpaliya\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not create task ':app:minifyReleaseWithR8'.
      > Failed to install the following Android SDK packages as some licences have not been accepted.
           build-tools;29.0.2 Android SDK Build-Tools 29.0.2
        To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
        Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

        Using Android SDK: C:\Users\Raghaw Panpaliya\AppData\Local\Android\sdk

* 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
Exception: Gradle task assembleDebug failed with exit code 1```

CodePudding user response:

Open SDK manager:

img

then select Android Sdk Command-line Tools
Note: If it's already checked then

  • Uncheck
  • Apply
  • Re-check
  • Apply

img

Alternatively in Android Studio for Windows:

Go to File -> Settings -> Appearance & Behaviour -> System Settings -> Android SDK -> SDK Tools -> check Google Play Licensing Library -> check Android SDK Platform-Tools -> check Android SDK Command-line-Tools(latest) -> Click Apply, and then Ok

After the installation, build your application. It should work. check the status running flutter doctor from command line

  • Related