1

I am just starting to learn Libgdx, and am in the process of importing the 4 projects[desktop, main java game, android, html] into Eclipse Juno. I have not added any lines of code, just trying to get them to run on the different platforms.

It runs fine on the desktop version, but when I tried to run it in the Android emulator I get the error. Cannot find mygdxgame.apk!

I realized that my gen folder is completely empty, there is no R.java for the project. I have tried a number of things to make this work, but none of it is working. I am listing the things I have tried so far, and the hopefully the reason why I am asking this repeatedly asked question.

  1. Project > Clean
  2. Package Explorer [right click on my project] > Android Tools > Fix Project Issues
  3. Deleted gen folder and Project > Clean
  4. Restarted Eclipse
  5. Deleted the project and Imported it again
  6. Set Compiler Compliance Level to 1.6 for both main java game and Android project
  7. Added a dummy XML to the android project and tried clean, and deleted it
  8. Unchecked and rechecked Build Automatically
  9. Checked my target-sdk in project.properties and made sure it is the same Project Properties -> Android and in my Manifest.xml
  10. [Right click on project] > Properties > Java Build Path > Source tab, Removed mygdxgame/gen folder and then added it again
  11. Made sure Project Properties > Android > Is Library is unchecked

Nothing has worked so far. My gen folder is still empty and I am unable to run the Android project because of the same error. Cannot find mygdxgame.apk!

What else can I do to fix this? In case this is answered I would appreciate someone giving me a link to the solution, as I have been pouring through SO and Google in general for nearly 2 hours now, with no success.

Regs

kvnam
  • 1,285
  • 2
  • 19
  • 34
  • 1
    I did a complete re-install of Eclipse, downloaded all the packages again. Now it is working..:| – kvnam May 21 '13 at 04:40

3 Answers3

6

What happened to me a few days ago:

  • 1.- I got the SDK Tools 22 update and I installed it, no other update appeared in my sdk manager... so I closed it.

  • 2.- Then I got that "NO APK" error and tried every answer I could find.

  • 3.- I opened SDK manager again, and I noted SDK Platform Tools also got an update and there was a new one: SDK Build Tools. Both of them didn't show up when I first updated the SDK Tools.. so.

ANSWER:

Open SDK Manager and check if your SDK Tools, SDK Platform Tools, SDK Build Tools are updated :)

Daahrien
  • 10,190
  • 6
  • 39
  • 71
3

On your build path, you should have a reference to the main project, under Projects tab of Java Build Path. Under Libraries, you should have gdx-backend-android.jar and gdx.jar along with Android not being a library.

Please check if Android is set as a library. If so, uncheck it. To do that, right click on the project and then select Properties. Choose Android on the left panel of the new window. Uncheck Is Library if checked.

Here's something might help- Unable to run Android app, Could not find .apk issue in eclipse

Community
  • 1
  • 1
Sajal Dutta
  • 18,272
  • 11
  • 52
  • 74
  • My projects tab in the Java Build Path has a reference to the main project. I re checked all this as per the manual set up process described by libgdx site. All libs are also in place. Also when I right click my Android I don't get an option to Build Project. I am currently directly doing a Run as Android Application. This has worked for me with all my other Android projects, I don't know if this makes a diff. – kvnam May 20 '13 at 09:41
  • I had this before and did almost what you did and suddenly it just worked. Happens with Eclipse once in a blue moon. But not sure why you don't have a Build Project option. – Sajal Dutta May 20 '13 at 09:47
  • :(..I've lost an entire day to this..I hope it fixes itself soon..I have started going through slightly less related solutions also in the hopes of getting it to work.. – kvnam May 20 '13 at 09:51
  • Not sure if it helps you, but might-http://stackoverflow.com/questions/5219208/unable-to-run-android-app-could-not-find-apk-issue-in-eclipse – Sajal Dutta May 20 '13 at 09:56
  • Thanks for the link, but that was one of the first solutions I found on this site. I have tried every single solution mentioned by everyone on the original thread, with no luck. Am now trying to recreate the same with a new android project, but that is also now giving me an error with R.java not being generated. I think something may have gone wrong when I imported these files into Eclipse..the mystery deepens sadly.. – kvnam May 20 '13 at 10:11
  • Last thing you could try is download Android SDK with ADT bundle (http://developer.android.com/sdk/index.html) which comes with Eclipse specifically for Android. Maybe try that? – Sajal Dutta May 20 '13 at 10:16
2

I would take alook at your buildpath if all libs are correct. If it's a projekt from an other computer the libs are often at different places so you need to correct those manual. If they are not correct the android projekt do not generate your R. class and so on. So do rightclick on the core projekt -> Buidl Path -> Configure Build Path. Now take a look at the libs if all are there. I had the same issue with the android 15 apk so i need to add it manual. The clean or such do not fix such because eclipse can't know where you have all your libs.

If you really dont get it run i would recoment to use the setup ui of libgdx. It does noramlly handle all imports and so on for you. You can also use it to update your current projekt and so on.

Else i would read the guide for Manual Project Setup of Libgdx.

Libgdx setup Guide
I hope this does fix it.

bemeyer
  • 6,154
  • 4
  • 36
  • 86
  • Thanks for the response, but I used the setup UI to create this project. And I also went through the manual set up link and re-checked all the libs, for all the versions, particularly the core and the Android project. Still nothing in the Gen folder and the same Cannot find *.apk! error..I am really at my wits end here. – kvnam May 20 '13 at 09:06
  • as i wrote take a look at the buildpath. Even with the UI not every lib must be right. – bemeyer May 20 '13 at 09:08
  • I followed your instructions and checked the build path, both my core project and Android project have all the jars, and source attachments correctly set, even checked the Order and Export. Have linked my assets folder, my gen folder is mentioned in the Android project Source, both libs in place..:( still no difference. – kvnam May 20 '13 at 09:13
  • Does eclipse still show errors? Or did you try to run the Desktop projekt? i am not sure if there need to be gens in the android projekt for libgdx.. it does have its own file handler – bemeyer May 20 '13 at 09:16
  • The desktop project runs fine. It is only the Android project which is still giving me the same error. Also my gen folder is completely empty. No R.java in it. – kvnam May 20 '13 at 09:39