找到Android Studio 3.0未知元素

前端之家收集整理的这篇文章主要介绍了找到Android Studio 3.0未知元素前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在我更新 Android Studio后,我的一个项目无法构建.错误消息是:
Error:(20) error: unknown element <library> found.
Error:(20) unknown element <library> found.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution Failed for task ':app:processDebugResources'.
    > Failed to execute aapt

我的SDK版本是25.我试图使缓存无效并添加distributionUrl = https://services.gradle.org/distributions/gradle-4.1-rc-2-all.zip,它们都不适用于我.

这是我的依赖项:

dependencies {
compile fileTree(dir: 'libs',include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',{
    exclude group: 'com.android.support',module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.4.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
testCompile 'junit:junit:4.12'

annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"

compile fileTree(dir: 'libs',include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'

compile 'com.microsoft.projectoxford:face:1.3.0'
}

这是删除DBFlow后的错误日志:

Error:(20) error: unknown element <library> found.
Error:(20) unknown element <library> found.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution Failed for task ':app:processDebugResources'.
    > Failed to execute aapt

解决方法

在根项目的gradle.properties中添加代码
android.enableAapt2=false

原文链接:https://www.f2er.com/android/316586.html

猜你在找的Android相关文章