关于compile constraint-layout:1.0.2的错误解决

本文介绍了解决在Android Studio中使用ConstraintLayout时遇到版本冲突的方法。建议先通过SDK Manager安装必要的工具,若问题依旧存在,则考虑调整ConstraintLayout的版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在生成新项目时或者向原有项目引入constraint-layout:1.0.2时产生的错误如下图所示:
产生的错误如图

解决方法:

点击Android studio 中的 Tools -> Android ->SDK Manager
点击 SDK Tools 然后 安装 好之后 重新打开 Android studio 就会好
安装support

如果还是报错就请降低constraint-layout的引入版本
附constraint-layout的现有版本
constraint-layout的版本
或者直接粘贴下面 代码 修改 后面版本好就好
compile ‘com.android.support.constraint:constraint-layout:1.0.1’

apply plugin: 'com.android.application' android { compileSdkVersion 31 signingConfigs { debug { storeFile file('..\\signkeystore\\platform_debug.keystore') storePassword 'android' keyAlias = 'androiddebugkey' keyPassword 'android' } } defaultConfig { applicationId "com.sgrl.pjj.factorymode" minSdkVersion 21 targetSdkVersion 33 versionCode getFactoryVersion("code") versionName getFactoryVersion("name") testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } gradle.projectsEvaluated{ tasks.withType(JavaCompile) { Set<File> fileSet = options.bootstrapClasspath.getFiles() List<File> newFileList = new ArrayList<>(); newFileList.add(new File("libs/framework-minus-apex.jar")) newFileList.add(new File("libs/framework-wifi.jar")) newFileList.addAll(fileSet) options.bootstrapClasspath = files(newFileList.toArray()) } } sourceSets{ main { jni.srcDirs = [] } } lintOptions { checkReleaseBuilds false abortOnError false } } dependencies { compileOnly files('libs/framework-minus-apex.jar') compileOnly files('libs/framework-wifi.jar') implementation files('libs/zxing.jar') implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:recyclerview-v7:24.2.1' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } static def getFactoryVersion(type){ int major = 5 int iteration = 0 Process process = "git rev-list --count HEAD".execute() process.waitFor() int count = process.getText().toInteger() if ("code" == type){ major * 1000000 + count }else if ("name" == type){ String today = new Date().format("yyMMdd") process = "git describe --always".execute() process.waitFor() String sha1 = process.getText().trim() "$major.$iteration.$count.$today.$sha1" }else if("apk_ver" == type){ "$major.$iteration.$count" } } android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "FactoryMode_V" + getFactoryVersion("apk_ver") + ".apk" } } 对照上文,我找到了build.gradle ,这里面提供的版本会是多少
03-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值