Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exopackage with guava #385

Closed
tgummerer opened this issue Jul 23, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@tgummerer
Copy link
Contributor

commented Jul 23, 2015

I recently tried to add exopackage support to my project, but I'm getting the following error when trying to add guava as a dependency:

[2015-07-23 16:09:17.413][error][command:1cfc5dc9-b91f-442e-912c-5c137342d6e0][tid:15][com.facebook.buck.event.listener.LoggingBuildListener] DexWithClasses buck-out/gen/lib/guava#dex.dex.jar with cost 4892294 exceeds the max cost 4194304 for a secondary dex file.
BUILD FAILED: Secondary dex exceeds linear alloc limit.

It seems the following diff fixes the error and the application works just fine, but I'm not sure it's the right thing to do to just change the limit.

diff --git a/src/com/facebook/buck/android/AndroidBinaryDescription.java b/src/com/facebook/buck/android/AndroidBinaryDescription.java
index f892555..0668b80 100644
--- a/src/com/facebook/buck/android/AndroidBinaryDescription.java
+++ b/src/com/facebook/buck/android/AndroidBinaryDescription.java
@@ -73,7 +73,7 @@ public class AndroidBinaryDescription
    * By default, assume we have 5MB of linear alloc,
    * 1MB of which is taken up by the framework, so that leaves 4MB.
    */
-  private static final long DEFAULT_LINEAR_ALLOC_HARD_LIMIT = 4 * 1024 * 1024;
+  private static final long DEFAULT_LINEAR_ALLOC_HARD_LIMIT = 8 * 1024 * 1024;

   private static final MacroHandler MACRO_HANDLER =
       new MacroHandler(
@sdwilsh

This comment has been minimized.

Copy link
Contributor

commented Aug 10, 2015

I believe that older versions of Android have only 4MB, which is the problem (I want to say Gingerbread, although @dreiss would likely know best).

@tgummerer

This comment has been minimized.

Copy link
Contributor Author

commented Aug 10, 2015

Ah yeah, thanks for clarifying! A little digging shows you were right about Gingerbread, found this article by @dreiss: https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920 ;)

Digging a little further, I found the linear_alloc_hard_limit option for the android_binary rule, which actually does just what I need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.