Gradle build errors

i moved to a new system and now unity won’t build an apk using gradle. i try to change remove the debug value in the android manifest but every time i build the manifest defaults to it. it gives me this error:

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-2.14.jar” org.gradle.launcher.GradleMain “assembleRelease”

stderr[
C:\Users\Olamire\Last Stand\Last Stand\Temp\gradleOut\src\main\AndroidManifest.xml:4: Error: Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one [HardcodedDebugMode]

                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~

Explanation for issues of type “HardcodedDebugMode”:
It’s best to leave out the android:debuggable attribute from the manifest.
If you do, then the tools will automatically insert android:debuggable=true
when building an APK to debug on an emulator or device. And when you
perform a release build, such as Exporting APK, it will automatically set
it to false.

If on the other hand you specify a specific value in the manifest file,
then the tools will always use it. This can lead to accidentally publishing
your app with debug information.

1 errors, 0 warnings
Note: there were 11 duplicate class definitions.
(ProGuard Manual: Troubleshooting | Guardsquare)
Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.GooglePlayPurchasing$6: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: com.unity.purchasing.googleplay.IabHelper$2$1: can’t find referenced class com.google.vr.ndk.base.DaydreamApi
Warning: there were 10 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with ‘-dontwarn’ options.
(ProGuard Manual: Troubleshooting | Guardsquare)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:transformClassesAndResourcesWithProguardForRelease’.

java.io.IOException: Please correct the above warnings first.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    ]

Here are the steps to overcome this issue;

  • Check “User Proguard File” under Publishing Settings for Android build

102084-build-settings.png

  • Open the generated proguard file and add the following line

-dontwarn com.google.vr.ndk.base.DaydreamApi

  • Make sure that you do not havedebuggable=true in any of your AndroidManifest.xml files.

Having the same problem here,

I found an open issue about it

The workaround is to dont use Proguard on the Minify.
Upvote the issue so it gets fixed and we may use Proguard as Minify.

i had this problem so i set Internal(default) for Build system in player settings inspector ,and my problem solved :slight_smile:
hope to help :slight_smile: