97
Warning: Mapping new ns schemas.android.com/repository/android/common/02 to old ns schemas.android.com/repository/android/common/01
Warning: Mapping new ns schemas.android.com/repository/android/generic/02 to old ns schemas.android.com/repository/android/generic/01
Warning: Mapping new ns schemas.android.com/sdk/android/repo/addon2/02 to old ns schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns /schemas.android.com/sdk/android/repo/repository2/02 to old ns schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns schemas.android.com/sdk/android/repo/sys-img2/02 to old ns schemas.android.com/sdk/android/repo/sys-img2/01
Shady Mohamed Sherif
  • 15,003
  • 4
  • 45
  • 54
Qbert
  • 981
  • 1
  • 4
  • 3
  • 1
    For reference there are two issues in Google tracker you can star: https://issuetracker.google.com/issues/184759551 https://issuetracker.google.com/issues/190535786 – TWiStErRob Dec 17 '21 at 17:23

14 Answers14

76

this changes work for me with last gradle version 7.3.3

just edit this versions and build your app

android/build.gradle

buildscript {
   repositories {
       ...
   }

   dependencies {
      classpath 'com.android.tools.build:gradle:7.0.0'
      ...
   }
}

android/gradle/wrapper/gradle-wrapper.properties

...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
tahamv
  • 1,121
  • 9
  • 7
  • 3
    work for me , thank – malik kurosaki Jan 18 '22 at 16:46
  • this did the trick – zmeul Feb 15 '22 at 10:45
  • 4
    This alone didn't work for me. I got an error about the "android:exported". What I did to fix it is going into the android/app/src/main/AndroidManifest.xml and add "android:exported="true" in all the "activity" that didn't have it (just one in my case). Take a look at this to understand it further: https://developer.android.com/guide/topics/manifest/activity-element#exported I've got the info from here https://stackoverflow.com/questions/67654506/manifest-merger-failed-targeting-android-12/67668116#67668116 and here http://shorturl.at/mCEX7 – Guillem Poy Apr 01 '22 at 09:27
23

What works for me is the same as https://stackoverflow.com/a/70035679/17825313

But I could not find that menu in my AndroidStudio so have to update the content of these 2 files directly:

Basically just use the latest gradle plugin and gradle version and make sure they both match according to the official doc

android/build.gradle

buildscript {
   repositories {
       ...
   }

   dependencies {
      classpath 'com.android.tools.build:gradle:7.0.0'
      ...
   }
}

android/gradle/wrapper/gradle-wrapper.properties

... 
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
Pin
  • 231
  • 1
  • 3
  • 4
  • definitely cleaned my problem!!! Thank you!!! It also forced the build to also notice Android-31 SDK because gradle knows about that version! – Marcello DeSales Jan 04 '22 at 09:20
14

Issue seems to be related to buildToolsVersion. Changing it from:

compileSdkVersion(30)
buildToolsVersion("30.0.3")

To:

compileSdkVersion(30)
buildToolsVersion("30.0.2")

Fixed it to me (syntax may change if you're not using .gradle.kts file or gradle version >= gradle-7.0, but the idea is the same)

(AndroidStudio will show: Old buildToolsVersion 30.0.2; recommended version is 30.0.3 or later in build file. But the Warnings will be gone from gradle building logs.)

Gui Silva
  • 1,341
  • 15
  • 18
  • 1
    Why is `buildToolsVersion` needed at all? The project compiles fine without it. – IgorGanapolsky Jul 07 '21 at 16:06
  • 1
    @IgorGanapolsky buildToolsVersion is always used. Simply, if you don't write it, it will use the default buildToolsVersion of the SDK. – KJ Newtown Jul 13 '21 at 15:30
  • yeah :D, it's exactly what @KJNewtown said. Probably what was happening here is that android plugin was outdated with something (not sure what), and it was generating the warning. Changes are this will be automatically gone in the future – Gui Silva Jul 13 '21 at 18:33
  • where I have put this? @GuilhermeV. – Bagus Kurnianto Jul 26 '21 at 07:14
  • 1
    @BagusKurnianto in your build.gradle file, update it inside your "android" section – Gui Silva Jul 26 '21 at 17:26
  • 1
    `buildTools` definition is no longer required, it defaults to the latest available version and downloads it automatically from Google if it is not installed yet – nuhkoca Aug 30 '21 at 11:55
  • `buildToolsVersion("30.0.2")` is not available in neither of the `build.gradle` files!. But if the case is as @nuhkoca said, then that didn’t work somehow and I’m facing the same issue. – joe_inz Sep 13 '21 at 10:14
  • I've posted it a while back, the versions could have changed already. Make sure to have A.S updated, as well the plugins. If it still doesn't work, try to include the buildToolsVersion(...) instead of using the default as nuhkoca suggested :D – Gui Silva Sep 14 '21 at 13:09
  • It works after I update my module build.gradle to android { compileSdk 30 buildToolsVersion "30.0.3" defaultConfig {.....} – user1283182 Sep 22 '21 at 07:05
13

The mismatch is due to:

  • Android Gradle Plugin Version
  • Gradle Version

Match them as per the gradle plugin releases

Ref: https://developer.android.com/studio/releases/gradle-plugin

Android Gradle Plugin Version and Gradle Version

And the warnings will go away. cheers.

alkathirikhalid
  • 887
  • 12
  • 18
5

I had the same problem (using VS Code) and searched global (ctrl+shift+F): compileSdkVersion and instead of:

    compileSdkVersion flutter.compileSdkVersion

I changed it:

    compileSdkVersion 30

this worked for me, now it runs without the warning!

2

Your android SDK version and emulator API level must be the same.

If you are using the Android SDK version is 31 and trying to run over emulator API level 30 it would cause you some complications.

You must use the same level for both (android SDK and API level) to avoid many complications.

logify
  • 1,497
  • 1
  • 6
  • 7
2

Project Structure > Project and change Android Gradle Plugin Version to 7.0.3 or higher if available and Gradle Version to 7.3 or higher if available

Mohamed Ben Romdhane
  • 1,005
  • 3
  • 11
  • 22
1

I had a project showing this warnings. The Gradle Version was set to 7.0.2 and Android Gradle Plugin Version to 4.2.2. After changing the Android Gradle Plugin Version to 7.0.3 the problem was solved.

georgij
  • 2,054
  • 4
  • 27
  • 43
1

I solved this by adding a dependency on android/build.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
        ...
}
Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
0

I also faced the same isuue. Update your Gradle to latest version and update buildToolsVersion("30.0.3") to 4 or :10 in build.gradle (Module) file in android.

Aldan
  • 674
  • 9
  • 23
0

add

compileSdkVersion(30)
buildToolsVersion("30.0.1")

instead of

compileSdkVersion flutter.compileSdkVersion

in app/build.gradle

0

add this to dependencies in build.gradle

dependencies {

    implementation 'androidx.work:work-runtime:2.7.1'

}
jmoerdyk
  • 5,544
  • 7
  • 38
  • 49
0

To solve this problem, you can completely delete the android file and still run the project.

Or in file ..\android\build.gradle change

dependencies {
  classpath 'com.android.tools.build:gradle:7.0.0'
  .
  .
}

To the new version like

dependencies {
  classpath 'com.android.tools.build:gradle:7.3.0'
  .
  .
}

And in file ..\android\gradle\wrapper\gradle-wrapper.properties change

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

To the new version like

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Asse
  • 1
  • 1
0

By updating your android/build.gradle fixed these warnings:

Example:

buildscript {
    ext.kotlin_version = '1.8.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'

    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

ahmnouira
  • 1,607
  • 13
  • 8