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
0
Question by smdevidan · Feb 03, 2017 at 08:51 PM · androidunity5android buildandroidplugin

Use Android plugin with android support library dependency with gradle builds in Unity 5.5

I have an Android plugin which depends in certain android support libraries like design-v7, appcompat-v7, support-v4 etc.

I am using ".aar" files for the dependent android support libraries and my Android plugin uses resources such as layouts, images, styles from these libraries.

When i build the app via gradle option in Unity 5.5, the build fails with errors like : \Temp\StagingArea\gradleOut\design-23.4.0\build\intermediates\bundles\release\res\values\values.xml:65: AAPT: Error retrieving parent for item: No resource found that matches the given name 'Animation.AppCompat.Dialog'.

Is there a way i can tell the gradle build system what my android plugin's dependencies are? Can i add my own build.gradle file for my android plugin specifying the dependencies i need?

Any help is really appreciated. Thanks!

Comment
Add comment · Show 1
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 theblitz · Feb 27, 2017 at 02:18 PM 0
Share

I can't get it to work. See my post for the actual gradle file: http://answers.unity3d.com/questions/1319231/gradle-file-for-unity.html

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by liortal · Feb 03, 2017 at 10:54 PM

Starting with Unity 5.5.1p1, you can have a custom gradle build file in your project. This can be done by adding the gradle file under Assets/Plugins/Android/mainTemplate.gradle.

For earlier Unity versions, the only option is to override the default gradle build file that is shipped under the Unity installation folder (not recommended).

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 smdevidan · Feb 05, 2017 at 07:05 AM 0
Share

Thanks for the reply.

I read through the documentation and could not find an answer for whether we can have a build.gradle file per android plugin so that a plugin can define its own dependencies.

Lets say i have an android plugin "$$anonymous$$yAndroidPlugin" placed under /Assets/Plugins/Android/$$anonymous$$yAndroidPlugin. This plugin depends on appcompat-v7, design libraries. Can i define a "build.gradle" in
/Assets/Plugins/Android/$$anonymous$$yAndroidPlugin folder and specify these dependencies the same way any android project would work? Would Unity gradle build system pick this build.gradle file for building my plugin along with the given dependencies?

Thanks for the help!

avatar image liortal smdevidan · Feb 27, 2017 at 08:15 PM 0
Share

i dont thnk this is supported, but i can check.

avatar image smdevidan · Apr 06, 2017 at 05:30 AM 1
Share

If it is not supported, that really restricts the 3rd party plugins to use any dependent library. Any 3rd party plugin (depending on some other libraries like android support libs) wont be able to build with the gradle system on Unity since the dependencies cannot be resolved. So the only thing gradle build system enables us to do is override the main application level gradle script and maybe add multi-dex or proguard to it. But there is no way a 3rd party plugin can get an advantage of it. Are there any plans for future to support per plugin custom gradle script?

avatar image liortal smdevidan · Apr 07, 2017 at 08:46 AM 0
Share

Grafle dupport is fairly new, so i guess it doesn't cover all use cases.

Even if this option was available, since gradle is not the default build option, plugin developers would have to somehow include dependencies, in case gradle isn't used..

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

8 People are following this question.

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

Related Questions

Unable to convert classes into dex format 1 Answer

Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define 0 Answers

android app dont start on device after inistalation 2 Answers

Unity 5.5 il2cpp android doesn't compile -1 Answers

My Android Game is not working (unity 19.2) 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