Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Warning : Mapping new ns to old ns

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

like image 621
Mayank Avatar asked Jul 31 '21 08:07

Mayank


People also ask

How do you update buildToolsVersion?

If you want to change the Build Tools version in your project, that is specified in project's build. gradle file (in the 'app' module). Open the file and either add or update the Build Tools version you want to use by adding/updating the following property in the 'android' section: android { buildToolsVersion "27.0.


2 Answers

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.

like image 93
Leviticus Avatar answered Oct 11 '22 12:10

Leviticus


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

like image 2
Jinto Joseph Avatar answered Oct 11 '22 14:10

Jinto Joseph