如何解决应用程序 processDebugResources 错误?

Posted

技术标签:

【中文标题】如何解决应用程序 processDebugResources 错误?【英文标题】:How to resolve app processDebugResources error? 【发布时间】:2021-12-15 11:38:31 【问题描述】:

当我应用更改时..我得到一个找不到资源的调试错误..虽然资源格式绝对没有问题而且 xml 文件中没有错误(存在可绘制对象)..所以可能是什么导致这个问题?

错误信息:

任务:app:processDebugResources 任务:app:processDebugResources AGPBI: "kind":"error","text":"android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_market.xml","position":"startLine":76],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_market.xml:77: AAPT: 错误: 资源可绘制/搜索 (akaelevation.mi:drawable/search) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_new_profile.xml","position":"startLine":43],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_new_profile.xml:44: AAPT: 错误: 资源可绘制/已验证 (akaelevation.mi:drawable/verified) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_new_profile.xml","position":"startLine":350],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_new_profile.xml:351: AAPT: 错误: 资源 drawable/rectangle_11 (aka elevation.mi:drawable/rectangle_11) not found.\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_notifications.xml","position":"startLine":36],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_notifications.xml:37: AAPT: 错误: 资源 drawable/red_circle (aka elevation.mi:drawable/red_circle) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_profile.xml","position":"startLine":390],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_profile.xml:391: AAPT: 错误: 资源 drawable/rectangle_11 (aka elevation.mi:drawable/rectangle_11) not found.\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_selection_reset_password.xml","position":"startLine":81],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_selection_reset_password.xml:82: AAPT: 错误: 资源drawable/phone(又名elevation.mi:drawable/phone)未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_selection_reset_password.xml","position":"startLine":129],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_selection_reset_password.xml:130: AAPT: 错误: 资源 drawable/via_email (akaelevation.mi:drawable/via_email) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_test_player.xml","position":"startLine":135],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_test_player.xml:136: AAPT: 错误: 资源drawable/nopath___copy__24_(又名elevation.mi:drawable/nopath___copy__24_)未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_test_player.xml","position":"startLine":226],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_test_player.xml:227: AAPT: 错误: 资源 drawable/nopath___copy__9_ (akaelevation.mi:drawable/nopath___copy__9_) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\activity_test_player.xml","position":"startLine":287],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \activity_test_player.xml:288: AAPT: 错误: 资源 drawable/repeatoff (akaelevation.mi:drawable/repeatoff) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\album_options.xml","position":"startLine":37],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \album_options.xml:38: AAPT: 错误: 资源 drawable/rectangle_outline (akaelevation.mi:drawable/rectangle_outline) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\album_options.xml","position":"startLine":52],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \album_options.xml:53: AAPT: 错误: 资源 drawable/rectangle_outline (akaelevation.mi:drawable/rectangle_outline) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\cmets_view.xml","position":"startLine":46],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \cmets_view.xml:47: AAPT: 错误: 资源 drawable/play_black (akaelevation.mi:drawable/play_black) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\custom_pd.xml","position":"startLine":15],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \custom_pd.xml:16: AAPT: 错误: 找不到资源 drawable/pd (akaelevation.mi:drawable/pd)。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\details_item.xml","position":"startLine":58],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \details_item.xml:59: AAPT: 错误: 资源 drawable/rectangle_19 (aka elevation.mi:drawable/rectangle_19) not found.\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\edit_album.xml","position":"startLine":40],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \edit_album.xml:41: AAPT: 错误: 资源 drawable/rectangle_outline (akaelevation.mi:drawable/rectangle_outline) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\edit_album.xml","position":"startLine":54],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \edit_album.xml:55: AAPT: 错误: 资源 drawable/rectangle_outline (akaelevation.mi:drawable/rectangle_outline) 未找到。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\expanded_cover_photo.xml","position":"startLine":58],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \expanded_cover_photo.xml:59: AAPT: 错误: 资源 drawable/rectangle_11 (aka elevation.mi:drawable/rectangle_11) not found.\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\fragment_genre.xml","position":"startLine":34],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \fragment_genre.xml:35: AAPT: 错误: 找不到资源可绘制/搜索 (akaelevation.mi:drawable/search)。\n ","tool":"AAPT" AGPBI: "kind":"error","text":"Android 资源链接失败","sources":["file":"C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\ res\layout\fragment_market.xml","position":"startLine":34],"original":"ERROR:C:\Users\sharon\AndroidStudioProjects\Elevation2\app\src\main\res\layout \fragment_market.xml:35: AAPT: 错误: 找不到资源可绘制/搜索 (akaelevation.mi:drawable/search)。\n ","tool":"AAPT"

任务:app:processDebugResources 失败

【问题讨论】:

请修剪您的代码,以便更容易找到您的问题。请按照以下指南创建minimal reproducible example。 【参考方案1】:

原来一个xml文件中的一个错误会导致多个错误??好吧,这就是我刚刚发现的东西..但是我没有收到针对该特定 xml 布局的错误消息,而是从我的所有布局中获得了大量错误,这造成了巨大的混乱,因为通常您会从错误所在的位置收到错误消息已执行。

这就是我能够修复它的方法:

    将可绘制文件复制到 res/ 中 将文件粘贴在不同的文件夹中..在项目之外 永久删除了可绘制文件(在项目NB中:..不是我复制的那个) 重启安卓工作室 在资源管理器中导入了复制的可绘制文件(这创建了一个新的索引) 单击“应用更改” 7 然后轰隆隆!出现实际错误。这次不是所有的xml文件 8.修复错误(颜色名称) 应用更改,一切顺利

【讨论】:

以上是关于如何解决应用程序 processDebugResources 错误?的主要内容,如果未能解决你的问题,请参考以下文章

程序员如何解决问题呢?

如何解决 Android 应用程序受众网络中的质量检查问题?

如何解决此问题 Spring Boot 应用程序?

IIS应用程序池服务停止,如何解决?

什么是内存泄露?内存泄露如何解决?

如何解决“没有符合条件的 iOS 应用程序包 ID”?