且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我的Android进阶之旅------>解决:Failed to create 'build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。

更新时间:2021-11-06 11:51:03

1. 错误描述

今天用Android Studio进行项目编译的时候,报错如下所示:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':watch:packageDebug'.
> Failed to create 'D:\BBK_SVN\XTC_SSO\watch\build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.538 secs

我的Android进阶之旅------>解决:Failed to create 'build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。

编译不了,然后我打算重新Clean一遍后再重新打包编译。于是去点击Build–>Clean Project,结果clean都报错,如下所示:


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':watch:clean'.
> Unable to delete directory: D:\BBK_SVN\XTC_SSO\watch\build\outputs\apk

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.217 secs

我的Android进阶之旅------>解决:Failed to create 'build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。


2. 解决方法

  • 方法1:重启Android Studio
    首先我尝试重启Android Studio,但是这个方法失效。 无效!

  • 方法2:重启电脑

我进入到D:\BBK_SVN\XTC_SSO\watch\build\outputs\apk目录去进行手动删除该目录,发现删除不了,提示如下:

您需要来自administrator的权限才能对此文件进行更改

我的Android进阶之旅------>解决:Failed to create 'build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。

但是我的用户名就是administrator啊,无语了。
只能把Win7电脑重启了,重启后重新打开Android Studio 发现可以正常编译打包了。好吧,重启电脑用账户名为Administrator再重新登录一次即可。

重启电脑后,用Administrator账户重新登录,再重启Android Studio。有效!

  • 方法3:使用腾讯的电脑管家或者360等软件的文件粉碎功能,对文件夹进行粉碎,然后重新编译,有效!

我的Android进阶之旅------>解决:Failed to create 'build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。

作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng

我的Android进阶之旅------>解决:Failed to create 'build\outputs\apk\watch-debug-unaligned.apks': 拒绝访问。