添加新的支持库红线当前库

adding new support library redlines the current library

我的gradle文件

  compileSdkVersion 25
  buildToolsVersion "25.0.3"

  minSdkVersion 17
  targetSdkVersion 25

    dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
    })
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

添加 'compile com.android.support:cardview-v7:25.4.0 会导致 compile 'com.android.support:appcompat-v7:25.3.1' 被加红线 `` 在我的代码中,我想在我的应用程序中使用 CardView 功能并且仅使用 compile 'com.android.support:appcompat-v7:25.3.1' 没有完成工作

我该怎么做才能避免在我的代码中使用相互冲突的库?这意味着什么?

我在红线上玩鼠标时收到的错误信息

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.4.0, 25.3.1. Examples include com.android.support:cardview-v7:25.4.0 and com.android.support:animated-vector-drawable:25.3.1 less... (Ctrl+F1) 
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.) 

那是因为您尝试添加的 CardView 版本高于您的 appcompat 版本。所以为了解决这个问题,你需要使用相同的版本

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'