Exporting android private libraries

2,506 views
Skip to first unread message

Justin Breitfeller

unread,
May 23, 2013, 2:12:27 PM5/23/13
to adt...@googlegroups.com
Can someone from clarify when it is necessary in ADT 22 to set a projects private libraries as exported? I am able to compile all my projects fine, but when I go to run them on the device, I am getting a number of class not found errors. The prevailing stack overflow wisdom currently is to just set every projects private libraries to exported, but I am wondering when it is actually necessary to do this. If it is for every project, shouldn't this just automatically be turned on?

Xavier Ducrohet

unread,
May 23, 2013, 2:15:13 PM5/23/13
to adt...@googlegroups.com
Always. Unless you're using Maven to build using the m2Eclipse in which case Maven setups those dependencies itself and the container should not be exported.

We have a 22.0.1 version in preparation that will fix this by making this container exported by default.


On Thu, May 23, 2013 at 11:12 AM, Justin Breitfeller <mrs...@gmail.com> wrote:
Can someone from clarify when it is necessary in ADT 22 to set a projects private libraries as exported? I am able to compile all my projects fine, but when I go to run them on the device, I am getting a number of class not found errors. The prevailing stack overflow wisdom currently is to just set every projects private libraries to exported, but I am wondering when it is actually necessary to do this. If it is for every project, shouldn't this just automatically be turned on?


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



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

Please do not send me questions directly. Thanks!

Xavier Ducrohet

unread,
May 23, 2013, 5:52:57 PM5/23/13
to adt...@googlegroups.com
It's necessary for all projects that have dependencies automatically put in there.

If you one of your libraries have local jars, then all projects depending on it will need to export the container.




On Thu, May 23, 2013 at 2:36 PM, Magnus Bondesson <m4g...@gmail.com> wrote:
I have a project with one application and 15 library projects.
I only had to set private libraries as exported for the application project and for those projects that have jars in their libs folder (meaning they reference other libraries).
When I got it to work I tried removing the one for the application but then the app crashed and I put it back.

So is it really necessary to set it for all projects?

Cheers
Magnus

b0b

unread,
Jun 1, 2013, 3:59:47 PM6/1/13
to adt...@googlegroups.com

I migrated from ADT21 to 22.0.1  (never installed 22.0.0).

My main project uses several Android Libraries.
The main project do not use maven  but the Android Librairies do, but with "Maven Dependencies" not exported (maven here is just used to resolve the Android Libraries dependencies).
Don't remember the reason, IIRC a conflict between ADT and m2e from a long time ago.
I had to export "Android Private Libraries" in the main project (which given the above decription is expected I guess).
Not a big deal but I thought I'd mention it.

Xavier Ducrohet

unread,
Jun 1, 2013, 7:17:11 PM6/1/13
to adt...@googlegroups.com
22.0.1 should create the new container exported by default... That's weird you still had the issue. I'm doing some ADT fixes these days, I'll look into it.


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

b0b

unread,
Jun 2, 2013, 6:27:14 AM6/2/13
to adt...@googlegroups.com


On Sunday, 2 June 2013 01:17:11 UTC+2, Xavier Ducrohet wrote:
22.0.1 should create the new container exported by default... That's weird you still had the issue. I'm doing some ADT fixes these days, I'll look into it.



Don't you mark the "Android Private Library" as unexported if you detect that the Android library project has the maven nature ? 
That is the case of my Android library, but I explicitely disabled exporting "Maven dependencies" in Java Build Path >  Order and export.

So I think ADT should not export "Android Private Libraries" if:

- maven nature is detected, and
- "Maven dependencies" is exported (which means the .classpath containing <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>)

Xavier Ducrohet

unread,
Jun 3, 2013, 3:05:01 PM6/3/13
to adt...@googlegroups.com
I'm planning on doing this, although I was only looking at checking the maven nature.

Are there cases where the maven nature is applied bu there is no maven container (or it's there but not exported)?


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

b0b

unread,
Jun 3, 2013, 7:12:50 PM6/3/13
to adt...@googlegroups.com


On Monday, 3 June 2013 21:05:01 UTC+2, Xavier Ducrohet wrote:
I'm planning on doing this, although I was only looking at checking the maven nature.

Are there cases where the maven nature is applied bu there is no maven container (or it's there but not exported)?



Yes if a developer disable export of the "Maven Dependencies" container for whatever reason. In my case I had to not export it because m2e (an old version) and ADT where fighting each other for building the final binary. In fact just checking for the Maven container presence in the .classpath might be sufficient.

jfcapta...@gmail.com

unread,
Jul 23, 2013, 11:52:22 PM7/23/13
to adt...@googlegroups.com
I'm using Eclipse 22.01
I want to build project on release mode with Google Drive's example.

I go "File"->"Export" ... to build the project.
When I build apk, I got lots of warning  and errors like:
[2013-07-24 11:46:04 - MainActivity] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced class com.google.android.gms.R
[2013-07-24 11:46:04 - MainActivity] Warning: com.google.android.gms.internal.aa: can't find referenced class com.google.android.gms.R
[2013-07-24 11:46:04 - MainActivity] java.io.IOException: Please correct the above warnings first.

I've already checkon the "Android Private Libraries" on "Order and Export" Tab.
Still got warnings and errors.
Could anybody help?
Thanks in advance!!

Justin Breitfeller於 2013年5月24日星期五UTC+8上午2時12分27秒寫道:

Xavier Ducrohet

unread,
Jul 24, 2013, 12:51:11 PM7/24/13
to adt...@googlegroups.com
Are both containers exported in the "order and export" tab?


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages