Android的工作室1.3.2错误刷新时,摇篮摇篮、错误、工作室、Android

2023-09-03 21:31:13 作者:在你心里睡一下

我产生 build.gradle 从日食文件,并将其导入到Android的工作室。

不过,之后提神摇篮返回错误:

  

摇篮同步失败:找不到com.android.tools.build:gradle-1.12

这是的classpath

 类路径com.android.tools.build:gradle-1.12
 

这是我在我的摇篮目录:

  C:\用户\用户\ .gradle \包装\ dists中\摇篮-1.12-所有
 
小android模拟器,小姚Android模拟器工作室版本v6.2.7.0正式版

这是我在 gradle-wrapper.properties 在我的项目的根文件:

  distributionBase = GRADLE_USER_HOME
distributionPath =包装/ dists中
zipStoreBase = GRADLE_USER_HOME
zipStorePath =包装/ dists中
distributionUrl = HTTPS \://services.gradle.org/distributions/gradle-1.12-all.zip
 

这是错误日志:

  java.io.FileNotFoundException:无法找到路径摇篮主目录
    在com.android.tools.idea.gradle.util.GradleUtil.stopAllGradleDaemons(GradleUtil.java:462)
 

我应该怎么办?

我曾尝试使用不同的互联网连接,有/无代理。

感谢您的时间。

解决方案

不要混淆的摇篮 - 插件,Android和摇篮。 它们是不同的。你可以找到关于Android插件这里

随着的classpath 在你的摇篮文件,将 Android插件的摇篮版本

更改的classpath 使用:

 类路径com.android.tools.build:gradle:1.3.1
 

来代替:

 类路径com.android.tools.build:gradle-1.12
 

gradle-wrapper.properties 文件将摇篮的版本。例如,2.4版本。

  distributionUrl = HTTPS \://services.gradle.org/distributions/gradle-2.4-all.zip
 

I generated build.gradle file from eclipse and import it to android studio.

However, it returns error after "refreshing gradle" :

Gradle sync failed: Could not find com.android.tools.build:gradle-1.12

This is the classpath :

classpath 'com.android.tools.build:gradle-1.12'

This is what i have in my gradle directory :

C:\Users\user\.gradle\wrapper\dists\gradle-1.12-all

And this is what i have in gradle-wrapper.properties file in my project's root :

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip

This is the error log :

java.io.FileNotFoundException: Unable to find path to Gradle home directory
    at com.android.tools.idea.gradle.util.GradleUtil.stopAllGradleDaemons(GradleUtil.java:462)

What should i do?

I have tried to use different internet connections, with/without proxy.

Thanks for your time.

解决方案

Don't confuse the gradle-plugin for Android and gradle. They are different. You can find more info about the android plugin here

With the classpath inside your gradle files, you set the version of the android plugin for Gradle.

Change your classpath using:

classpath 'com.android.tools.build:gradle:1.3.1'

instead of:

classpath 'com.android.tools.build:gradle-1.12'

In the gradle-wrapper.properties file you set the version of the Gradle. For example the 2.4 version.

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip