Could not find Library.apk!

41,608

Solution 1

I found the source of the problem!

It turns out that "with the 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".

So all I had to do is go the Application Project's Properties, hit the Projects tab, select my own library project and click the Remove button. That's it. No more problem.

In Eclipse Java EE select the project Properties, then select Project References, then check the FacebookSDK (see screen capture) enter image description here

Thanks to Lance Nanek!

Solution 2

That's interesting... I didn't quite do what the answer specifies..

I have a separate android project called "ConnectionHandler" which connects to a webservice to retrieve information. This project contains no activity classes. (If it did, you would require changes to the AndroidManifest file in your Main Application, as well as following the instructions below).

To use my seperate ConnectionHandler project as a library I needed to do the following:

  1. In the Main Application > Select project properties > Go to Java Build Path > Add Jars > Select the bin folder of ConnectionHandler > choose connectionhandler.jar
  2. In the ConnectionHandler project > Select project properties > Android > Check isLibrary
  3. In the MainApplication > Select project properties > Go to Android > Add reference to ConnectionHandler in the Library section.

This works for me, and I am able to connect to my webservice, even though I have no source files to do this in my main application. Everything is contained within my ConnectionHandler jar that is being referenced..

Hope this helps someone...

Solution 3

Today I started getting this error message on the Console view of Eclipse, but it turns out that this was not the problem. My application would be built and installed on my device, and even ran for a fraction of a second (until it crashed). This is what my Console view looked like on Eclipse:

[2013-06-03 09:42:25 - my-android] Android Launch!
[2013-06-03 09:42:25 - my-android] adb is running normally.
[2013-06-03 09:42:25 - my-android] Performing com.my.android.activity.MainActivity activity launch
[2013-06-03 09:42:25 - my-android] Uploading my-android.apk onto device '650rfs2e'
[2013-06-03 09:42:31 - my-android] Installing my-android.apk...
[2013-06-03 09:42:35 - my-android] Success!
[2013-06-03 09:42:36 - my-other-android] Could not find my-other-android.apk!
[2013-06-03 09:42:36 - android-SherlockFragment] Could not find android-SherlockFragment.apk!
[2013-06-03 09:42:36 - my-android] Starting activity com.my.android.activity.MainActivity on device 650rfs2e
[2013-06-03 09:42:36 - my-android] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.my.android/.activity.MainActivity }

But upon close inspection of my LogCat, there was a silly exception being thrown from a fragment I was trying to initialize. Once I fixed my fragment (which was raising an NPE), everything worked out just fine, even through my console still tells me it can't find those library APK's.

Solution 4

Have you tried removing the project without deleting from the harddrive and reimporting the project. That seemed to work for me when I had this problem.

Share:
41,608
an00b
Author by

an00b

Updated on January 20, 2020

Comments

  • an00b
    an00b over 4 years

    I managed to restructure my application pretty nicely so that, except for a few methods in a derived Activity class, everything is in a Library Project.

    It works beautifully, except that Eclipse's Console (not LogCat!) issues the following error message:

    [2011-06-13 19:54:08 - MyLibrary] Could not find MyLibrary.apk!
    

    I cleaned both projects (library and application), restarted Eclipse, re-built the projects, but this weird error message persists.

    What does this error message mean? (especially in light that everything seems to be running OK)

    How do I get rid of it?

    UPDATE: I tried removing the project then re-importing it per the suggestion below. It didn't help. I then found this thread that helped me realize that I had <uses-library> in the application's AndroidManifest.xml referring to MyLibrary. I deleted it, cleaned the project and rebuilt. The problem persists.

    I am now suspecting this is "real problem", e.g. misconfiguration of some paths or something else on my part. What could it be?

  • an00b
    an00b about 13 years
    Are you saying that programming nowadays has become more like Voodoo and less like science? :) I will try your suggestion and report back. In the meanwhile, +1 for the attempt to help.
  • an00b
    an00b about 13 years
    I just tried removing the application project only then re-importing it. It didn't help. I will now try removing the library project...
  • an00b
    an00b about 13 years
    I just tried removing the library project as well then re-importing it. It didn't help. I am now suspecting this is real problem, e.g. misconfiguration of some paths or something else on my part. What could it be?
  • Shreyash Mahajan
    Shreyash Mahajan over 12 years
    I dont have any my own library project in mY Application but still i got this error. So whats the Sollution for it ?
  • ercu
    ercu over 12 years
    if that does not work, restarting eclipse will work after this.
  • Nick Gotch
    Nick Gotch over 12 years
    I get this error the first time I tell it to Build All after a clean but if I do it again it builds fine. In case that helps someone.
  • Herr Grumps
    Herr Grumps over 11 years
    I have tired this, and it does resolve the issue in question, however now when I do an "Open Declaration" on say a class defined in my library, it opens MyClass.class file, it should open MyClass.java file. Another SO question regarding opening of .class instead of .java (stackoverflow.com/questions/9682074/…) suggests to add the library project as a project reference in the build path! So it would seem that there isn't a way to fix both issues at the same time? (Using Eclipse 4.2.0, JDT 3.8.0, ADT 20.0.3)
  • Alan Moore
    Alan Moore over 11 years
    I found the wordage here a bit confusing, but it is the right answer. Lance Nanek describes more clearly to go to "Java Build Paths", select Projects tab, and remove the library from there.
  • Bill Hoo
    Bill Hoo almost 11 years
    after doing remove, my app can't find symbols in my lib, and this will help: 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.
  • Carl
    Carl over 10 years
    This worked for me. I think I had the library entry on my Java Build Path Projects tab all along, as well as the entry for the same library under Android, and it never caused trouble until I changed the location of my projects (as part of putting these projects under Git). I could see that my library was mentioned in the .classpath file, and that this disappeared once I removed it from the Java Build Path via the Eclipse UI. The problem I was having was that although it would build, when I ran it from the IDE it gave the message about not finding the library. It ran anyway, though. FYI.
  • LeSam
    LeSam over 10 years
    After doing that, I can't import Facebook classes in my project anymore. Eclipse can't find them
  • ban-geoengineering
    ban-geoengineering about 10 years
    After following the steps of the OP's answer, you need to right-click on your app project, click Properties, click Android, and in the Library section tick the Add button and add your Library project. Then everything should work as expected with no error messages shown.
  • Machado
    Machado over 9 years
    Thank you sir. I only managed to solve the problem entirely after updating the Android section too.