Mayank
Mayank

Reputation: 2013

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

Upvotes: 51

Views: 58550

Answers (7)

ArmandoHackCode
ArmandoHackCode

Reputation: 389

Trying between the above answers, I ran into some problems trying to maintain a project that was created a long time ago.

However, something occurred to me, add the references that are automatically created in the new Flutter projects (v3.7.x) I tried these references in the old project that I had and I was able to skip the errors that appeared in the console and I did not have any more issues. The changes I made are the following /build.gradle

buildscript {
ext.kotlin_version = '1.7.10'
....
}
...
dependencies {
    classpath 'com.android.tools.build:gradle:7.2.0'
    
...
}

in gradle/wapper/gradle-wrapper.properties

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

Upvotes: 0

Leviticus
Leviticus

Reputation: 1286

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.

Upvotes: 109

HankScorpio
HankScorpio

Reputation: 3651

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!

Upvotes: 0

Md. Majharul Haque
Md. Majharul Haque

Reputation: 11

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

Upvotes: 1

Jinto Joseph
Jinto Joseph

Reputation: 1424

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

Upvotes: 3

Shrinath Gupta
Shrinath Gupta

Reputation: 91

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

Upvotes: -5

Suganya
Suganya

Reputation: 439

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.

Upvotes: 1

Related Questions