Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

This is my dependencies file and there is an underlined red colored text on the compile 'com.android.support:appcompat-v7.27.1.1'

apply plugin: 'com.android.application'
 android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.abc.mcaproject"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7.27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.0'
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'
apply plugin: 'com.google.gms.google-services'

This because of this I am having problems changing themes in the styles.xml

when you hover over the red line it may show you the image like this which I have attached below.Click to see the image

What it tells you is there is a conflict of the version in some libraries so it suggests us to add those. For my case first, it showed for CardView and then for Design. So I added to it. Below is the code for it.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.payumoney.sdkui:plug-n-play:1.2.0'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    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'

so kindly add those it may be 2 or more than that. Hope that helps.

In Android Studio 3.0 ,the compile configuration is now deprecated and should be replaced by implementation or api.

Just replace:

implementation 'com.android.support:appcompat-v7.27.1.1'

  • compile with implementation
  • testCompile with testImplementation.
  • debugCompile with debugImplementation.
  • androidTestCompile with androidTestImplementation.
  • compileOnly is still valid. It was added in 3.0 to replace provided and not compile.
  • for more information read this gradel doc

    Reason of fail

    You are using incompatible version of firebase with 27.1.1 support version.

    Current version > 16.0.0 and you use 11.6.0.

    Solution

    Update your firebase dependencies versions. I suggest update target sdk version also.

    Below is updated gradle as of date 1-10-2018, you can see firebase page to check latest version.

    apply plugin: 'com.android.application'
    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.abc.mcaproject"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7.28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.0'
        implementation 'com.google.firebase:firebase-database:16.0.2'
        implementation 'com.google.firebase:firebase-messaging:17.3.2'
        implementation 'com.google.firebase:firebase-auth:16.0.3'
        implementation 'com.google.firebase:firebase-storage:16.0.2'
    apply plugin: 'com.google.gms.google-services'
    

    Suggestion

    Migrate to androidx because Android will not update support libraries after version 28.0.0.

    just goto-> files->project structures->app->flavors change your min SDK version and target SDK version to "API 27:" then go to properties and check that your compile SDK version has also changed to the above version which you selected.

    This worked for me.

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.