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. PNG Color Issue

Once I want to put the pictures in my application, I meet this
problem.
The color presented by Android device or emulator was different from
the original png files.
I made a simple application to present the two pictures in one page
and I fetch the picture as the following link:

http://picasaweb.google.com/lh/photo/Rj5L_x_Z1IJGfGLmZV2B7g?feat=directlink

And the following two links were the original png files:

http://picasaweb.google.com/lh/photo/WJahLJ7uMRk2dA9GhYjs-Q?feat=directlink
http://picasaweb.google.com/lh/photo/0ddqAeWxd957SAVelwu_jA?feat=directlink

Can anyone explain it for me why it presented in different color??

By the way, the picture was made in 32bit colors png format.

Thanks & Regards

Tony

--~--~---------~--~----~------------~-------~--~----~

2. How to provide appwidget add capability/automatic adding in user screen

Hi

I am trying to provide the 'add appwidget' functionality similar to
home screen within my application screen but no luck.

I launch the intent AppWidgetManager.ACTION_APPWIDGET_PICK within my
application, which then requires
AppWidgetManager.EXTRA_CUSTOM_INFO
(mAppWidgetManager .getInstalledProviders()) and then it looks for
AppWidgetManager.EXTRA_CUSTOM_EXTRAS which I dont know what to provide

--~--~---------~--~----~------------~-------~--~----~

3. highlight part of the word in text view

4. Accessing Android's External DB(Created by Android media app) using Native code.

5. Selecting and Highlighting an item in an array list by code

6. screenBrightness of 0.0 == ???

7. Problem installing Cupcake OS update on ADP1