Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Ryan Groten
Thanks Mark with your help I managed to get it running with an 
exported/imported jar.  Works like a charm!

On Thursday, May 3, 2012 10:18:15 AM UTC-6, Mark Murphy (a Commons Guy) 
wrote:
>
> On Thu, May 3, 2012 at 11:41 AM, Ryan Groten wrote: 
> > Now I know this is a dumb question but I'll ask anyways...but how do I 
> put 
> > my object class into a separate JAR file?  I'm assuming there's no 
> mechanism 
> > in Eclipse for this, I need to use ant? 
>
> You can export JARs from Eclipse: 
>
>
> http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-33.htm
>  
>
> Or, if you are always going to use Eclipse, there's some mechanism of 
> creating dependent source projects -- I have never used that. 
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> Android Training...At Your Office: http://commonsware.com/training 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Mark Murphy
On Thu, May 3, 2012 at 11:41 AM, Ryan Groten  wrote:
> Now I know this is a dumb question but I'll ask anyways...but how do I put
> my object class into a separate JAR file?  I'm assuming there's no mechanism
> in Eclipse for this, I need to use ant?

You can export JARs from Eclipse:

http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-33.htm

Or, if you are always going to use Eclipse, there's some mechanism of
creating dependent source projects -- I have never used that.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Ryan Groten
Thanks Mark, this info (and the posts Jason sent) are very useful.

Originally I considered sending XML strings and building the objects on 
each end...however that still left me with the some issues:

1. Building an XML parser on each platform (unless I can link my android 
project to my already built java one somehow...doubtful)
2. Managing object classes in multiple locations

I think I will pursue this now though.

Now I know this is a dumb question but I'll ask anyways...but how do I put 
my object class into a separate JAR file?  I'm assuming there's no 
mechanism in Eclipse for this, I need to use ant?

Ryan

On Thursday, May 3, 2012 9:26:56 AM UTC-6, Mark Murphy (a Commons Guy) 
wrote:
>
> On Thu, May 3, 2012 at 11:20 AM, Ryan Groten wrote: 
> > I have a standard java server listening for connections from 
> "clients"...in 
> > this case a client could be a straight java web client OR a android 
> device 
> > client.  Because of this I have two separate projects (one for the java 
> > client, one for the android client).  Clients use sockets to pass java 
> > objects back and forth with the server...I want to be sending the SAME 
> > object to the server regardless of which client it comes from.  So I 
> built 
> > an object class and attempted to link both client projects to it.  The 
> java 
> > client works fine, but I can't figure out how to make the android client 
> > work with the object.  If I take that class and put it in the android 
> > project then the android client works...but the server then doesn't know 
> > what the object is and it dies. 
>
> Put the "object class" in a separate JAR, and use that JAR on both 
> your client and your server. 
>
> > Maybe I shouldn't be sending objects in the first place? 
>
> I would recommend you choose a platform-and-language-neutral, 
> easier-to-debug, easier-to-version on-wire encoding, such as JSON or 
> XML. Or, if you insist that it has to be binary, choose Apache Thrift 
> or Protocol Buffers. 
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> Android Training...At Your Office: http://commonsware.com/training 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Mark Murphy
On Thu, May 3, 2012 at 11:20 AM, Ryan Groten  wrote:
> I have a standard java server listening for connections from "clients"...in
> this case a client could be a straight java web client OR a android device
> client.  Because of this I have two separate projects (one for the java
> client, one for the android client).  Clients use sockets to pass java
> objects back and forth with the server...I want to be sending the SAME
> object to the server regardless of which client it comes from.  So I built
> an object class and attempted to link both client projects to it.  The java
> client works fine, but I can't figure out how to make the android client
> work with the object.  If I take that class and put it in the android
> project then the android client works...but the server then doesn't know
> what the object is and it dies.

Put the "object class" in a separate JAR, and use that JAR on both
your client and your server.

> Maybe I shouldn't be sending objects in the first place?

I would recommend you choose a platform-and-language-neutral,
easier-to-debug, easier-to-version on-wire encoding, such as JSON or
XML. Or, if you insist that it has to be binary, choose Apache Thrift
or Protocol Buffers.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Ryan Groten
Maybe I should clarify what I'm trying to do here in case I'm going about 
it wrong...

