android gradle //noinspection GradleCompatible

13,237

Solution 1

  • You can get this warning for your gradle configuration for example if your app code is mixing library versions.
  • A common example of this happening is with the Android support libraries.
  • Also if additional 3rd party libraries included in your project are using different versions, that can also present warnings.
  • Android Studio will show you details of the error message, before you suppress it with 'GradleCompatible' by hovering over the red warning line in the IDE (see attached screenshot).
  • '//noinspection GradleCompatible' just suppresses the warning. Basically do not inspect issues with Gradle compatibility, as relates to the next line of the config.

Example of GradleCompatible warning in Android Studio IDE

Solution 2

I had the same problem and finally I have added this line by pressing alt+enter, but before that check if the app compat library version is latest version that there is available for your app's target sdk version.

If that is okay and you are still getting the problem then do this by pressing alt+enter key (in ubuntu and windows) and (in mac os (os x) use command +shift +enter) add noinspection GradleCompatible this will help!

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'me.dm7.barcodescanner:zxing:1.9'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Share:
13,237

Related videos on Youtube

Amir Raza
Author by

Amir Raza

More than 5 years of experience in Android App development. Instructed Android and Web Programming at Saylani Welfare Internationl Trust.

Updated on November 08, 2022

Comments

  • Amir Raza
    Amir Raza about 10 hours

    What does it mean in android gradle.

    adding //noinspection GradleCompatible has resolve the conflict issue with dependencies.

  • Amir Raza
    Amir Raza over 4 years
    Ok i got the reason for happening but I want to know that what actually is the role of this line //noinspection GradleCompatible.
  • WildStyle
    WildStyle over 4 years
    //noinspection GradleCompatible - just suppresses the warning. Basically do not inspect issues with Gradle compatibility, as relates to the next line of the config. (added to my answer).
  • Maaz Bin Musa over 4 years
    Is it safe to use it? Or does it expose us to run time crashed a lot