Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:56:56+00:00 2026-06-09T23:56:56+00:00

Project explained below is created and built using Eclipse Juno(4.2). We receive the following

  • 0

Project explained below is created and built using Eclipse Juno(4.2).

We receive the following error when executing the Run Configuration for our Android application:
Dx
trouble writing output: Too many fields: 65757; max is 65536. By package:

2857 com.android.foo.bar
12 com.android.foo.bar.util
236 com.blah.yo.io
6 com.blah.yo.util
2 com.hmm
82 com.hmm.android.app
2761 com.hmm.android.common
2761 com.hmm.android.map
2761 com.hmm.android.map.common
.
.
.

A list of namespaces follows with similar numbers preceding them

Conversion to Dalvik format failed with error 2

Here’s an example of our project structure:

Conceptual structure:
A – main/non-library module

  • B – library module/Android dependency of A
    • C – library module brought in as an Android dependency of library module B
  • D – library module/Android dependency of A
  • E – library module/Android dependency of A
    • F – library module/Android dependency of E
    • G – library module/Android dependency of E, B, D(a common IO module used across the different modules)

Folder structure:

/Project A/

       B/*Android module structure*
       C/*Android module structure*
       D/*Android module structure*
       E/*Android module structure*
       F/*Android module structure*
       G/*Android module structure*

At first we thought “wow, we’ve hit the max fields_ids_size so our app must have gotten that big”, which it is a rather large app functionality-wise.

After some attempts at cleanup/discovery on the issue we are doubtful this is the cause. After analyzing the classes.dex file for the fields_ids_size and attempting different things we find that we can shrink the number of fields_ids down if we remove the library modules and just include them into the main project. Horrible for code/module reuse across projects, but takes the number from the above error message from 65757 down to nearly 24,000. Likewise, if jar’ing up a library module and including it into the classpath of the dependent entity(whether its the main non-library module or a library module), the number also shrinks if you remove the Android dependency to that library module and just use the jar file.

Seeing this, I took D from the example above and made it it’s own standalone app with no dependencies/tie-ins to other modules and created the classes.dex file for it. Let’s assume for this example that D has the namespace com.android.foo.bar. From the example error above this namespace was taking up 2857 fields ids when used as a library module of A. When compiled as it’s own app and analyzing the classes.dex file, I saw this number fall to around 120 fields ids.

This is a rather large issue for our app as we’re hitting this upper limit. We do have a workaround of sorts, but it is rather clunky and time consuming. I’m hoping there is a solution for this to allow us to have these library references and not have the issue of the number of fields_ids for library modules seemingly being inflated causing this issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:56:58+00:00Added an answer on June 9, 2026 at 11:56 pm

    I recently came across your exact same issue. My main project references a lot of library projects so I can easily re-use my code.

    Lets say that 3 of my library projects both depend on the much used library, actionBarSherlock. In all 3 packages it will auto generate R.java and place ALL of the ids from actionbarsherlock into the new R.java. So now you have 4 R.java files (ActionBarSherlock, lib1, lib2, lib3) with many of the same ids being used.

    The trick to get around this is to declare the same package name in all your library projects AndroidManifest.xml so you don’t have so many identical ids.

    The other alternatives are:

    1) Build your projects with ant to create and load more than 1 dex file (Horrible solution) http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

    2) Merge and simplify the code

    I hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a new project in Xcode 4 using the Cocoa Application template and
I have created an applet program using Eclipse IDE. Now im creating .html file
Using NetBeans 7.1.2. When editing pages with NetBeans as per the procedure explained below,
I'll try to explain shortly what I want to do: A project using a
I a working on a JSF2/Spring3/JPA2 project using facelets as view technology. javax.faces.DEFAULT_SUFFIX is
I am creating a project using maven with spring and hibernate. I added a
Within a project we create a path to a file by using some path
I have a project where I must make the following; You have a small
I am working on a project and I am using jQuery Tabs like the
I attempted Project Euler's problem 10 using the very easy algorithm and the running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.