更新约束布局

时间:2017-07-16 15:35:41

标签: android android-constraintlayout

我无法安装新版本的约束布局和其他存储库,如CardView和RecyclerView

我的build.gradle文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.radin.myapplication"
    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.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7'
    compile 'com.android.support:recyclerview-v7'
}

我的SDK管理器中没有看到新版本的约束布局 Screen shot of my sdk Manager

当我点击安装资源库和同步项目时,没有任何事情发生Screen shot of my android studio

1 个答案:

答案 0 :(得分:0)

尝试单击安装存储库并同步Project并更改:

compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7'
compile 'com.android.support:recyclerview-v7'

为:

compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'

并从构建gradle文件中删除它:

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})