[英]Android Studio 0.8.2 - Gradle project sync failed
In hindsight I should not have enabled L build stuff. 事后来说,我不应该启用L构建的东西。
I am new to programming and I created a new Android Studio project which is throwing the Gradle errror right away. 我是编程新手,我创建了一个新的Android Studio项目,它立即抛出了Gradle errror。
Errors are: 错误是:
yellow bar at the top - Gradle project sync failed. 顶部的黄色栏 - Gradle项目同步失败。 Basic functionality (eg editing, debugging) will not work properly. 基本功能(例如编辑,调试)将无法正常工作。 Try again Open Event Log Show Log in Finder 再试一次打开事件日志显示登录Finder
messages gradle sync - compileSdkVersion android-L requires compiling with JDK-7. 消息gradle sync - compileSdkVersion android-L需要使用JDK-7进行编译。 open sdk settings, open file. 打开sdk设置,打开文件。
tried looking through google and other stack overflow comments but did not find much I could make sense of except for Android Studio - Gradle sync project failed 尝试通过谷歌和其他堆栈溢出评论,但没有找到我能理解除Android Studio - Gradle同步项目失败
tried converting URL to 1.10 instead of 1.12 and syncing but that failed after syncing 尝试将URL转换为1.10而不是1.12并同步,但在同步后失败
I need help either getting L working or removing it so that a new studio project can compile to device without errors. 我需要帮助让L工作或删除它,以便新的工作室项目可以编译到设备没有错误。
I too faced the same issue and after days of trouble I figured it out. 我也遇到了同样的问题,经过几天的麻烦,我发现了它。 Just check if Java is installed 只需检查是否安装了Java
java -version java -version
Any version above JDK 6 is OK 任何高于JDK 6的版本都可以
open -a TextEdit ~/.bash_profile 打开-a TextEdit~ / .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home) export JAVA_HOME = $(/ usr / libexec / java_home)
export JDK_HOME=$(/usr/libexec/java_home) export JDK_HOME = $(/ usr / libexec / java_home)
source ~/.bash_profile source~ / .bash_profile
Now try gradle sync now, you must be able to complete sync 现在尝试gradle sync,你必须能够完成同步
The most simple solution (at least for me) would be: 最简单的解决方案(至少对我来说)将是:
Go to SDK manager (with Administrator rights), scroll down till the end, download "Android Support Library". 转到SDK管理员(具有管理员权限),向下滚动直到结束,下载“Android支持库”。
And it works (don't forget Administrator rights). 它有效(不要忘记管理员权限)。
For me Changing the JDK path worked. 对我来说改变JDK路径是有效的。 I changed it to /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home 我将其更改为/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
in File--> ProjecStructure-> JDK location. 在文件 - > ProjecStructure-> JDK位置。
When installing Android Studio on Mac OSX Sierra, I received an error that my JVM is not valid. 在Mac OSX Sierra上安装Android Studio时,我收到一条错误,指出我的JVM无效。 So I came here to a different post and installed Apple's legacy version and the up-to-date version. 所以,我来到这里 ,以不同的职位和安装苹果的旧版本和上最新版本。 It worked. 有效。 Then when I was creating a project I ran into another error which was the Gradle sync issue. 然后,当我创建一个项目时,我遇到了另一个错误,即Gradle同步问题。 Came here (this very post by "Mac") again and changed the JDK version that Android Studio was pointing to (obviously I chose to "detect" instead of browsing for the up-to-date version). 再次来到这里(这是“Mac”的帖子)并更改了Android Studio指向的JDK版本(显然我选择“检测”而不是浏览最新版本)。 Everything is working fine now. 现在一切都很好。
Mine was looking for the Java SDK in "Macintosh_HD>System>Library>Java> etc." 我在“Macintosh_HD>系统>库> Java>等”中寻找Java SDK。 but my most recent update was in "Macintosh_HD>Library>Java etc." 但我最近的更新是在“Macintosh_HD>库> Java等”中
I set this after clicking in the error window saying 'open SDK' 'open file' which brings you to the screen where to set the path for Java. 我在错误窗口中单击“打开SDK”“打开文件”后设置此项,它会将您带到设置Java路径的屏幕。
this happen with me when I try import wrong repository complie 'me.dm7.barcodescanner:zxing:1.7.2'
, so any one face this problem may be that be the reason 这种情况发生在我尝试导入错误的存储库complie 'me.dm7.barcodescanner:zxing:1.7.2'
,所以任何一个人面对这个问题可能就是这个原因
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
The most simple solution (at least for me) would be: 最简单的解决方案(至少对我来说)将是:
Go to SDK manager (with Administrator rights), scroll down till the end, download "Android Support Library". 转到SDK管理员(具有管理员权限),向下滚动直到结束,下载“Android支持库”。
And it works (don't forget Administrator rights). 它有效(不要忘记管理员权限)。
I am using windows 7 works properly thanks igor 我正在使用Windows 7正常工作,感谢igor
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.