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
2
Question by GODSPIRIT · Nov 21, 2017 at 08:45 AM · build-errorbuild error

Gradle Build Error

After updating Unity to version 5.6.3p2, I am getting an error when Unity is "Building Gradle Project" when trying to build an .apk for android platform. This is what the console says;

CommandInvokationFailure: Gradle build failed. C:/Program Files (x86)/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[ FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring root project 'gradleOut'.

Cannot add task ':prepareUnityAdsLibrary' as a task with that name already exists.

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. ] stdout[ Incremental java compilation is an incubating feature.
BUILD FAILED
Total time: 26.887 secs ] exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.RunJava (System.String args, System.String workingdir, UnityEditor.Android.Progress progress) UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, UnityEditor.Android.Progress progress) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.HostView:OnGUI()

After updating, I was having trouble with Untiy Ads. I was getting compiler errors concerning the Header File Advertisements. Turns out that for some reason after updating, Unity Ads was turned off or not connected to my project and could not reference that header. So I tried to update though the asset store only to have more problems. Then I learned that the latest version of the Ads plug-in is automatically added with newer version of Unity and I didn't need to download through the Asset store. In fact doing so causes conflicts. I deleted the plug-in I downloaded from the asset store and reloaded and reconnected Unity Ads through the services tab but the problem still persists.

What should I do to solve this issue ? Thanks In advance.
Comment
Add comment · Show 3
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 thedefiancerebels · Jan 06, 2018 at 04:20 AM 0
Share

I am getting the exact same error. Any luck?

avatar image liortal · Jan 06, 2018 at 08:10 AM 0
Share

It appears that you might have 2 copies of the Unity ads libraries in your project (one may be automatically added by the "Services" tab, and another one probably included as a file in your project).

avatar image PouyaAR · Jan 22, 2018 at 12:12 PM 0
Share

I have the same problem. any suggestion?

3 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by Devster2020 · Feb 18, 2018 at 12:58 PM

@GODSPIRIT @thedefiancerebels @PouyaAR @Retz_Retro That's because you have probably import UnityADS from Asset store and also checked the "Enable built-in Ads extension" in the "Services" -> "Unity ADS" -> "Advanced" Unchecking that option tell unity to use the package downloaded from asset store, et voilà.. Build with gradle comes back to work correctly ^^

Comment
Add comment · Show 4 · 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 Anvelicon · Feb 27, 2018 at 06:58 PM 0
Share

This saved me a lot of time. Thank you so much.

avatar image MagoParodi · Mar 22, 2018 at 07:39 PM 0
Share

WOR$$anonymous$$ING NOW! Thanks a lot! This helped a lot. I actually deleted the Assets from the project folder. So the problem seems to be that some definitions were duplicated this way.

Thanks!

avatar image Phuongnguyen1002 · Sep 25, 2018 at 09:04 AM 0
Share

Thank you very much! You saved my time.

avatar image Mirbo · Jan 21, 2019 at 11:16 PM 0
Share

THIS WOR$$anonymous$$S!

I have spent almost two weeks by searching solution (changing scripts, re/importing plugins, installing and analyzing logs by android studio, installing various SD$$anonymous$$ versions, searching on web and try/error...) ... endless frustration on my side... and the solution was as easy as you wrote....!

THAN$$anonymous$$ YOU !!!

avatar image
1

Answer by Big-Ed · May 28, 2018 at 01:18 PM

I have the same issue Cannot add task ':prepareUnityAdsLibrary' as a task with that name already exists. \Assets\Plugins\Android\unity-ads.aar \Assets\Plugins\Android\UnityAds.aar I imported the new Unity Ads and got the conflict because I have 2 unity ads aar in the plugins android directory that are conflicting and don't know which one to use.
I removed unity-ads.aar and I can compile now.
Does anyone know if the new UnityAds.aar from the asset store works with AdMob mediation?

UnityAds.aar I believe is packaged with Unity Ads from the asset store and the other unity-ads.aar is from integration with AdMob mediation. I decided to move away from AdMob mediation for the GDPR stuff going on and use Unity Ads directly.

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 Retz_Retro · Feb 15, 2018 at 09:44 PM

I was met with the exact same error. I found that UnityAds was being accessed twice. Once within my UnityAds folder within Assets and again within my Plugins/Android folder within Assets. I selected one of the UnityAds.aar files and unchecked Android from the Include Platforms heading, this fixed this issue for me.

Hope it helps.

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

83 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unable to list target platforms. When I try to build to Andriod on Mac 5 Answers

Can't build my android project 1 Answer

Character Model Works in Editor but Distorts in the Build 0 Answers

Can't use System.Net.Sockets on Nintendo Switch 1 Answer

when i take the build it fails 0 Answers


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