Error:(9, 5) error: resource android:attr/dialogCornerRadius not found.
我的Android studio版本为3.0,gradle版本4.0.1,每次新建项目都会报该错误。网上的各路方法都试过均无效。因为之前做过的项目还是能运行的,就只有新建项目会出错,于是在对比了默认新建项目的配置文件后,发现gradle文件(如下图所示)中添加的依赖版本不一样,默认的版本是较新的版本。
猜想可能还是as和gradle版本导致的问题,于是修改了gradle文件中dependency中的配置,程序能成功运行了!!!只是有点麻烦,每次新建项目都要修改dependency版本,暂时没找到一劳永逸的办法。下面贴出自己能运行的依赖:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}
运行成功截图: