android - 无法导入 gradleconstraintlayout 2.0

标签 android android-constraintlayout

我尝试导入constraintlayout 2.0但没有成功 如果尝试将其导入到 gradle 但无法解决该问题。但如果我导入constraintlayout 1.1.0,它就像一个魅力

作品:

compile 'com.android.support.constraint:constraint-layout:1.1.0'

不起作用:

compile 'com.android.support.constraint:constraint-layout:2.+'

为了尝试新的约束布局,我安装了 android studio 3.2。我还有附带的最新工具。 我检查了sdk工具,在支持存储库下看不到constraintlayout 2.0。

android {
    compileSdkVersion 'android-P'
    defaultConfig {
        applicationId "com.example.pteran_pc.test28"
        minSdkVersion 'P'
        targetSdkVersion 'P'
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
    implementation 'androidx.constraintlayout:constraintlayout:2.+'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha1'
}

主要构建gradle

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-alpha14'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
...

最佳答案

alpha 版本现已推出:)

implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha1'

https://androidstudio.googleblog.com/2018/06/constraintlayout-200-alpha-1.html

关于android - 无法导入 gradleconstraintlayout 2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50394488/

相关文章:

Android 从 GCM 迁移到 oneSignal 推送通知

android - Facebook Graph API 按类别搜索地点

android - ConstraintLayout layout_constraintHorizo​​ntal_bias 似乎不起作用

android - 约束布局 : animating multiple views at once

android - 如何将 float 操作按钮放置在约束布局内屏幕的右下角?

android - 如何确定为什么我的库中的文本大小如此之大?

android - 使用 dropbox sync API 的 android 应用程序可以使用本地安装的 dropbox 官方应用程序的缓存、文件系统和文件吗?

android - R.layout-land 无法解析为变量

android - 当键盘打开时,包裹在 ScrollView 中的 ConstraintLayout 仍然会调整大小

android - 约束布局按钮文本居中对齐