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 EdPS · Jul 04, 2016 at 07:39 AM · androidbuildbuild-errorfacebooksdk

Facebook SDK and Audience Network SDK Android conflict

Hi guys, I am using the Facebook SDK in my project and I want also to integrate Facebook's Audience Network SDK. The problem at first that both SDKs come with Android Support libraries, so when I try to build the project the process breaks when converting from java to dex:

 CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
 C:/Program Files/Java/jdk1.8.0_92\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
 
 stderr[
 Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
 ....]

I try to fix this by removing this library from one of the two SDKs, but in both cases I get another error:

 Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
 C:/Program Files/Java/jdk1.8.0_92\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
 
 stderr[
 
 trouble writing output: Too many method references: 65909; max is 65536.
 You may try using --multi-dex option.
 References by package:
      6 android.accessibilityservice
      5 android.accounts
      12 android.animation
 ...... (It keeps going with a long list)

I just have no idea on what is causing this second error. Curiously though, if I remove the library from both SDKs, the project will build, but I guess the SDKs won't work properly.

Any clues?

Thanks!

Comment
Add comment · Show 2
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 Gigle-Studios · Jul 10, 2016 at 02:02 PM 0
Share

I am also facing the same problem. There seems to be some problem with the Facebook Ads plugin.

Are you able to export the project to android studio ?

avatar image EdPS · Jul 10, 2016 at 02:14 PM 0
Share

No, I have never done that. I have no experience with Android Studio

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by liortal · Jul 16, 2016 at 11:17 AM

Regarding your first issue - it appears that you have 2 copies of the same Android (java) library in your project (Android support library). You should only ever include 1 copy of any library, as this will cause conflicts (as I explained in this answer: http://answers.unity3d.com/answers/767102/view.html

Then, you said you removed the library from one of the SDKs, and received another error. You can further read about this particular error here: https://developer.android.com/studio/build/multidex.html

This is a limitation on Android (you cannot have more than 64k methods).

Is there any particular reason your (native) Android code has so many methods? are you using many plugins in your game? You should remove some plugins, and if this is not possible, resort to other measures such as stripping unused methods (not very convenient, i don't think Unity supports that so well).

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 EdPS · Jul 16, 2016 at 03:50 PM 0
Share

Thanks for the hint! If I find a definitive solution I will post it here

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Not pushing content to device 0 Answers

Android - Building Beta Problems. 0 Answers

Android - Failed to repackage resources error after installing facebook plugin 2 Answers

I have a problem with my sdk version. Please help me 0 Answers

Can't build for Android 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