android studio bug : aidl is missing 解决方案

很久不打开Android studio 今天打开一下,发现之前配置好的开发环境不能用了!

项目中“R.”变红了,运行结果如下,可以说很怪,电脑没动过,怎么回事呢?

于是StackOverflow一下:

找到一段可能有用的话:

“This bug happens when the versions of SDK, Build Tools and Gradle Plugins doesn't match (in terms of compatibility). The solution is to verify whether you are using the latest version of them or not. The gradle plugins are placed in the build.gradle of the project, and the other versions are on the build.gradle of the module. For example, for SDK 23, you must use the Build Tools 23.0.1 and gradle plugins version 1.3.1.”

这时,我想应该是有些东西包更新了,有些包没更新导致的不匹配。又或者是那个360软件把里面的某个东西当做毒杀叼了。

这里面有3个东西的版本,在我电脑的东西:

1、SDK:(在我电脑中的位置C:\Users\Administrator\AppData\Local\Android\sdk)

下载最新SDK,AS:file/setting/Android SDK/SDK platforms/选择最新的Android API 下载,这里用API 27.

2、Build Tools:

AS会根据.gradle文件上写的版本号下载对应的tools。打开app文件夹下的build.gradle文件。

修改这两个参数。更改为最新版本,build tools就可以自动下载。(如果之后更新的话,去百度,Google找最新的对应关系。)

compileSdkVersion 27
buildToolsVersion "27.0.3"

3、Gradle Plugins:(在我电脑中的位置:C:\Program Files\Android\Android Studio\gradle\gradle-4.7-all\gradle-4.7)

AS与Gradle版本之间的对应关系如下,我AS是2.3.3版本,所以只要是3.3以上的Gradle都可以用。这里我用的是4.7

 问题得到解决。ok

总结,这个问题应该是360误杀了这个包中的部分文件导致不可用,因为之前是配置好的,我检查了一下自己并没有设置自动更新,每次更新都是需要我确认的。所以各位在处理这个问题的时候,要把360关掉。

总之出现这个问题,只要更新这3个部分就应该可以解决!

猜你喜欢

转载自www.cnblogs.com/JewinH/p/9037308.html