Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have been trying to find an simple solution for this long time ago, as far as I can tell, the only way to make ADT export the final apk with the dependent library classes is explicitly add all your external lib.jar (generated from your other projects) into your Android project's build path. </p> <p>Current version of Eclipse ADT plugin has a very inflexible predefined build life cycle (specifically in dexing step), apparently it doesn't support project grouping other than those three types of Android Project together (classic, library and test). In another words, ADT doesn't know how to build your Android project with a regular java dependent project under the build path and automatically add the lib.jar generated by dependent project into your main project's build path (even though you add them to Order and Export list), unless you explicitly add the external lib.jar into it. Suppose you add C:\workspace\game\target\game.jar and C:\workspace\engine\target\engine.jar into your android-game project's build path, command to generate your dex file should be something like this:</p> <pre><code>java [-Xmx1024M, -jar, C:\android-sdk-r16\platform-tools\lib\dx.jar, --dex, --output=C:\workspace\android-game\target\classes.dex, C:\workspace\android-game\target\classes, C:\workspace\game\target\game.jar, C:\workspace\engine\target\engine.jar] </code></pre> <p>If you plan to adopt some external build tools to manage your project build life cycle, I know Maven provide more flexible configuration on Android build life cycle. It support multi-module project (project grouping) and can handle regular java project dependency properly.</p> <p>My knowledge is based on Eclipse, Looking forward to hear some noises from Android source or other sophisticated IDE user.</p> <p><strong>Update from ADT 17.0.0:</strong> </p> <p>Latest release SDK r17 with ADT 17.0.0 claims to handle this use cases properly now:</p> <blockquote> <p>Eclipse specific changes</p> <p>The dynamic classpath container called “Library Projects” has been renamed to “Android Dependencies” as it now contains more than just Library Projects.</p> <p>The container will now also be populated with Java-only projects that are referenced by Library Projects. If those Java projects also reference other Java projects and/or jar files they will be added automatically (jar files referenced through user libraries are supported as well).</p> <p>Important: this only happens if the references are set to be exported in the referencing project. Note that this is not the default when adding a project or jar file to a project build path. Library Projects (and the content of their libs/*.jar files) is always exported. This change only impacts Java-only projects and their own jar files.</p> <p>Again, duplicates (both projects and jar files) are detected and removed.</p> </blockquote> <p>Check out the <a href="http://tools.android.com/recent/dealingwithdependenciesinandroidprojects" rel="nofollow">changelog</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload