Java Android Studio:无法创建 MD5 HashFile
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43221538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio: Failed to create MD5 HashFile
提问by Damen Tomassi
I am creating a simple android application... I ran into some kind of trouble when I updated gradle when I launched Android Studio and it prompted me too.
我正在创建一个简单的 android 应用程序...当我在启动 Android Studio 时更新 gradle 时遇到了一些麻烦,它也提示了我。
Upon the update completing I receive the following error:
更新完成后,我收到以下错误:
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
错误:任务 ':app:compileDebugJavaWithJavac' 的执行失败。
Failed to create MD5 hash for file '/Users/damenTomassi/AndroidStudioProjects/AstraeaDemo/app/src/main/res/libs/gson-2.3.1.jar'.
无法为文件“/Users/damenTomassi/AndroidStudioProjects/AstraeaDemo/app/src/main/res/libs/gson-2.3.1.jar”创建 MD5 哈希。
I used to have the GSON library in my project, however I no longer needed it so I removed it...
我曾经在我的项目中有 GSON 库,但是我不再需要它所以我删除了它......
Does anyone have any suggestions?
有没有人有什么建议?
采纳答案by RAJESH KUMAR ARUMUGAM
Try this
尝试这个
Step 1: Removethis compile files('lib/gson-2.3.1.jar')from Your build.gradleFile
步骤 1: 从您的build.gradle文件中删除此编译文件('lib/gson-2.3.1.jar')
Step 2: Build-> Clean Project
第 2 步: 构建-> 清理项目
回答by Rakshitha B R
I could solve this issue by deselecting Instant Run. You can do this by going to
我可以通过取消选择 Instant Run 来解决这个问题。你可以这样做
File
->settings
->build,execution,deplyment
->deselect instant run
.
File
-> settings
-> build,execution,deplyment
->deselect instant run
。
回答by James
I had this issue today, and after wasting an hour trying everything else mentioned I updated my Android Studio to the latest release and got a different error message that the jar file did not exist. Checking my project this error was correct, I had,
我今天遇到了这个问题,在浪费了一个小时尝试了所有提到的其他内容之后,我将我的 Android Studio 更新到了最新版本,并收到了一条不同的错误消息,即 jar 文件不存在。检查我的项目这个错误是正确的,我有,
compile files('libs/activation.jar')
compile files('libs/mail.jar')
compile 'com.sun.mail:android-mail:1.5.5'
compile 'com.sun.mail:android-activation:1.5.5'
But did not have a file, libs/activation.jar, for some reason this use to work fine, but stopped working today. I change it to just,
但是没有一个文件,libs/activation.jar,由于某种原因,这个使用工作正常,但今天停止工作。我把它改成只是
compile 'com.sun.mail:android-mail:1.5.5'
compile 'com.sun.mail:android-activation:1.5.5'
and my build now works again. Odd, but I did try commenting out those lines before, but still got the error, so maybe updating Studio helped too, or I needed to do a combination of the above.
我的构建现在又可以工作了。奇怪,但我之前确实尝试过注释掉这些行,但仍然出现错误,所以也许更新 Studio 也有帮助,或者我需要结合上述内容。
Anyway problem solved and check that your jars actually existing in the libs directory.
无论如何,问题已解决并检查您的 jars 是否确实存在于 libs 目录中。
回答by jcady
This seems to be a transient issue in gradle. I fixed it by killing the running gradle daemons (pkill -f gradle
) and rebuilding.
这似乎是 gradle 中的一个暂时性问题。我通过杀死正在运行的 gradle 守护进程 ( pkill -f gradle
) 并重建来修复它。