when I try to "sync project with gradle files" a warning pops up

Viewed 92928
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
12 Answers

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

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

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.)

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!

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.

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

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.

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.

add

compileSdkVersion(30)
buildToolsVersion("30.0.1")

instead of

compileSdkVersion flutter.compileSdkVersion

in app/build.gradle

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

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

add this to dependencies in build.gradle

dependencies {

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

}
Related