Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problem when building for Android

Discussion in 'Vuforia' started by jariwake, Aug 16, 2018.

  1. jariwake

    jariwake

    Joined:
    Jun 2, 2017
    Posts:
    100
    Hi. I ran into a weird problem that prevents me from building for android. This error appears when building:

    upload_2018-8-16_16-50-58.png

    The console says this:

    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
    CommandInvokationFailure: Gradle build failed.
    C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
    stderr[
    C:\Users\MyUserName\Documents\MyProject\Temp\gradleOut\src\main\AndroidManifest.xml:24:50-74 Error:
    Attribute meta-data#com.google.ar.core@value value=(required) from AndroidManifest.xml:24:50-74
    is also present at [:VuforiaWrapper:] AndroidManifest.xml:24:13-37 value=(optional).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:24:5-77 to override.
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':processReleaseManifest'.
    > Manifest merger failed : Attribute meta-data#com.google.ar.core@value value=(required) from AndroidManifest.xml:24:50-74
    is also present at [:VuforiaWrapper:] AndroidManifest.xml:24:13-37 value=(optional).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:24:5-77 to override.
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    * Get more help at https://help.gradle.org
    BUILD FAILED in 1s
    ]
    stdout[
    :preBuild UP-TO-DATE
    :preReleaseBuild UP-TO-DATE
    :compileReleaseAidl UP-TO-DATE
    :compileReleaseRenderscript UP-TO-DATE
    :checkReleaseManifest UP-TO-DATE
    :generateReleaseBuildConfig UP-TO-DATE
    :prepareLintJar UP-TO-DATE
    :generateReleaseResValues UP-TO-DATE
    :generateReleaseResources UP-TO-DATE
    :mergeReleaseResources UP-TO-DATE
    :createReleaseCompatibleScreenManifests UP-TO-DATE
    :processReleaseManifest
    See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
    :processReleaseManifest FAILED
    10 actionable tasks: 1 executed, 9 up-to-date
    ]
    exit code: 1
    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)
    Rethrow as GradleInvokationException: Gradle build failed
    UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1 progress)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()



    So that happens when building with Gradle. With Internal build system I get another error:

    upload_2018-8-16_16-54-18.png


    This started happening after I installed vuforia update for 2018.1 that I was using (because Vuforia suggested this in the inspector). The file I installed was UnitySetup-Vuforia-AR-Support-for-Editor-2018.1.exe

    After that I installed Unity 2018.2.3f1 but the problem still persisted.

    Is the latest Vuforia somehow broken, or has something changed in my project that I am not aware of?

    Any help tackling this problem would be much appreciated!
     
  2. jariwake

    jariwake

    Joined:
    Jun 2, 2017
    Posts:
    100
    @Vuforia-Strasza @meedabit I am still struggling with this. I have tried a lot of things to get around this, like deleting all Vuforia related things, deleting the temp, obj and Library folders, trying to install the latest Unity (2018.2.4f1) but still I get a Gradle build error after enabling Vuforia in my project and when I try to build for Android:

    upload_2018-8-21_14-33-12.png

    The docs are quite vague on the subject: https://docs.unity3d.com/Manual/android-gradle-troubleshooting.html#colliding-attributes

    Right now the only way I could get building for Android working was to reinstall Unity 2018.1.0f2, but the included Vuforia version (7.1.31) does not support Vuforia Fusion and therefore ARCore is not supported either (although I can still use the Ground Plane Stage and Plane finder, they just work quite unrealiably, probably because it uses VIO for plane detection and not ARCore). When adding the core-1.4.0.aar file to Assets/Plugins/Android folder, the build error comes back!

    What could cause this weird AndroidManifest.xml problem that gets introduced when enabling Vuforia? Any tips how to tackle this problem would be much appreciated!




    Also one piece of feedback to guys at Vuoria: this page https://library.vuforia.com/content/vuforia-library/en/articles/Solution/arcore-with-vuforia.html should be updated. Right now it says the following:

    "Download the library from:
    https://dl.google.com/dl/android/maven2/com/google/ar/core/<ARCORE_VERSION>/core-<ARCORE_VERSION>.aar
    eg. https://dl.google.com/dl/android/maven2/com/google/ar/core/1.3.0/core-1.3.0.aar"

    But how do you know what is the latest version? Please update the instructions so that it at least has a link to Google AR Core page that tells you what is the latest version. I _think_ the latest version is 1.4.0, but how can I be sure?
     
    Last edited: Aug 22, 2018
  3. jariwake

    jariwake

    Joined:
    Jun 2, 2017
    Posts:
    100
    I found out what was causing this: I had ARFoundation packages included in the project (had forgotten about them..). It actually kinda makes sense that there is a clash in that case since there is ARCore package and Vuforia´s own ARCore implementation in the project, both with their on AndroidManifest (i guess).

    Anyway, since Vuforia is built into Unity and ARFoundation is a package by Unity, I think there should be more obvious warning/error message telling that you cannot have both. Now the error log does not mention ARFoundation at all.
     
    Amin- likes this.
  4. Abdul_M

    Abdul_M

    Joined:
    Feb 17, 2018
    Posts:
    11
    I had the same issue, just delete the core 1.4 ( mine was the ar core 1.4 I put into my plugins). that fold collides with the manifest and causes it to crash.
     
    gomlopez27, adm141413, Amin- and 2 others like this.
  5. C4rds

    C4rds

    Joined:
    Jun 25, 2018
    Posts:
    3
    Realy works, thanks bro
     
    adm141413 and shafeek like this.
  6. phygitalmadhouse

    phygitalmadhouse

    Joined:
    Jan 19, 2017
    Posts:
    12
    Just delete de XR core in package manager and works for me.(was colliding) with AR core.
     
    unity_WzDX9gOcTPHRwQ likes this.