Android Exception: Build failed,unaligned.apks 拒绝访问
2016-04-12 12:39
656 查看
Question
Android Studio中,Build时报错,Execution failed for task ‘:app:packageDebug’,详见如下::app:mergeDebugJniLibFolders :app:transformNative_libsWithMergeJniLibsForDebug :app:processDebugJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForDebug :app:validateDebugSigning :app:packageDebug FAILED Error:Execution failed for task ':app:packageDebug'. > Failed to create 'D:\...\app\build\outputs\apk\app-debug-unaligned.apks': 拒绝访问。 Information:BUILD FAILED Information:Total time: 24.975 secs Information:1 error
发生报错后,若直接去该目录下删除文件,发现无法删除,即便是用管理员权限也无法删除apks文件。
Solution
重启Windows操作系统。重启后,再次Build后成功。另外,据说使用电脑管家等防护软件的文件粉碎功能,对apk文件夹进行粉碎,然后重新编译也同样有效。
Extension
What is an aligned apk
Aligned APKs are optimized for RAM usage so they will consume less RAM in the devices.Zipalign is an archive alignment tool that provides important optimization to Android application (.apk) files..... The benefit is a reduction in the amount of RAM consumed when running the application.
Why unaligned?
通过Gradle构建后,在app/build/apk文件夹下会先生成app-debug-unaligned.apks,然后再从unaligned APK变为aligned,并生成aligned APK。The unaligned(signed) APK is needed because the signing an aligned apk will undo the alignment.
app-debug-unaligned.apk = Unaligned Signed APK
app-debug.apk = Aligned Signed APK (RAM optimized using zipalign)
APP的构建过程
官方文档解释:
Caution: zipalign must only be performed after the .apk file has been signed with your private key. If you perform zipalign before signing, then the signing procedure will undo the alignment.
相关文章推荐
- easyUI的datagrid每行数据添加操作按钮的方法
- iOS中break、continue、return三者的区别
- IOS的UI基础01
- HDU 5288 OO's sequence (2015多校第一场 二分查找)
- AndroidUI——后台线程更新UI的几种方式
- AndroidUI——PopupWindow焦点问题
- Android:android.database.sqlite.SQLiteConstraintException:UNIQUE constraint failed
- IOS开发-UI学习-sqlite数据库的操作
- 限制UITextField输入长度
- hdu-1530-Maximum Clique-找最大团
- select, iocp, epoll,kqueue及各种I/O复用机制
- RA layer request failed
- Unique Paths II
- IOS 关于取消延迟执行函数的种种。performSelector与cancelPreviousPerformRequestsWithTarget
- 一个 forceLayout() 和 requestLayout() 的测试
- iOS UITextField 限制输入长度,中英文混排,汉字占2个长度,英文数字占1个长度
- 缺陷跟踪工具jira和团队协作与项目管理工具conflunce
- LeetCode 之 Increasing Triplet Subsequence
- libjpeg.so.62: no version information available (required
- 遍历jenkins build后的文件夹,找出最新“build NO.”复制到制定目录进行操作