简体   繁体   English

构建时拒绝Android Access

[英]Android Access is denied when building

I've recently switched over my project to Kotlin and went through all the precompiled errors I found. 我最近将我的项目切换到Kotlin,并经历了我发现的所有预编译错误。 I then went to build the project and I'm receiving this error. 然后,我去构建项目,并且收到此错误。

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. 错误:任务':app:transformResourcesWithMergeJavaResForDebug'的执行失败。 java.io.FileNotFoundException: D:\\Work\\knew-tek\\Knew_Tek\\app\\build\\intermediates\\transforms\\mergeJavaRes\\debug\\0\\META-INF\\LICENSE (Access is denied) java.io.FileNotFoundException:D:\\ Work \\ knew-tek \\ Knew_Tek \\ app \\ build \\ intermediates \\ transforms \\ mergeJavaRes \\ debug \\ 0 \\ META-INF \\ LICENSE(访问被拒绝)

I am using Android Studio 3.0 which really new, but from what I can tell this shouldn't happen. 我正在使用确实很新的Android Studio 3.0 ,但据我所知这应该不会发生。 I've drilled down into the file structure and have confirmed that the folder does exist. 我已深入研究文件结构,并确认该文件夹确实存在。 The only exception is that the LICENSE folder is lowercase instead of upper. 唯一的例外是LICENSE文件夹是小写而不是大写。 I don't believe this should affect anything, but I could be wrong. 我认为这不会影响任何事情,但我可能是错的。

You can just exclude it from packaging. 您可以将其从包装中排除。 Add this to your module-level build.gradle file: 将此添加到您的模块级build.gradle文件中:

android {
    ...

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
    }

    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM