代码之家  ›  专栏  ›  技术社区  ›  El_Loco

更新后将不会生成AndroidStudio中的项目

  •  0
  • El_Loco  · 技术社区  · 7 年前

    在更新AndroidStudio之后,我的一个项目没有生成。我还没有找到有效的解决办法。我尝试过删除不同的文件夹和缓存文件。我也尝试过重新安装androidstudio,但没有任何帮助。

    有人经历过同样的问题吗?

    org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
    Output:  /home/erikbylow/Code/privateprojects/workspace-android/TailoredDictFire/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:2430: error: <item> inner element must either be a resource reference or empty.
    
    Command: /home/erikbylow/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/a3d9a3af204f4221527c5ec7986f58cd/aapt2-3.2.1-4818971-linux/aapt2 compile --legacy \
            -o \
            /home/erikbylow/Code/privateprojects/workspace-android/TailoredDictFire/app/build/intermediates/res/merged/debug \
            /home/erikbylow/Code/privateprojects/workspace-android/TailoredDictFire/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
    Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #2
    Output:  /home/erikbylow/Code/privateprojects/workspace-android/TailoredDictFire/app/src/main/res/values/ids.xml:3:5-55: AAPT: error: <item> inner element must either be a resource reference or empty.
    
    Command: /home/erikbylow/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/a3d9a3af204f4221527c5ec7986f58cd/aapt2-3.2.1-4818971-linux/aapt2 compile --legacy \
            -o \
            /home/erikbylow/Code/privateprojects/workspace-android/TailoredDictFire/app/build/intermediates/res/merged/debug \
            /home/erikbylow/Code/privateprojects/workspace-android/TailoredDictFire/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
    Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #2
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at 
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   Izabela Orlowska    7 年前

    看看你得到的错误:

    TailoredDictFire/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:2430:错误:内部元素必须是资源引用或为空。

    AAPT2告诉您合并值文件的第2430行中有一个资源的值不正确-它应该是资源引用或为空。如果我没记错的话,这就是定义一个ID资源并将一个字符串或整数作为它的值。它要么根本没有值,要么应该是对不同ID(“@ID/other\u ID”)的引用。

    app/src/main/res/values ):

    <id name="my_id">my value</id> -> <id name="my_id" />
    

    如果它来自外部库,可以尝试通过在资源中定义具有匹配类型和名称的资源来覆盖它。