0

I'm a newbie in flutter development. When I run my first program by Android Studio:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Flutter'),
        ),
        body: Center(
          child: Text('Hello World'),
        ),
      ),
    );
  }
}

I've just got bugs:

Warning: License for package Android SDK Build-Tools 28.0.3 not accepted. Checking the license for package Android SDK Platform 28 in C:\Users\MSI2\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Failed to install the following Android SDK packages as some licences have not been accepted. build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28 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\MSI2\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 1s Exception: Gradle task assembleDebug failed with exit code 1

So what should I do?

Huy Mụn
  • 1
  • 1
  • run flutter doctor then check the licenses for you android APIs – king mort Aug 09 '20 at 11:51
  • Open android code separately in android studio. Open Gradle and change the build version to the latest version (29) u installed in your system. try to build again. The issue will resolve. this is happening because the android studio is not able to download SDK you mentioned in your code. – Yabaze Cool Aug 09 '20 at 12:06

2 Answers2

0

Run flutter doctor then accept licenses for android

Johny Saini
  • 879
  • 1
  • 5
  • 6
0
  1. Execute command prompt as administrator;
  2. Run the command flutter doctor --android-licenses and accept all licenses;
  3. flutter doctor -v to check if the issue was solved;
king mort
  • 1,423
  • 8
  • 12