问题描述:


想要在Android Studio中运行项目,但是如下图所示,运行按钮为灰色不可用

androidkiller报错No resource found that matches the given name: attr

点击下拉按钮,选择Edit Configurations

androidkiller报错No resource found that matches the given name: attr

androidkiller报错No resource found that matches the given name: attr

点击左上角的绿色加号,添加一个Android App,如下图椭圆标注部分,同样也是没有可选的module

androidkiller报错No resource found that matches the given name: attr

解决方案:

此时,运行按钮为绿色,但是左侧的HBKNApp却标注存在错误,如下图所示

androidkiller报错No resource found that matches the given name: attr

点击绿色运行按钮,提示存在如下问题

androidkiller报错No resource found that matches the given name: attr

File--Sync Project With Gradle Files

androidkiller报错No resource found that matches the given name: attr

执行结果如下图所示,不存在android-26的SDK

androidkiller报错No resource found that matches the given name: attr

查看build.gradle文件,发现编译和目标sdk均为26

androidkiller报错No resource found that matches the given name: attr

点击上图中的安装缺失平台并同步项目的链接,如下图所示

 

androidkiller报错No resource found that matches the given name: attr

androidkiller报错No resource found that matches the given name: attr

点击next,如下图所示,开始下载并安装android-26,安装完成后点击finish

androidkiller报错No resource found that matches the given name: attr

点击finish后,会自动进行Sync Project With Gradle Files,提示存在如下问题,点击蓝色链接Install Build Tools 26.0.2 and sync project

androidkiller报错No resource found that matches the given name: attr

androidkiller报错No resource found that matches the given name: attr

下载并安装完成后点击Finish,会自动进行Sync Project With Gradle Files,如下图会download一些内容。

androidkiller报错No resource found that matches the given name: attr

最后构建成功完成,如下图所示

androidkiller报错No resource found that matches the given name: attr

此时,绿色运行按钮左侧列表中多了一个app

androidkiller报错No resource found that matches the given name: attr

如下图所示,可以通过USB连接真实的设备,也可以创建模拟器,来调试应用程序

androidkiller报错No resource found that matches the given name: attr