So, I'm using Flutter and on running the App, I receive errors like these in the debug console:

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01

I did flutter clean, but no effect.

I tried the answer here: How to change build tools version in Android Studio

But, when I look for build.gradle file, I have two files one in /android and another in /android/app. But both of these do not have any configuration to change buildToolsVersion.

I did sdkmanager --list_installed and I hae two build-tools versions:

  build-tools;29.0.2   | 29.0.2  | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2  
  build-tools;30.0.2   | 30.0.2  | Android SDK Build-Tools 30.0.2 | build-tools/30.0.2  

What should I do to fix this Warning ?

Also, I am not using Android Studio. I used this guide to install Flutter without Android Studio: How to Install and Configure Flutter Without Android Studio


Solution 1: Suganya

It not happen becuase of you have two build-tools version installed. It happens because of caches so on android studio just invalidating caches and restarting will fix this.


Solution 2: Leviticus

Try deleting and reinstalling the SDK platforms. Delete the folders in ~\Android\Sdk\platforms and download the SDKs you need.

Edit: The above somehow resolved the issue before, but I ran into the same problem again when more external packages were updated. This time, deleting the SDK platforms didn't work. Instead, I updated Gradle in two locations in my project:

android/build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.1' // Update this line
        ...
    }
}

Note: 7.2.1 for the Android Gradle Plugin is the latest stable release present at this time in Google's Maven repository. To check for newer versions, visit https://maven.google.com, or the release notes. Under com.android.tools.build > gradle you will find the versions available for Android.

android/gradle/wrapper/gradle-wrapper.properties

...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip # Update this line

Updating the plugin in these two spots resolved the issue for me this time. Hope this helps.


Solution 3: Shrinath Gupta

1.Update gradle plugin as mentioned in the top-voted answer

2.Add android:exported="true" inside activity element in android/app/src/main/AndroidManifest.xml


Solution 4: Jinto Joseph

as per the top-voted answer, the bug not fixed for me.....

so using this way fixed my bug

  1. first updated the "android sdk build-tools" to 32

path :android studio>sdk manager>system setting>android sdk>sdk tool> update "android sdk build-tools"

then

android/build.gradle added this line

 dependencies {
        classpath 'com.android.tools.build:gradle:7.0.1'

then

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

after

"flutter clean" on terminal

restart

i am using flutter 2.8.1 , after that we can see in android/.gradle new file will appear that is 7.0.2 folder

so using this way fixed my bug


Solution 5: Md. Majharul Haque

Please change two files:

  1. android/build.gradle and set as the following under dependencies:

classpath 'com.android.tools.build:gradle:7.2.1'

  1. android/gradle/wrapper/gradle-wrapper.properties and set the following: Here the Gradle version should be compatible with the mentioned in the build.gradle file.

distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip


Solution 6: HankScorpio

I encountered this error while setting up Unreal Engine 5.0.3 to build for Oculus Quest 2. I was getting this error consistently when running SetupAndroid.bat

None of the other answers worked for me.

My solution to this was to (nuke it from orbit) uninstall Android Studio and delete the entire SDK directory. Then reinstall again and re-download the required SDK packages.

Fixed forever!