Hello friends, Recently when I was creating a new flutter project and build it then I saw it is showing a Error about Mapping new ns. The error is too big and red. Though the project build and run properly but It bothers me that why it is showing us a error. So I decided to Google it. Once I Google it then I saw this error is regarding to old android Gradle and to solve it we have to update the Gradle in our flutter project to latest one. Thanks to some help from internet I found the proper working solution for this error and solve it. So in this tutorial we would learn about Flutter Project Build Warning: Mapping new ns Error Solution.
Error Screenshot :-
D:\Flutter\app2>flutter run
Using hardware rendering with device Android SDK built for x86. If you notice
graphics artifacts, consider enabling software rendering with
“–enable-software-rendering”.
Launching lib\main.dart on Android SDK built for x86 in debug mode…
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/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/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Running Gradle task ‘assembleDebug’… 134.9s
โ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk… 1,702ms
Syncing files to device Android SDK built for x86… 344msFlutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate “flutter run” but leave application running).
c Clear the screen
q Quit (terminate the application on the device).Running with sound null safety
An Observatory debugger and profiler on Android SDK built for x86 is available at:
http://127.0.0.1:62583/0POl_0o450o=/
The Flutter DevTools debugger and profiler on Android SDK built for x86 is available at:
http://127.0.0.1:9100?uri=http://127.0.0.1:62583/0POl_0o450o=/
Content in this project Flutter Project Build Warning: Mapping new ns Error Solution :-
1. To solve the Mapping error, First we have to Open Your_Flutter_App -> android -> build.gradle file and text editor. I’m using Visual Studio Code editor. Now go inside dependencies block in buildscript and Here you have to update your old build Gradle to new com.android.tools.build:gradle:7.0.2.
Source Code of My build.gradle file after updating :-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
buildscript { ext.kotlin_version = '1.3.50' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.0.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir } |
2. Now we have to also update Gradle distributionUrl in Your_Flutter_Project -> android -> gradle -> wrapper -> gradle-wrapper.properties file. So open this file and put new Gradle URL https\://services.gradle.org/distributions/gradle-7.2-all.zip .
Source Code of My gradle-wrapper.properties file after updating :-
1 2 3 4 5 6 |
#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip |
3. Now the main part, We have to clean our flutter project build and rebuilt it again. So open your flutter project Root directory in CMD or Terminal and execute flutter cleanย command.
4. Now you are good to go. All you have to do is run your flutter project with
flutter runย command and you will see that the error is gone.
Thanks for reading our tutorial. Hopefully It helped you ๐ .
Thanks bro!
Welcome Bro ๐ .
TNX a LOOOOT ๐
Welcome ๐ .
thanks !
Welcome ๐ .
bro, thank you very much, anyone else can’t explain how fixed
Welcome Bro ๐ .
Thank You!
thanks, but when I create an other new project I’m still facing the same problem again. is there any way I can solve this issue permanently?? thanks again
yes.. it worked