Android Eclipse - Could not find *.apk
Asked Answered
L

24

207

I know this question has been asked before and I have seen a plethora of solutions out there, yet none seem to work for me. I was able to build my apk without issues until this error started cropping up. I have tried cleaning my project, removing it from the workspace and reimporting it, removing "Java Builder" from my Builders for the project, building the project manually, reordering my java build path. I have no visible compiler issues and no problems exist in my workspace.

I did experience this issue before and solved it once by removing the project form my workspace and re-importing it and another time I solved it by removing "Java Builder" from my java build path. None seem to work this time. I currently have most of the settings set back to default (i.e. java build is checked again).

I am running windows 7 (64 bit) and using jdk1.6.0_21 via Eclipse 3.6.

Any suggestions would be greatly appreciated as I have lost loads of development time troubleshooting this already.

[Update] My locale is English & I have tried removing the debug.keystore, United States as related to issue 834

Laundromat answered 24/1, 2011 at 2:36 Comment(5)
Create a new project, copy your files to this new one, and then rebuild, perhaps.Silurid
I have the same problem but I can't get it resolved. Where do you have the JavaSE-1.5 option? I'm using IBM RAD though, and I have different JDK/JRE for Android SDK than for Java dev. could that be the problem to?(Android SDK couldn't find original JDK/JRE so I had to do additional install)Nemeth
Also worth noting I think this is an overloaded error message by the android debugger. I've seen a plethora of solutions to this problem out there.Laundromat
In my case, I had used a special character in my project name - é. That was the reason behind the error. I changed it to 'e' and the problem went away.Confiding
I'd recommend running android update project --path . from your project's root, then trying to run ant debug. This resulted in specific build errors that led to my solution; for whatever reason, Eclipse wasn't being verbose about what was going wrong.Persistence
A
603

Please follow these steps; this might help you out:

  1. Right-click your app project and go to Properties

  2. Select Android from left-hand side list

  3. Uncheck the "Is Library" checkbox

If your app project relies on library projects which are in your workspace, those of course need to have the "Is Library" box checked.

Appertain answered 23/6, 2011 at 7:55 Comment(11)
Bingo! +1 dude I'd ++++ more but can't. I have no idea how "is library" got selected in the first place.School
This solved it for me too, though the shared library it failed to import IS a library. So when this pops up again in the future i will just uncheck, install, then re-check this option.Tim
This will indeed solve the problem most of the time. Worth noting that b/c its an overloaded message it is not always the solutionLaundromat
This did not work for me, I used the solution below (deleting R.java in /gen/ then relaunching eclipse)Feculent
"is library" should be unchecked for the library project, not your implementing project. Perhaps the message is produced since the library tries to find and reference it's own .apk as a library to itself?!Unseasonable
@HikmatKhan: I have an that is ALSO a library. So I do need the apk to install it. Do I have to keep unselecting/selecting the Is Library checkbox each time I make changes to it??Holography
Note that this is the correct answer for MAIN projects, but not for actual library projects. See #5581075Rabideau
In my case "Library" got checked because I was trying to get GridView to import. A search on the error brought me right here! Yes, that fixed it.Gyro
I forgot it checked from previous tests. Did it.Convict
It would really help if there is some kind of visual clues indicating that this is being built/run/mode as library. I mean, really, there should be some kind of feedback there.Kerr
The comment by @RobinDavies pointing to https://mcmap.net/q/94528/-quot-could-not-find-the-xxx-apk-quot-message-in-console-while-starting-application-with-an-android-lib-linked is the correct one in my case: That annoying "could not find .apk" message (in red) only occurred for one my libs, not for the others (and certainly not for the app itself).Turgeon
I
24

deleting the R.Java file in /Gen folder did the trick for me

Isoleucine answered 9/8, 2011 at 7:6 Comment(2)
+ I also had to Delete all "R.Android" imports that Eclipse added to some of my java classes !!!Waterloo
This worked for me. Not the accepted answer. Deleted R.java then relaunched Eclipse.Feculent
O
16

I tried all the above solutions. but it didn't work.

The solution was to restart eclipse !!!!!!!

hope this will help someone :)

Overspread answered 8/7, 2012 at 12:42 Comment(1)
Same for me but I think it would only work after doing all the above soluntionsOldie
F
12

In my case this problem started after eclipse updated the plugin with the v4.0 API release. I fixed it by going to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'

Note: if you eclipse gives you the Unknown Command 'crunch' error then follow this post

Franky answered 21/11, 2011 at 18:19 Comment(0)
F
8

I've tried to gather the best of other peoples answers into a step by step list of things to try in order:

  • Check the project is not set as a library:
    1. Go to Project->Properties
    2. Select Android from left-hand side list
    3. Uncheck the "Is Library" checkbox
  • Clean and rebuild the project - this should delete and recreate the entire gen folder, including the R.java file mentioned in some peoples answers
  • Check eclipse and all the Android plugins are up to date
  • Close the project, exit Eclipse, reopen eclipse, reopen the project.
  • Go to Java Build Path > Projects and check for any incorrect project dependencies
  • Go to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
  • Check JAVA_HOME is set correctly. Follow the steps in this article

If you complete the above list, and still haven't solved the issue, please leave a comment, or if you find something else that works, feel free to edit the answer and add your thing in.

Funnelform answered 13/12, 2012 at 18:40 Comment(2)
1. Clean and rebuild the project 2. Close the project, exit Eclipse, reopen eclipse, reopen the project. Above 2 steps fix my problem, thanksGlynas
"Close the project, exit Eclipse, reopen eclipse, reopen the project" worked for me!! This reminds of the wonderful windows recipe - "Please restart your computer and see if the problem has gone away."Faultless
E
5

