解决gradle /Users/xxxx/Documents/workspace/fontmanager/.gradle/2.2.1/taskArtifacts/cache.properties (No such file or directory)报错办法

git 上down下项目后,发现Android Studio报错:
What went wrong:
java.io.FileNotFoundException: /Users/raomengyang/Documents/workspace/fontmanager/.gradle/2.2.1/taskArtifacts/cache.properties (No such file or directory)
> /Users/raomengyang/Documents/workspace/fontmanager/.gradle/2.2.1/taskArtifacts/cache.properties (No such file or directory)
 
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 
 
1.项目中local.properties 的sdk.dir=  <此处SDK路径不同需修改>
2. Google一番没找到问题解决方法,cd 到Users/raomengyang/Documents/workspace/fontmanager/.gradle/2.2.1/ 后发现没有cache.properties文件,只有一个cache.properties.lock  感觉应该是这个文件被lock上了
➜ / cd Users/xxxxx(Username)/Documents/workspace/fontmanager
➜ fontmanager git:(temp) ✗ ls -a
. .gradle actionbarsherlock_new gradle local.properties.bak
.. .idea build gradlew local.properties.bak~HEAD
.git FontManage build.gradle gradlew.bat settings.gradle
.gitignore SliderLib fontmanager.iml local.properties viewpagerindicator
➜ fontmanager git:(temp) ✗ cd .gradle
➜ .gradle git:(temp) ✗ ls
2.2.1
➜ .gradle git:(temp) ✗ cd 2.2.1/taskArtifacts
➜ taskArtifacts git:(temp) ✗ ls
cache.properties.lock fileHashes.bin fileSnapshots.bin outputFileStates.bin taskArtifacts.bin
➜ taskArtifacts git:(temp) ✗ cache.properties.lock

 

于是cp cache.properties.lock /Users/raomengyang/Desktop
然后把文件的读取改为everyone 读写,并去掉.lock后缀变为cache.properties
再将其cp回去,项目成功运行。
 
—————————— Update ——————————
后来遇到类似的问题,在退出Android Studio后会提示后台有任务在进行,是否结束,关掉AS,然后重启即可。
 
posted @ 2015-03-26 08:10  Codios  阅读(9748)  评论(1编辑  收藏  举报