【问题标题】:Failed to resolve: com.android.support: design-v7:25.3.1无法解决:com.android.support:design-v7:25.3.1
【发布时间】:2018-06-01 12:17:09
【问题描述】:

这是我的学校项目。我的代码中有 1 个错误;

无法解决:com.android.support:design-v7:25.3.1

我做过这些事情: 一个。将我的项目结构配置成25。 湾。在我的依赖项 gradle 上添加了 compile 'com.android.support:support-core-utils:25.3.1'。 C. 用这段代码更新我的另一个 gradle d。在我的 SDK 管理器上下载 Android API 25

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

而且,我仍然收到该错误消息。

这是我的 build.gridle 完整代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.lenovo.home"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner     "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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.3.1'
    compile 'com.android.support:design-v7:25.3.1'
    compile 'com.android.support:support-core-utils:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

这是我的错误信息:

【问题讨论】:

  • 这可能会有所帮助... --> stackoverflow.com/questions/44691858/…
  • @JayDangar我已经完成了所有这些事情(正如我之前在我的问题中所说的那样)但仍然收到相同的错误消息:')
  • 你能把你问题中的所有错误都加进去吗??

标签: java android android-gradle-plugin


【解决方案1】:

用途:

compile 'com.android.support:design:25.3.1'

代替

compile 'com.android.support:design-v7:25.3.1'

作为

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.lenovo.home"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner     "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
     }

    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.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-core-utils:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    }

【讨论】:

  • 构建后出现 19 个错误 :') 我将 v7 用于我的应用程序 :)
  • Gradle 问题必须在此之后解决。 v7 仅适用于或 appCompat... 不适用于设计。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-26
  • 1970-01-01
  • 2017-10-28
  • 2018-01-03
相关资源
最近更新 更多