AAPT:错误:<item>内部元素必须是资源引用或为空

时间:2019-03-01 11:04:19

标签: java android gradle android-gradle build.gradle

Executing tasks: [:app:assembleDebug]

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript UP-TO-DATE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  C:\Users\Hadi\AndroidStudioProjects\LightRecorder\app\src\main\res\values\ids.xml:3:5-50: AAPT: error: <item> inner element must either be a resource reference or empty.


* 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 12s
9 actionable tasks: 1 executed, 8 up-to-date

1 个答案:

答案 0 :(得分:1)

我找到了。当我升级android studio之类的东西时,出现了这个错误。我搜索了很多,最后找到了。只是我必须更改值中的ID

<resources>
<item name="name" type="id">ID</item>

<resources>
<item name="ID" type="id"/>

之后,一切都变成了事实 希望它对您有用