translate this page

20170109

Editing AndroidManifest.xml in Unity to deal with "CommandInvokationFailure: Gradle build failed"



When I tried to Build&Run an Android build with 'Development Build' flag in the Unity Editor, I got this error message at the last moment of the build progress, after a long waiting.

CommandInvokationFailure: Gradle build failed. 


C:/Program Files/Java/jdk1.8.0_112\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleDebug"

stderr[

C:\Dir\UnityProjects\Prototype\Temp\StagingArea\gradleOut\src\main\AndroidManifest.xml:4:83-108 Error:
    Attribute application@debuggable value=(true) from AndroidManifest.xml:4:83-108
    is also present at [:OVRPlugin:] AndroidManifest.xml:3:148-174 value=(false).
    Suggestion: add 'tools:replace="android:debuggable"' to <application> element at AndroidManifest.xml:4:3-13:17 to override.

FAILURE: Build failed with an exception.


 As the highlighted lines indicated, there was a problem while mixing multiple manifest files during the build. And the message kindly informed me what to do.

Then where should I put my editable AndroidManifest.xml in the project tree?
By googling,  I could find this.


1. Copy this file
   : PathToUnityEditorInstallDir(normally "C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer") \ AndroidManifest.xml

2. Paste onto this path
   : Assets\Plugins\Android\AndroidManifest.xml




3. Edit the file as needed to deal with the error.




After doing so, I could successfully build my test APK and run on a device.


4. *When building a release version of APK, let's not forget to reset that android:debuggable="true" value to  "false".


 Hope it helps :)

No comments :

Post a Comment

Popular Posts