AAPT2错误:检查日志以获取详细信息AGPBI

时间:2018-10-17 15:32:13

标签: java android android-studio

Executing tasks: [clean, :app:assembleDebug]

:clean UP-TO-DATE
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceDebug
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
C:\Users\Marco\AndroidStudioProjects\ClassFinding\app\src\main\AndroidManifest.xml:39:9-41:45 Warning:
    Element meta-data#android.support.PARENT_ACTIVITY at AndroidManifest.xml:39:9-41:45 duplicated with element declared at AndroidManifest.xml:31:9-33:45
:app:splitsDiscoveryTaskDebug
AGPBI: {"kind":"error","text":"error: resource drawable/ic_launcher_background (aka com.example.venturicompany.classfinding:drawable/ic_launcher_background) not found.","sources":[{"file":"C:\\Users\\Marco\\AndroidStudioProjects\\ClassFinding\\app\\src\\main\\res\\mipmap-anydpi-v26\\ic_launcher.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource drawable/ic_launcher_background (aka com.example.venturicompany.classfinding:drawable/ic_launcher_background) not found.","sources":[{"file":"C:\\Users\\Marco\\AndroidStudioProjects\\ClassFinding\\app\\src\\main\\res\\mipmap-anydpi-v26\\ic_launcher_round.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}
:app:processDebugResources
error: failed linking file resources.
:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to process resources, see aapt output above for details.

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

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
15 actionable tasks: 13 executed, 2 up-to-date

我已经尝试过使用“ android.enableAapt2=false”,但是Android Studio不允许我禁用它。

如何解决这个问题?

我正在使用最新版本的Android Studio。

3 个答案:

答案 0 :(得分:0)

  

{“种类”:“错误”,“文本”:“错误:资源   drawable/ic_launcher_background(又名   com.example.venturicompany.classfinding:drawable/ic_launcher_background)   未找到

它正在寻找找不到的ic_launcher_background。但是,将ic启动器图标放在/mipmap目录中。然后,使用Android Studio的图片素材资源创建背景-前景图标。它将也为ic启动器创建背景。

但是,似乎它也定义了两次:

  

AndroidManifest.xml:39:9-41:45 重复,其中元素声明为   AndroidManifest.xml:31:9-33:45

需要检查的地方。

答案 1 :(得分:0)

Mainfest.xml是错误的:

  

元素元数据#android.support。 PARENT_ACTIVITY ,位于AndroidManifest.xml:39

     

与在AndroidManifest.xml:31声明的元素重复

答案 2 :(得分:0)

此行清楚显示

C:\Users\Marco\AndroidStudioProjects\ClassFinding\app\src\main\AndroidManifest.xml:39:9-41:45 Warning:
Element meta-data#android.support.PARENT_ACTIVITY at AndroidManifest.xml:39:9-41:45 duplicated with element declared at 

AndroidManifest.xml:31:9-33:45
:app:splitsDiscoveryTaskDebug
AGPBI: {"kind":"error","text":"error: resource drawable/ic_launcher_background (aka com.example.venturicompany.classfinding:drawable/ic_launcher_background) not found.","sources":[{"file":"C:\\Users\\Marco\\AndroidStudioProjects\\ClassFinding\\app\\src\\main\\res\\mipmap-anydpi-v26\\ic_launcher.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource drawable/ic_launcher_background (aka com.example.venturicompany.classfinding:drawable/ic_launcher_background) not found.","sources":[{"file":"C:\\Users\\Marco\\AndroidStudioProjects\\ClassFinding\\app\\src\\main\\res\\mipmap-anydpi-v26\\ic_launcher_round.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}

由于您尚未发布清单显示,因此我需要假设在第39行声明了重复元素,或者它们与您的ic启动器映像有问题 如果要设置应用图标,则可以按照
1)点击新的
2)点击图片资产
3)选择您的图片
4)点击完成
5)新图片可用于应用程序图标
6)如果您设置了新名称,则使用新名称更改清单

我认为您选择了新图片,并且没有更改新图片的清单(也许是问题所在)