Delete the project from your workspace & import again.
This worked for me.

Can't believe similar issue has been there since 2008.
http://code.google.com/p/android/issues/detail?id=834.

Equivalence answered 30/1, 2011 at 22:8 Comment(1)
FYI- this worked for me a different time I had this issue. Anyone experiencing this issue should probably try this solution first. I saw that also, but my language was set to English. This really leads me to believe it's an overloaded and vague error message.Laundromat
E
2

i'm no expert, but eclipse on Windows, doing android apps, refuses to create the default.properties file (in the app root directory). I've just copied one from another app and it works fine. Simple contents, for Android 2.2 project it just says (ignoring comments):

target=android-8

fwiw

Emelyemelyne answered 11/6, 2011 at 19:55 Comment(0)
S
2

I was having the same issue as the OP except that all these suggestions did not work. I found a solution for me.

Make sure that "Skip packaging and dexing until export or launch." is selected.

Go to Window -> Preferences -> Android -> Build. Just make sure that option is selected and apply.

I know this does not make a lot of sense, but having it unselected was giving me this error and with it selected it goes away and the apk is installed.


I am using the auto generated ant build script from android and ONLY using it as my build process in eclipse. I am not using any other build methods.

Simonsen answered 10/4, 2012 at 19:23 Comment(0)
L
1

I figured it out. I was referencing JavaSE-1.5 and using JDK 1.6. I changed it to use 1.6 and that appears to fix it.

Seems like through my research that is an overloaded error message that covers a lot of error cases.

Laundromat answered 24/1, 2011 at 4:16 Comment(2)
Your Android project shouldn't be referencing Java directly. Your build path should include an Android version but not a Java version.Leontina
Some how mine must have gotten mixed up. I think this happened flipping an earlier version of maven-android-plugin with m2eclipse on. I'd still highly recommend maven for your android builds though.Laundromat
N
1

I just fixed this by reselecting a default JRE for the execution environment (JRE6 for JavaSE-1.6 in my case). It got unchecked for some reason.

Neille answered 8/11, 2011 at 3:0 Comment(0)
I
1

This fixed my problem. I kept getting the console error in eclipse "Could not find com_android_vending_licensing.apk" and even though it didnt seem to effect the way my app ran, it was annoying. So going into the com_android_vending_licensing project properties and unchecking the "is library" option, building the project to produce the needed apk and then going back into the com_android_vending_licensing project properties and re checking the "is library" check box fixed the problem.

Incapacitate answered 16/2, 2012 at 16:1 Comment(0)
C
1

Run Eclipse as "Administrator" and then import the project.

Cankerous answered 24/4, 2012 at 16:19 Comment(0)
O
1

None of these things worked for me. I'm trying to access native code through the jni, first with NDK samples. What I found was the build won't run if jarlist.cache is not present in the project bin directory. If I copy one from another project to that location (may need to refresh to see the folder in Eclipse), build works every time.

Owner answered 8/6, 2012 at 14:21 Comment(0)
B
1

Clean the project and it will do. Sometimes it happens unknowingly but keep trying to solve using diff methods.

Bastille answered 13/9, 2012 at 18:15 Comment(0)
B
1

I had somehow done a Run configuration as a Java application instead of a Android.

Bespangle answered 17/1, 2013 at 17:7 Comment(1)
Additional details would be usefulVibrio
N
0

the problem for me was I was trying to use IBM RAD which appears to not work properly for this, I installed Eclipse and now have a different error but I should be able to get past it

Nemeth answered 28/1, 2011 at 17:54 Comment(0)
I
0

On my machine (Windows7, 64bit) I could fix this by setting my execution environment to a 32bit variant of the jdk (I used 1.6.0_23). And I tried a lot of things before...

Inveteracy answered 18/4, 2011 at 15:10 Comment(0)
X
0

SHA1's answer did it for me: after updating to the latest sdk/adt, my project refused to build an apk; unchecking the option resolved the issue.

I don't know if the update checked this, or if it was checked before but the new adt screwed things up, but things work again now :)

Xerophyte answered 4/5, 2012 at 18:10 Comment(0)
W
0

In my case this worked :

Delete R.Java file in /Gen folder

+

Delete all "R.Android" imports that Eclipse added to some of my java classes !!!

and rebuild the project.

Waterloo answered 2/6, 2012 at 6:5 Comment(0)
G
0

remove -- R.java -- Clean the project and run again.. this worked for me ..

Gironde answered 8/6, 2012 at 3:21 Comment(0)
S
0

Find the project's folder in your system, enter it's Properties via context menu and deselect "Read only" option. Worked in my case.

This seems to be the source of the problem in many cases, moreover some solutions up there base on copying/rewriting the files in the project what makes them non-read-only.

Spume answered 18/9, 2012 at 17:42 Comment(0)
B
0

This is caused by JAVA_HOME not being set correctly. It can be easily resolved by following the steps in this article.

Breastsummer answered 2/10, 2012 at 19:53 Comment(0)
A
0

Mine was caused by this problem (incompatibility between ADT and SDK), and was fixed thus:

  • Eclipse > Help
  • Install New Software
  • Add 'https://dl-ssl.google.com/android/eclipse/' to 'Work With' section and press enter
  • After developer tools appears on the list, check it and click Next
  • Restart eclipse once download is finished
Alcoholic answered 19/6, 2014 at 14:29 Comment(0)
S
0

I my case, I had to switch from API 21 to API 19, clean and build and everything was fine again. I am using a Mac and apparently API 21 is not fully supported on Yosemite.

Stardom answered 23/2, 2015 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.