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

5
  • Create a new project, copy your files to this new one, and then rebuild, perhaps. Jan 24, 2011 at 2:48
  • 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)
    – Brent
    Jan 25, 2011 at 20:33
  • 3
    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.
    – David Gill
    Feb 5, 2011 at 5:16
  • 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. Aug 5, 2013 at 13:45
  • 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.
    – namuol
    Aug 11, 2013 at 0:31

24 Answers 24

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.

11
  • 16
    Bingo! +1 dude I'd ++++ more but can't. I have no idea how "is library" got selected in the first place.
    – user562566
    Aug 5, 2011 at 7:44
  • 2
    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.
    – joveha
    Nov 8, 2011 at 18:55
  • 5
    This did not work for me, I used the solution below (deleting R.java in /gen/ then relaunching eclipse)
    – Ryan R
    Jun 9, 2012 at 22:59
  • 4
    "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?!
    – Almer
    Nov 13, 2012 at 11:32
  • 2
    Note that this is the correct answer for MAIN projects, but not for actual library projects. See stackoverflow.com/questions/5580575/… Dec 8, 2013 at 20:15
24

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

2
  • 1
    + I also had to Delete all "R.Android" imports that Eclipse added to some of my java classes !!!
    – Hubert
    Jun 2, 2012 at 6:07
  • This worked for me. Not the accepted answer. Deleted R.java then relaunched Eclipse.
    – Ryan R
    Jun 9, 2012 at 22:58
16

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

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

hope this will help someone :)

1
  • 3
    Same for me but I think it would only work after doing all the above soluntions
    – Rafaesp
    Oct 7, 2012 at 14:01
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

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.

2
  • 1. Clean and rebuild the project 2. Close the project, exit Eclipse, reopen eclipse, reopen the project. Above 2 steps fix my problem, thanks
    – wenbo qiu
    Jul 9, 2013 at 9:33
  • "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." Oct 12, 2014 at 12:56
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.

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.
    – David Gill
    Mar 6, 2011 at 15:49
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

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.

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.

2
  • Your Android project shouldn't be referencing Java directly. Your build path should include an Android version but not a Java version. Aug 1, 2011 at 21:44
  • 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.
    – David Gill
    Aug 8, 2011 at 3:50
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.

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.

1

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

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.

1

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

1

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

1
  • Additional details would be useful Jan 17, 2013 at 17:24
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

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...

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 :)

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.

0

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

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.

0

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

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
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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.