Warning: unexpected element (uri:"", local:"base-extension") after Android Target SDK was updated to 31.0.0

Viewed 33857

After I update the target Android SDK from 30.0.3 to 31.0.0 I started to have these 2 warnings :

This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.

Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>

I tried to update all the libraries but it didn't help. Anyone had this warning ?

7 Answers

This is caused by using a newer version of commandline-tools to download the packages of Android SDK, while your project is probably using an older version of Gradle.

Enter your Android SDK directory and delete everything but the licenses folder. Try to rebuild your project and Gradle will redownload all the tools needed. This time the warning won't be logged.

Answer from an "official" source:

As mentioned in the message, this is happening because you have some packages that were installed that are using the v3 format for package.xml, but then reading it with a tool that only knows about v2. Probably you installed some components using the canary studio. If you want to you could uninstall the problem components and reinstall using sdkmanager or the stable studio. Or you could just ignore the message for now, until the new cmdline-tools is out, which should happen alongside the next studio stable release. -- https://issuetracker.google.com/issues/207386175#comment3

It come from an update of Gradle after installation of Android SDK PLateforms & an application's build.

This require reinstallation of SDK Plateforms & delete/rebuild of application.

To remove the warning :

  • Uninstall SDK Plateforms>Android SDK Platform XX
  • Delete all files built by the application (build folder, gradle files, …)
  • re-Install SDK Plateforms>Android SDK Platform XX
  • Build application

Source : https://titanium.dzzd.net/t/gradle-warning-message-during-building/36/8?u=dzzd

I have been working on my project for two months but when I export into flutter build appbundle brings the same error.

Solution it's to delete the Android sdk latest and search on Google for later version of 2 and install the sdk commandtool line and it will work, errors all gone.

Flutter build appbundle success.

Try to uninstall the current Android studio and download the later like Android studio 4.1.3 and and Android api 30.

The easiest solution is if you have a stable internet connection leave it until the run process is finish It will work and install on your phone. if it works follow me

I'm also getting this message trying to use sdkmanager and avdmanager (no Android Studio installed).

Related