Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Cypras · Jan 20, 2017 at 09:40 AM · c#build-error

Android Gradle Build Error


Trying to build with Gradle, and I get this error:

 CommandInvokationFailure: Gradle build failed. 
 C:/Program Files/Java/jdk1.8.0_91\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\Josh\Desktop\AdApp\AdApp - Test this next\Temp\StagingArea\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]
   <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:name="io.fabric.unity.android.FabricApplication" android:theme="@style/UnityThemeSelector" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">

Yes I am aware what it means. However I have removed 'android:debuggable' from all my Manifests. Unity is inputting it somewhere along the buildchain.

How can I get passed this?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by OleSviper · Jan 24, 2017 at 11:43 AM

I just removed 'android:debuggable' from all my AndroidManifest.xml files too but you are right, the message is still there. So it seems like the Unity Android build process adds it.

HOWEVER I think this is just the last message that was written to stderr before another exception occurred, that failed the build. Check the Editor.log file and look for

FAILURE: Build failed with an exception.

  • What went wrong:

You should see the real exception here.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rsodre · Jul 04, 2017 at 05:15 PM 0
Share

Indeed! In my case I was seeing this:

 * What went wrong:
 Execution failed for task ':transformClassesWithDexForRelease'.
 > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

Strange that DexIndexOverflowException is the 64$$anonymous$$ problem that makes us switch to Gradle. I had this problem on Internal built, switch to Gradle, worked for some time and now one plugin later it started in Gradle too. Here's what I did:

Build, but check "Export Project"

Add this to build.gradle on the exported project

 android {
      ...
     defaultConfig {
             ...
         multiDexEnabled true
     }
      dexOptions {
          java$$anonymous$$axHeapSize "2g"
      }
  ...
  }

Copy build,gradle to Assets/Plugins/Android/mainTemplate.gradle

Build AP$$anonymous$$

Remember to repeat this if you install any other android plugin

There's an issue I think may be related to that... https://issuetracker.unity3d.com/issues/gradle-building-fails-giving-misleading-hardcodeddebugmode-error

EDIT: We need to change the manifest too or the game will hit the multidex limit while loading the libraries. Add this to Android$$anonymous$$anifest.xml, inside the application tag:

 <application ...
 android:name="android.support.multidex.$$anonymous$$ultiDexApplication" >

$$anonymous$$ore about this issue here.

avatar image
1

Answer by GMonks-Entertainment · Jan 27, 2017 at 06:26 PM

Its a known bug in admob unitypackage.

https://groups.google.com/forum/#!topic/google-admob-ads-sdk/JVArJV5aDqg

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hanh · Nov 03, 2017 at 09:03 AM 0
Share

Great. It works for me.

package="com.google.unity" -> package="com.google.unity.ads"

avatar image borastudy · Mar 21, 2018 at 07:07 AM 0
Share

Perfect. It really works. Thanks

avatar image
1

Answer by Claudioteles85 · Feb 14, 2018 at 04:35 PM

I spent several hours stuck on this, no one had the solution for the problem I was having, Finely under Player > Publisher Settings, under Build, I checked off the box that says "Custom Graddle Template" and it worked. If you're having the same issue it might work for you too.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image muhammadjabirkhan · May 28, 2019 at 12:03 AM 0
Share

I checked On the "Custom Gradle Template" and it worked for me. So thanks you saved me.

avatar image
0

Answer by a96andrei · May 17, 2017 at 01:09 PM

I managed to find a workaround to this problem. After removing all 'android:debuggable' from your manifests, export your project to Android Studio (using Gradle build) and build it from there. This way, you will have more control over your final AndroidManifest.xml. Tested with Unity 5.6.1f1.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by MaxKarpinsky · Sep 24, 2017 at 07:35 PM

https://docs.unity3d.com/Manual/android-manifest.html

Read the docs. It says that Unity generates it, thus it's in Temp folder. Unity ads debug mode and set it to false if it's a release build.

You have to create or generate your own AndroidManifest.xml that will override the creation it in Temp.

Overriding the Android Manifest

Although Unity generates a correct Manifest for you, in some cases you might want direct control over its contents.

""" To use an Android Manifest that you have created outside of Unity, import your Android Manifest file to the following location: Assets/Plugins/Android/AndroidManifest.xml. This overrides the default Unity-created Manifest.

In this situation, Android Libraries’ Manifests are later merged into your main Manifest, and the resulting Manifest is still tweaked by Unity to make sure the configuration is correct. For full control of the Manifest, including permissions, you need to export the Project and modify the final Manifest in Android Studio. Please note that we only support launchMode - singleTask. """

Though, it doesn't really help right now, it adds debuggable anyway.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Cross compilation job Assembly-CSharp.dll failed. When building iOS. 2 Answers

【LuminSDK Unity】Deploy to Magic Leap One and MLDB error: API level requested does not support 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges