我尝试导入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/