I had to abandon the Library Project approach in the end because I was
running into so many eclipse errors it was really slowing me down. This is
particularly true when refactoring - which, I suppose, is the first thing
people do when changing their code to use libraries.

For example, if your Library project depends on a Java project and you do
things like rename packages in that Java project, then eclipse would throw
up an error (unfortunately can't remember which one). Restarting eclipse
didn't seem to make a difference. Workaround was to create a new package and
move classes into that. Didn't isolate the problem so there might be other
factors involved here - like another Android project also depending on that
Java project.

On 3 June 2010 18:01, Didier Girard <[email protected]> wrote:

> Xavier,
> I was just in front of the same problem.
> If you could just add a note about restarting eclipse in the following
> page it could help a lot :
> http://developer.android.com/guide/developing/eclipse-adt.html
> Thanks in advance,
> Didier
>
>
> On May 23, 9:06 pm, Xavier Ducrohet <[email protected]> wrote:
> > When you do the link between the main project and the library (as
> > shown here:
> http://developer.android.com/images/developing/adt-props-libRef.png),
> > try to simply restart Eclipse (I know it's annoying) and the link
> > should happen.
> >
> > The library source folder will appear in your main project as a new
> > source folder named after your library project name with a [Android
> > Library] tag after it. I'm trying to attach a small screenshot that
> > shows the connection.
> >
> > Xav
> >
> >
> >
> >
> >
> > On Sun, May 23, 2010 at 11:53 AM, Michael A. <[email protected]>
> wrote:
> > > Just to note that I am fully up to date with both the SDK and Eclipse
> > > plugins, so that does not appear to be the problem.
> >
> > > On May 23, 8:45 pm, "Michael A." <[email protected]> wrote:
> > >> Yes - I realize that. It just doesn't work in my setup. :-(
> >
> > >> I can see the R.java file from the library gets included in the
> > >> generated content, but i don't get access to the classes in the
> > >> library project. Very frustrating.
> >
> > >> Regards,
> >
> > >> Michael A.
> >
> > >> On May 23, 7:24 pm, Lance Nanek <[email protected]> wrote:
> >
> > >> > The only time I've seen that "Could not find <otherproject.apk>"
> > >> > warning was in the same situation as mentioned above, when the
> project
> > >> > being run used an Eclipse, Java Build Path, Project dependency on
> the
> > >> > other project.
> >
> > >> > If you want to double check that you don't have that, right click on
> > >> > the project being run, choose Properties from the menu that pops up,
> > >> > then choose Java Build Path on the left, then choose the Projects
> tab.
> > >> > Make sure you don't have any Android projects listed there. With
> this
> > >> > new library feature you don't specify the Android projects you
> depend
> > >> > on in the Java Build Path section of the Properties. You do it in
> the
> > >> > Android section of the Properties.
> >
> > >> > On May 23, 7:14 am, "Michael A." <[email protected]> wrote:
> >
> > >> > > I'm seeing exactly the same problem as Mark Carter.
> >
> > >> > > I've followed the instructions on the reference pages exactly (at
> > >> > > least as far as I can make out). The app project compiles fine and
> is
> > >> > > able to use and inherit classes in the library project, but trying
> to
> > >> > > run the (non-library) project in the emulator throws up the "Could
> not
> > >> > > find <name.of.android.library>.apk!" line right after installing
> the
> > >> > > non-library app.
> >
> > >> > > This is using Eclipse. Exporting a signed apk for the non-library
> > >> > > project does not seem to work either.
> >
> > >> > > It seems like the library is not being imported into the apk, but
> it
> > >> > > is not at all obvious why it is not working as everything is
> working
> > >> > > fine in the developer view.
> >
> > >> > > Regards,
> >
> > >> > > Michael A.
> >
> > >> > > On May 22, 10:15 pm, Xavier Ducrohet <[email protected]> wrote:
> >
> > >> > > > There is something very strange here.
> >
> > >> > > > What is MyLibrary.apk?
> >
> > >> > > > I think you may be a bit confused with what libraries are.
> >
> > >> > > > Library projects are handled at compilation time. They are *NOT*
> meant
> > >> > > > to be export as APK (I don't even know how you managed to create
> > >> > > > MyLibrary.apk because the tools don't let you do it).
> >
> > >> > > > When you compile an application project that depends on a
> library, the
> > >> > > > code and resources of the library are included in the app
> project's
> > >> > > > apk when you compile it.
> >
> > >> > > > Xav
> >
> > >> > > > On Sat, May 22, 2010 at 4:21 AM, Mark Carter <
> [email protected]> wrote:
> > >> > > > > When trying to launch an activity, the console gives:
> >
> > >> > > > > Uploading MyApp.apk onto device 'emulator-5554'
> > >> > > > > Installing MyApp.apk...
> > >> > > > > Success!
> > >> > > > > Could not find MyLibrary.apk!
> > >> > > > > Starting activity com.mycompany.MyActivity on device
> > >> > > > > ActivityManager: Starting: Intent {
> act=android.intent.action.MAIN
> > >> > > > > cat=[android.intent.category.LAUNCHER] cmp=com.mycompany/
> > >> > > > > com.mycompany.MyActivity }
> > >> > > > > Attempting to connect debugger to 'com.mycompany' on port 8612
> >
> > >> > > > > And then the activity fails to start (ClassNotFoundException).
> >
> > >> > > > > This seems to be because of the line:
> >
> > >> > > > > Could not find MyLibrary.apk!
> >
> > >> > > > > Any ideas?
> >
> > >> > > > > On May 22, 11:49 am, Mark Carter <[email protected]> wrote:
> > >> > > > >> Great to see the new Android Library Project feature in ADT
> 0.9.7.
> >
> > >> > > > >>
> http://developer.android.com/guide/developing/eclipse-adt.html#librar...
> >
> > >> > > > >> However, some things aren't clear to me yet:
> >
> > >> > > > >> 1. In the library project, what does versionCode,
> versionName,
> > >> > > > >> packageName now mean? I assume nothing???
> > >> > > > >> 2. The docs state that activities, services etc need to be
> declared in
> > >> > > > >> the library project and also the app project. So doesn't this
> just
> > >> > > > >> result in a load of duplication? What if the activity is
> declared
> > >> > > > >> slightly differently in one to the other?
> > >> > > > >> 3. It would have been incredibly useful to allow library
> projects to
> > >> > > > >> reference each other. I'm curious as to why this is not
> possible...
> > >> > > > >> 4. If an app references both resources and code in a library
> project,
> > >> > > > >> then that library project needs to be added as both a library
> and a
> > >> > > > >> project in the app's build path (in eclipse at least) - why
> is this?
> > >> > > > >> 5. I'm considering subclassing library project
> activities/services in
> > >> > > > >> my app project. Is there any reason not to do this?
> >
> > >> > > > >> --
> > >> > > > >> You received this message because you are subscribed to the
> Google
> > >> > > > >> Groups "Android Developers" group.
> > >> > > > >> To post to this group, send email to
> [email protected]
> > >> > > > >> To unsubscribe from this group, send email to
> > >> > > > >> [email protected]<android-developers%[email protected]>
> > >> > > > >> For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
> >
> > >> > > > > --
> > >> > > > > You received this message because you are subscribed to the
> Google
> > >> > > > > Groups "Android Developers" group.
> > >> > > > > To post to this group, send email to
> [email protected]
> > >> > > > > To unsubscribe from this group, send email to
> > >> > > > > [email protected]<android-developers%[email protected]>
> > >> > > > > For more options, visit this group at
> > >> > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > >> > > > --
> > >> > > > Xavier Ducrohet
> > >> > > > Android SDK Tech Lead
> > >> > > > Google Inc.
> >
> > >> > > > Please do not send me questions directly. Thanks!
> >
> > >> > > > --
> > >> > > > You received this message because you are subscribed to the
> Google
> > >> > > > Groups "Android Developers" group.
> > >> > > > To post to this group, send email to
> [email protected]
> > >> > > > To unsubscribe from this group, send email to
> > >> > > > [email protected]<android-developers%[email protected]>
> > >> > > > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
> >
> > >> > > --
> > >> > > You received this message because you are subscribed to the Google
> > >> > > Groups "Android Developers" group.
> > >> > > To post to this group, send email to
> [email protected]
> > >> > > To unsubscribe from this group, send email to
> > >> > > [email protected]<android-developers%[email protected]>
> > >> > > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
> >
> > >> > --
> > >> > You received this message because you are subscribed to the Google
> > >> > Groups "Android Developers" group.
> > >> > To post to this group, send email to
> [email protected]
> > >> > To unsubscribe from this group, send email to
> > >> > [email protected]<android-developers%[email protected]>
> > >> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
> >
> > >> --
> > >> You received this message because you are subscribed to the Google
> > >> Groups "Android Developers" group.
> > >> To post to this group, send email to
> [email protected]
> > >> To unsubscribe from this group, send email to
> > >> [email protected]<android-developers%[email protected]>
> > >> For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%[email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Xavier Ducrohet
> > Android SDK Tech Lead
> > Google Inc.
> >
> > Please do not send me questions directly. Thanks!
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
> >
> >  LibraryConnection.png
> > 18KViewDownload
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Reply via email to