折腾:
【未解决】Android Studio中Project Structure提示错误:rootProject.compileSdkVersion Unresolved reference Resolved android-23
期间,已经去把之前的:
android { compileSdkVersion compileSdkVersion
改回之前,本来可以正常编译的:
android { compileSdkVersion rootProject.ext.compileSdkVersion
但是此处编译却出错:
ERROR: Cause: compileSdkVersion is not specified.
所以感觉是:
还是要去加上之前的变量定义:
点击Simple value
但是输入了变量名后,无法输入value值
回车没用。
很是奇怪。
算了,去加到上面的build的script中:
突然发现,也没法添加
但是添加别的任意变量:
就可以。
说明是:上面的系统变量已有了,不允许再去插入?
原有的compileSdkVersion
倒是允许编辑:
然后此处郁闷了:
不论是clean project还是rebuild project,都无法编译了,都是报错:
Cause: compileSdkVersion is not specified.
且:没有给出具体的错误位置
不知道如何修复。
android studio gradle Cause: compileSdkVersion is not specified
说是:
你用的android.support是27+的版本:
看起来是:
implementation 'com.android.support:appcompat-v7:27.+'
所以compileSdkVersion和targetSdkVersion 都要用27
感觉和我此处对不上?
突然发现:
此处的
build.gradle
多了几个额外的空的定义:
ext { rootProject.ext.compileSdkVersion = '' rootProject.ext.compileSdkVersion = '' rootProject.ext.compileSdkVersion = '' rootProject.ext.compileSdkVersion = '' }
赶紧去掉,搞不好就是这个问题?
重新编译试试
问题依旧
发现仍有个别残留:
libs/nist_sip/build.gradle
android { compileSdkVersion compileSdkVersion
改为:
android { compileSdkVersion rootProject.ext.compileSdkVersion
结果:
终于至少不报错了:
【总结】
此处,android studio中有多个module子项目子模块
其中很多子模块都有:
build.gradle
android { compileSdkVersion compileSdkVersion
都已改为:
android { compileSdkVersion rootProject.ext.compileSdkVersion
但是编译还是报错。
原因:(由于之前不小心)个别还有残留
解决办法:也去改掉。即可。
转载请注明:在路上 » 【已解决】Android Studio中gradle报错:ERROR Cause compileSdkVersion is not specified