我尝试导入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.+'
为了尝试新的constraintlayout,我安装了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()
}
}
...
答案 0 :(得分:1)
根据Android Studio Release Updates' webpage,[{1}}可用的最新版本为ConstraintLayout
所以我认为认为1.1.0
尚不可用是安全的。
答案 1 :(得分:1)
Alpha版本现已上市:)
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha1'
https://androidstudio.googleblog.com/2018/06/constraintlayout-200-alpha-1.html