Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my updated Eclipse / Android setup not building my APK anymore?

I had a working Eclipse setup with 3.6.2 and SDK tools from version 11, and it has been building my main project just fine for quite a while.

For a different project, I thought I needed to upgrade my SDK to the latest and greatest - at this point API 14 (ICS 4.0).

I cannot even reconstruct the steps I went through, but what happened was that my project would seem to build, but I would see that it would say that it was skipping a post-compiler step, and at the end I would have no APK.

I also noticed that it updated my .classpath so that the output path was bin/classes instead of .bin.

Along the way I tried updating my Eclipse to the latest version (Indigo 3.7.1) but this didn't help.

like image 975
Andy Weinstein Avatar asked Nov 07 '11 15:11

Andy Weinstein


People also ask

Where is the APK file in eclipse?

The APK file is in the /workspace/PROJECT_FOLDER/bin directory. To install the APK file in a real device: adb install <FILE PATH OF . APK FILE>

How do I run an APK file in eclipse?

You need to create an emulator using the Android Virtual Device Manager. Then when you run it as an android application it will launch the emulator.


1 Answers

I solved the problem eventually with help from this post on the Google Android forum:

http://code.google.com/p/android/issues/detail?id=21031

For me personally the biggest issue seemed to be solved as follows (qutoe from comment 25 in the forum post) "I seem to solve the problem with .apk files not being built automatically until run/debug is used (comments #10, #11 etc.). Go to Windows -> Preferences -> Android -> Build and uncheck "Skip packaging and dexing until export or launch" then restart Eclipse. Works for me."

But there is other useful material there. Different people with different projects seem to have different problems with this setup.

I still don't understand the change in the classpath, but it doesn't seem to matter.

In addition, I found a discussion of installing the ADT with Eclipse Indigo which was helpful here in Stackoverflow:

Eclipse Indigo - Cannot install Android ADT Plugin

I also found that I guess because of various uninstalls/reinstalls, for some reason it stopped excluding my .svn directories from the sources. This Stackoverflow post was helpful with that:

Why is eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?

Finally: a tip for really and truly uninstalling Eclipse - everybody says there is no uninstall, and there isn't, but there is a directory that Eclipse leaves in your home directory (in windows 7 under c:\users\) called .eclipse - Zap it if you really want to start fresh.

In addition, for less extreme measures, there is Project->Clean inside Eclipse, and you can invoke eclipse with "eclipse -clean" for additional cleansing effects. No idea what, but various helpful people along the way suggested trying that to solve problems.

Ah yes - when I first installed Indigo and tried to build, I got a warning that my Java Compiler Compliance level was not up to snuff, which was simply not true - I have only Java 1.6 installed on my machine. See this post for somebody who had similar experience:

http://marakana.com/forums/android/general/374.html

For me, what worked was simply going to Project, Properties, Java Compiler, then click on Configure Workspace Settings, and click on Ok in the dialog. Didn't need to actually change anything. Just showed it that everything was ok!

Eventually I indeed did clean out my Eclipse and Android installations (including the aforementioned .eclipse directory, and there's also an .android directory in your home directory which you may want to erase if uninstalling the Android SDK Tools doesn't do that - this actually is uninstallable). Installed everything from scratch and then used the additional information provided above and now it's building my APK.

I hope this saves somebody the hours I spent getting my build back in shape.

like image 184
Andy Weinstein Avatar answered Nov 15 '22 15:11

Andy Weinstein