[SOLVED] Warning: Mapping new ns to old ns
Hey! Flutter Dev if you are here that means your are facing warning about Mapping new ns to old ns , you recently updated to Flutter SDK 2.10, and the project shows the red warning. Though the project will run properly. This solution is related to an old version of Gradle in Android Native projects that need migration to the new Gradle Version. I found the proper solution for this issue.
Error: Mapping new ns to old ns
Launching lib\main.dart on ONEPLUS A6010 in debug mode... Running Gradle task 'assembleDebug'... Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01 Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01 Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Solution
Follow below steps:
1. Clean your project
Run flutter clean
command and make sure <project>/build
folder and <project>/android/build
is deleted.
2. Update gradle.properties
Got to gradle-wrapper.properties
file located at <project>/android/gradle
, then set value to distributionUrl
to whatever latest gradle distribution is available, https\://services.gradle.org/distributions/gradle-7.4-bin.zip
#Wed Feb 16 23:35:26 IST 2022 distributionBase=GRADLE_USER_HOME distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME
3. Update project build.gradle
Update your android build.gradle
file located at <project>/android/build.gradle
with new version of Gradle and Kotlin available at this time.
classpath 'com.android.tools.build:gradle:7.1.1'
and ext.kotlin_version = '1.6.10'
buildscript { ext.kotlin_version = '1.6.10' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.10' } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir }
4. Final Step
Run flutter packages get
, then run your flutter app first it may take more time as IDE downloads new files.
Thanks for reading our tutorial. Hopefully It helped you
ASK Flutter questions for FREE!
Ask me anywhere your flutter questions from basic to advance topics for free. Instagram , LinkedIn, Discord
Leave A Reply
You must be logged in to post a comment.
2 Comments
Helpful👌
Hello, you used 7.4 earlier but used 7.1.1.
i don’t understand