1

What is the best way to manage projects in Eclipse for shared classes like DTO (java bean entities) or string tools, utils, when building an Android app using Google App Engine as backend ?

I know that if a project needs to be used as library for Android it has to be marked as "Is library" in project settings, but those classes will be compile with Davik VM right? So how can I use same classes without having duplicate projects, one for Android app, one for Java project ?

Andrei F
  • 4,205
  • 9
  • 35
  • 66

2 Answers2

0

I am not sure if i got your question right, but I will try to answer based on the information I got.

As far as i know, one does not need to mark an jar project as "is library" to use it in android.

I think, as long as you mind to only use / depend on classes which both compilers support, you will be fine with a simple java project which compiles to a jar file.

If this is not what you are looking for, maybe you could give some more details.

For more information on the "is library" topic see What does checking the "is Library" checkbox do "Under the Cover"?

Community
  • 1
  • 1
Manuel Manhart
  • 4,819
  • 3
  • 24
  • 28
  • Every tutorial i've read stated that a project used as a library must be marked with "Is Library" in Android project settings; I could't find another way (simply referencing a project to another project didn't work, the classes are not found at runtime) – Andrei F Jan 22 '14 at 14:47
  • afaik there are 2 different library types android lib and the classic jar dependency - you should be able to use both in android. see here http://devmaze.wordpress.com/2011/05/22/android-application-android-libraries-and-jar-libraries/ – Manuel Manhart Jan 23 '14 at 08:40
0

I originally setup my shared code in a library project, but then decided against that - I can't remember for sure why, might have been build speed?

So now my shared code project is an Android project, but that isn't even relevant because I just add the common project's source folder to my Android & GAE project directly as source - via the source tab of the java build path.

I also had to think about logging. Unfortunately the dominant logging in my existing code is Android style logging, so I had to write some GAE logging code to handle that.

Finally, I find myself adding null versions of some objectify (my GAE persistent lib) API's so that classes with a bit of server specific code can still be used on both.

Tom
  • 17,103
  • 8
  • 67
  • 75