1.android studio更新后出现的Gradlesync failed: Unknown host等gradle问题解决办法
首先打开androidstudio项目 找到项目目录gradle\wrapper\gradle-wrapper.properties这个文件
内容如下
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.10.all.zip
androidstudio会联网下载符合当前版本的gradle插件,而这个网址虽然可以访问但速度实在太慢,所以每次更新需要花很长时间或直接超时
修改gradle引用本地文件
distributionUrl=file:///C:/Users/downloads/gradle-2.1-all.zip
打开别人的androidstudio project,下载新的gradle版本太慢,可以修改build.gradle文件中
classpath 'com.android.tools.build:gradle:2.2.2' ,变成自己有的版面
如果有提示gradle版本不一致的问题,请先到http://services.gradle.org/distributions下载你所需要的Gradle版本并在android studio--> file -->setting -->Build ExecutionDeployment-->Build Tools-->Gradle使用”use local gradledistribution" 选择使用你下载的gradle版本,再尝试编译你的app
l 重点推荐gradle更新不了时直接删除gradleproperties中的代理项。
2.Unsupported method: AndroidProject.getPluginGeneration() while runningproject
It can occur because AS was checking availability of theInstant Run feature. The fixed is to disable Instant Run:
Windows & Linux:
File -> Settings -> Build, Execution, Deployment -> InstantRun.
Mac:
AndroidStudio -> Preferences -> Build, Execution, Deployment -> InstantRun.