I have a standard java server listening for connections from "clients"...in 
this case a client could be a straight java web client OR a android device 
client.  Because of this I have two separate projects (one for the java 
client, one for the android client).  Clients use sockets to pass java 
objects back and forth with the server...I want to be sending the SAME 
object to the server regardless of which client it comes from.  So I built 
an object class and attempted to link both client projects to it.  The java 
client works fine, but I can't figure out how to make the android client 
work with the object.  If I take that class and put it in the android 
project then the android client works...but the server then doesn't know 
what the object is and it dies.

Maybe I shouldn't be sending objects in the first place?

On Thursday, May 3, 2012 8:47:41 AM UTC-6, Ryan Groten wrote:
>
> Thanks for the response Jason.  Before I tried manual linking I did add 
> the "Libraries" project from the Java Build Path -> Project tab.  After 
> doing that the class imports properly and there are no errors when building 
> my working project.  However when running the working project (and trying 
> to call the "Library" class) I get a runtime exception:
> java.lang.NoClassDefFoundError: com.example.common.DataBean
>
>
> On Thursday, May 3, 2012 1:23:11 AM UTC-6, JTeagle wrote:
>>
>> >From Eclipse I created a link to the .class file of the other project 
>> into 
>> >the bin/classes/... 
>> >folder in the android project.  Then I configured the other project in 
>> the 
>> >java build path 
>> >of my Android project. 
>>
>> You shouldn't need to do any manual linking. Assuming the shareable class 
>> is 
>> in a project of its own (for example, called 'Libraries') and both that 
>> project and your working project that needs to use the class are open in 
>> the 
>> same workspace, if you go to the Java Build Path and the Projects tab, 
>> then 
>> click Add, it should list your other project - check the Libraries 
>> project 
>> and that should be it. 
>>
>> In fact, on the Windows version of Eclipse at least, if I simply refer to 
>> the shared class in my project then Eclipse usually offers 'Fix project 
>> setup' as an option for Red Wavy Line resolution - and it seems to know 
>> the 
>> Libraries project is the right project to include. 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Ryan Groten
Thanks for the response Jason.  Before I tried manual linking I did add the 
"Libraries" project from the Java Build Path -> Project tab.  After doing 
that the class imports properly and there are no errors when building my 
working project.  However when running the working project (and trying to 
call the "Library" class) I get a runtime exception:
java.lang.NoClassDefFoundError: com.example.common.DataBean


On Thursday, May 3, 2012 1:23:11 AM UTC-6, JTeagle wrote:
>
> >From Eclipse I created a link to the .class file of the other project 
> into 
> >the bin/classes/... 
> >folder in the android project.  Then I configured the other project in 
> the 
> >java build path 
> >of my Android project. 
>
> You shouldn't need to do any manual linking. Assuming the shareable class 
> is 
> in a project of its own (for example, called 'Libraries') and both that 
> project and your working project that needs to use the class are open in 
> the 
> same workspace, if you go to the Java Build Path and the Projects tab, 
> then 
> click Add, it should list your other project - check the Libraries project 
> and that should be it. 
>
> In fact, on the Windows version of Eclipse at least, if I simply refer to 
> the shared class in my project then Eclipse usually offers 'Fix project 
> setup' as an option for Red Wavy Line resolution - and it seems to know 
> the 
> Libraries project is the right project to include. 
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] How to link Android project to another project within Eclipse

2012-05-03 Thread Jason Teagle
From Eclipse I created a link to the .class file of the other project into 
the bin/classes/...
folder in the android project.  Then I configured the other project in the 
java build path

of my Android project.


You shouldn't need to do any manual linking. Assuming the shareable class is 
in a project of its own (for example, called 'Libraries') and both that 
project and your working project that needs to use the class are open in the 
same workspace, if you go to the Java Build Path and the Projects tab, then 
click Add, it should list your other project - check the Libraries project 
and that should be it.


In fact, on the Windows version of Eclipse at least, if I simply refer to 
the shared class in my project then Eclipse usually offers 'Fix project 
setup' as an option for Red Wavy Line resolution - and it seems to know the 
Libraries project is the right project to include.



--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en