Android Library Projects Cause "already added" from dex

by Ian » Wed, 23 Feb 2011 22:51:13 GMT


Sponsored Links
 Hi all,

My Android project has multiple Android Library dependencies. Two of them 
use the ORMlite JAR so they each have that JAR in their libs directory so we 
can build the individual projects with Eclipse. However, when I try to build 
the overall Android project with ant, the -dex step complains that the 
classes from the ORMlite JAR were already added.

I suppose this makes sense (since dex is adding the classes from the 
dependencies, there are in fact two ormlite JARs whose classes are being 
added), but is there a way to specify that these JARs should not be included 
in the dex process?

Thanks!

-- 



Re: Android Library Projects Cause "already added" from dex

by Xavier Ducrohet » Thu, 24 Feb 2011 01:52:05 GMT


 It's not possible at this time to exclude them.

I believe the error is actually only a warning, in which case you could
ignore it?








-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
 http://developer.android.com  |  http://tools.android.com 

Please do not send me questions directly. Thanks!

-- 


Sponsored Links


Re: Android Library Projects Cause "already added" from dex

by Ian Dees » Thu, 24 Feb 2011 01:59:58 GMT


 've attached the output of my "ant debug" run at the command line.
Unfortunately it exits with a build failure so I cannot ignore and continue.

On Wed, Feb 23, 2011 at 11:52 AM, Xavier Ducrohet <x...@android.com> wrote:


--
$ ant debug
Buildfile: /home/iandees/AndroidWorkspace/AndrApp/build.xml
[setup] Android SDK Tools Revision 8
[setup] Project Target: Android 2.2
[setup] API level: 8
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] /home/iandees/AndroidWorkspace/AndrApp: common =>
/home/iandees/AndroidWorkspace/AndrApp/common
[setup] /home/iandees/AndroidWorkspace/AndrApp: map =>
/home/iandees/AndroidWorkspace/AndrApp/map
[setup] /home/iandees/AndroidWorkspace/AndrApp: network =>
/home/iandees/AndroidWorkspace/AndrApp/network
[setup] /home/iandees/AndroidWorkspace/AndrApp: map-domain =>
/home/iandees/AndroidWorkspace/AndrApp/map-domain
[setup] /home/iandees/AndroidWorkspace/AndrApp: location/ =>
/home/iandees/AndroidWorkspace/AndrApp/location
[setup] /home/iandees/AndroidWorkspace/AndrApp: domain-location/ =>
/home/iandees/AndroidWorkspace/AndrApp/domain-location
[setup] /home/iandees/AndroidWorkspace/AndrApp/domain-location:
../location/ => /home/iandees/AndroidWorkspace/AndrApp/location
[setup] /home/iandees/AndroidWorkspace/AndrApp/map-domain: ../network =>
/home/iandees/AndroidWorkspace/AndrApp/network
[setup] /home/iandees/AndroidWorkspace/AndrApp/map-domain: ../common =>
/home/iandees/AndroidWorkspace/AndrApp/common
[setup] /home/iandees/AndroidWorkspace/AndrApp/map-domain: ../map =>
/home/iandees/AndroidWorkspace/AndrApp/map
[setup] /home/iandees/AndroidWorkspace/AndrApp/map: ../network =>
/home/iandees/AndroidWorkspace/AndrApp/network
[setup] /home/iandees/AndroidWorkspace/AndrApp/map: ../common =>
/home/iandees/AndroidWorkspace/AndrApp/common
[setup] /home/iandees/AndroidWorkspace/AndrApp/map: ../network =>
/home/iandees/AndroidWorkspace/AndrApp/network
[setup] /home/iandees/AndroidWorkspace/AndrApp/map: ../common =>
/home/iandees/AndroidWorkspace/AndrApp/common
[setup] ------------------
[setup] Ordered libraries:
[setup] /home/iandees/AndroidWorkspace/AndrApp/map-domain
[setup] /home/iandees/AndroidWorkspace/AndrApp/map
[setup] /home/iandees/AndroidWorkspace/AndrApp/network
[setup] /home/iandees/AndroidWorkspace/AndrApp/common
[setup] /home/iandees/AndroidWorkspace/AndrApp/domain-location
[setup] /home/iandees/AndroidWorkspace/AndrApp/location
[setup] ------------------
[setup]
[setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (4) is
lower than the project target API level (8)
[setup]
[setup] Importing rules file: tools/ant/main_rules.xml

-debug-obfuscation-check:

-set-debug-mode:

-compile-tested-if-test:

-dirs:
[echo] Creating output directories if needed...

-pre-build:

-resource-src:
[echo] Generating R.java / Manifest.java from the resources...

-aidl:
[echo] Compiling aidl files into Java classes...

-pre-compile:

compile:
[javac] /home/iandees/android-sdk-linux_86/tools/ant/main_rules.xml:361:
warning: 'includeantruntime' was not set, defaulting to
build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 16 source files to
/home/i



Re: Android Library Projects Cause "already added" from dex

by Xavier Ducrohet » Thu, 24 Feb 2011 02:51:31 GMT


 ah that is annoying. As a workaround you could create another library
that has no code/resources but only the jar file and make both of the
library that needs the jar file depend on it.

Xav








-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
 http://developer.android.com  |  http://tools.android.com 

Please do not send me questions directly. Thanks!

-- 



Other Threads

1. Copy/Paste

Hi All,

Is it possible to use the KeyEvent API for copy/paste functionality?

It is possible to insert keystrokes into a TextView using KeyEvent.
How do I copy the string from a TextView using KeyEvent?

Is there any other way?

Regards,
Perumal

-- 

2. How to receive a Notification for a new installed application

http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_ADDED

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware






-- 

3. Mohon bantuan pendapat.

4. [WTS] Motorola Droid 2 (CDMA EVDO)

5. How many of you are creating promotional videos for your app?

6. diffrence b/w sdk vesiron 8 & 10

7. PendingIntent, Service and AsyncTask.