简体   繁体   中英

How to update build.gradle

I am learning Flutter, and I am using Android Studio IDE.

I wanted to use the Image Asset option to adjust the app icon. It said:

The project must be built with SDK 26 or later to use adaptive icons.

I followed what was said here: How to change Android minSdkVersion in flutter project ... and simply changed the minSdkVersion number to 26. I then selected 'Open for editing in Android Studio' and it said 'Gradle build finished' and everything was ticked, same in the sync tab.

I then go back to the build.gradle file in ./android/app/build.gradle and it is underlined in red.

In that file it shows an error, saying it cannot resolve symbol 'GradleException'. It is not being underlined in red in the window that opens when I click 'Open for editing in Android Studio'.

if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

Maybe this is just the IDE messing up? The app still runs on an emulator.

However when I go back to use the Image Asset, it still says I need version 26, and I don't know what to do now.

You have to change your minsdkversion to 26 or more. You will get your output.

Open: File -> Project Structure -> Platform Settings/SDKs. Choose build target 26 or higher.

File -> Project Structure

Platform Settings/SDKs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM