caw
caw

Reputation: 31489

"Failed to export application" in Eclipse 4.4.1 for Android with ADT 23.0.4

When I want to export my Android app from Eclipse, the export process starts normally but after a few seconds (when the whole process should actually take a minute) it fails. The following error message appears:

Failed to export application

That's all Eclipse is telling me. I'm using Ecliipse 4.4.1 with the Android Development Toolkit 23.0.4.1468518.

When I then right-click the app, choose "Android Tools" and then "Export Unsigned Application Package", it fails again, but with more verbose error messages:

enter image description here

As you can see, it says:

'Android Release Export' has encountered a problem.

Failed to export application

And strangely, it lists a file bin/$1$1.class which apparently cannot be found. There's no obvious reason why this file shouldn't be found, however.

Only when I delete folders bin and gen and then clear the project, it works. But only once -- and after every successful run on the device or export to an APK, I have to repeat the step described before.

Any ideas why this happens? Thanks a lot in advance!

Upvotes: 4

Views: 2485

Answers (7)

John Weidner
John Weidner

Reputation: 2165

I had the same problem after I had imported a project that was originally built on a Windows computer onto my Mac. I eventually noticed that my .project file had references to a "C:\" drive that did not exist in my current environment. For me the references were a result of "linked folders" that used absolute paths instead of project or workspace variables. Once I fixed those, the export process worked.

Upvotes: 0

sergej shafarenka
sergej shafarenka

Reputation: 20416

I had multiple issues with Export Application Package in Eclipse before. Sometimes switching Project - Build Automatically off helped, something deleting bin folder and cleaning project helped. But the best and always working solution I found was a migration to Ant build.

If you are interested, here is how it works. It was surprisingly simple. Navigate into project's folder and execute

android update project -p .

It will created a build.xml file. Repeat same for all used library projects, if any. And you are done. Now calling ant release will create released apk-file. If you want app to be signed, add key.store, key.alias, key.store.password and key.alias.password to local.properties file inside your project. Now you can build new apk with a single command. Hope this can help you.

Upvotes: 2

T L Patel
T L Patel

Reputation: 86

first delete .meta folder from workspace ,restart eclipse import application and try again.

Upvotes: 1

iMDroid
iMDroid

Reputation: 2128

First clean your project then deselect "Build Automatically" option from Project/Build Automatically. Now try to export it.

Upvotes: 1

tbraun
tbraun

Reputation: 2666

  1. Refresh the project (project right-click > refresh)
  2. Clean the project (Window 'Project' Menu > Clean...)
  3. Fix Android Project (project right-click > Android Tools > Fix Project Properties)erties.

ADT is not perfect and sometimes it gets random errors that are fixed with a general clean-up.

Upvotes: 1

Hirak Chhatbar
Hirak Chhatbar

Reputation: 3181

Try downgrading ADT.

Also, check your res folder. Sometimes duplication of folder may cause this error. For example, suppose u have two sub directories with same name in assets folder, this error may occur. Check your application folder thoroughly in the explorer

Upvotes: 1

Amos
Amos

Reputation: 21

Go to your work space, just copy the project file and transfer it to the computer you want to be in, then use import tool to import it.

Upvotes: -1

Related Questions