I was faced with the problem:
error generating final archive debug certificate expired on
but existed ricipes to fix it didn't work. What did I do ?
In C:/Windows/User//.android I deleted the debug.keystore file.
Clean the project
Rerun Eclipse
No results - anyway I see the subject problem.
Trying to fix it, I recreated debug.keystore, using the keytool in my JDK 1.7, copied new file to C:/Windows/User//.android, rerun Eclipse - no results.
Does this problem mean that my problem project and another projects were spoiled by this bug (feature)?
I'm not sure about this particular error, but I've had similar errors that wouldn't seem to go away. If Eclipse really doesn't want to get rid of the error, you may have to reinstall it and start a new project and manually move your old project's java files and resources into it.
Good luck!
EDIT: Also, if you do this, make sure to not use the same workspace folder, as something may be screwed up there to.
OK, I just finished updating Android's SDK+ADT to the latest, and this solved the problem.
Turns out this has nothing to do with Eclipse (so re-installing Eclipse is not really the solution).
The funny thing is... there isn't any debug.keystore in %USERPROFILE%/.android anymore!
(but there is a new file androidwin.cfg in that directory.)
This Android development system is getting weirder by the second... Why install "time bombs" that force me to upgrade for no apparent reason? Let me plan & control when to perform an upgrade. I shouldn't be losing productivity hours in such an unplanned and unexpected manner.
UPDATE: No, updating Android's SDK+ADT to the latest didn't solve the problem. It only deferred it to the stage of running the built application on the test device. This is very frustrating.
UPDATE: Re-installing Eclipse, with a clean install of the latest ADT rev 16, didn't solve the problem either. It seems that the only way out is installing SDK from fresh? It's inconceivable that a fresh Eclipse + fresh ADT + fresh SDK will continue generating this error, so that's the only thing left to try.
UPDATE: Using a completely brand new workspace with the new Eclipse+ADT (but without re-installing a fresh SDK!) did the trick. It seems that the new ADT+SDK combination doesn't like legacy workspaces, or something got corrupted in those workspaces. I need to salvage them somehow because they are critical projects. I'll have to check whether copying the entire workspace to a temporary area, then importing all projects there will do the trick. This is so frustrating.
UPDATE: Success! Using a completely brand new workspace with the new Eclipse+ADT (but without re-installing a fresh SDK!), then importing all my existing projects did the trick. Bounty to be awarded to the one who suggested that. Oh, and the most important thing: Do NOT use this environment on other than the Administrator's account! (the account under which everything was installed).
Delete your debug certificate under ~/.android/debug.keystore on Linux and Mac OS X; the directory is something like %USERPROFILE%/.androidon Windows.
The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.
After steps 1-3 just delete this error from problems (select it in "Problems" view and click "delete"). After this everything will be fine.
Related
I know there have been several problems like this, but in all of the threads that I have seen the problem is that the .xml files contain errors(or are named with capital letters or something).
In my case, eclipse won't even generate a R.java when I create a new project that only includes the standard "hello world" example files.
I have restarted, re-installed and recreated projects, but nothing seems to work so in my desperation I am hoping someone has seen a similar problem and knows a solution.
If you run a clean on the project it should regenerate all the generated java files, namely R.
In Eclipse, under the Project menu, is an option build automatically. That would help you build the R.java file every time modifications are made. The Clean... option is also there under Project.
I noticed a very similar problem upon upgrading the version of my Android Development Tools to 22. The solution was to install all updates for ADT by opening...
Help -> Install New Software
... and using the update site...
https://dl-ssl.google.com/android/eclipse/
... to install all outstanding Developer Tools updates.
First of all thanks for answering.
It turned out that after installing the ADT, some SDK packages had not installed, (even though I distinctly remember choosing to install them). I installed those packages and everything seems to be working fine.
Thank you
I am a new Android developer (4 weeks into porting my iPhone app to Android). I have 8 projects (the app, and 6 small UI experiments, and a vanilla Hello World project that I just created with Eclipse). All fail to compile, and the issue is that every reference to the generated file R is flagged as "R cannot be resolved to a variable".
Up until yesterday afternoon -- every project compiled and ran (albeit very slowly) in the Android emulator. I've changed something, and since yesterday, all projects fail to compile, all in the exact same manner "R cannot be resolved to a variable". I every case, the generated files are missing. I believe they disappeared as I tried to clean and rebuild each project in the course of debugging this problem.
Two things that I know changed when this problem started, but that I can't say caused the problem, were: 1) shifting to debugging on a real Android device (a Samsung Galaxy Tab 2, which worked like a champ after struggling with the slow emulators), and 2) allowing Android (and perhaps Eclipse) to update themselves from the web.
I've spent many hours trying other user's suggestions and none have helped. Most suggestions refer to file naming issues, xml syntax errors, but I haven't changed these files and filenames since compilation was working. I have tried:
cleaning and rebuilding the projects
checking for subsequent updates to the Android SDK (and there were 2 subsequent ones)
Eclipse->File->Android Tools->Fix Project Properties
making small source changes to force rebuilding
rebooting Eclipse, as well as the Mac host, adb, the emulator, the Android SDK Manager
deleting a project, restarting Eclipse, and adding the project back in (bad idea - this fails with an error "Failed to load properties file for project 'ListViewFragmentTest'"
creating a brand new Android App project, which has worked many times before, but now fails
There's something going systematically wrong, and while I won't claim all these projects are bug-free, they did run up until 6pm yesterday, and then all stopped compiling thereafter.
I wonder if anyone has other suggestions, before I embarking with a complete reinstall of the development environment?
My environment is:
Macbook Pro (OS X 10.7.5, 8GB RAM, 2.53GHx Core i5)
Eclipse (Indigo Service Release 2, Build: 20120216-1857) (too old?)
Android SDK Manager Rev 22
Android SDK Tools (22), Platform Tools (17), Build Tools (17)
API's 11-17, all up-to-date
Seems like lots of people experience trouble with missing generated files (R), and I have had trouble when I've had layout XML errors as well, but that doesn't seem to be causing this problem. Thanks in advance for your help!
I am not sure but you are facing issue of R.java file is not getting generated after updated with ADT rev 22.
If this is the case then here is the solution:
Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.
Check in the Java build path library, whether "src" check box is checked or not.
If you are using any additional Libraries then make sure libs/android-support-v4.jar is same for project as well as the Libraries.
Thanks everyone. None of these suggestions resolved my problem. And while I'm curious as to why it happened, I was more impatient with not making any progress. I've reloaded Eclipse and the Android tools (this time with the bundled version from developer.android.com), and everything is working smoothly again.
I tried looking into similar problems, but the solutions offered there do not seem to fit my particular situation:
I initially followed the instructions for Configuring and building the sample application for In-app Billing, replacing the security key with the public key from Google's Developer account and changing the package name from com.example to com.billtheape.
I then built a non-release version and ran a "sanity check" on my Android phone. Everything went OK (except for accessing the Android Market server, of course, since by design it only works with a signed release version).
Then I tried to build a signed release version, but received the error:
[2012-01-03 20:52:45 - Dex Loader] Unable to execute dex:
Multiple dex files define Lcom/android/vending/billing/IMarketBillingService;
[2012-01-03 20:52:45 - Dungeons] Conversion to Dalvik format failed:
Unable to execute dex: Multiple dex files define Lcom/android/vending/billing/IMarketBillingService;
The problem now is that even the "debug version" building generated the same error, regardless of how many times I tried to clean the project.
This didn't look to me like a Build Path issue in the sense that the accepted answer described (I checked that, too, but couldn't find anything suspicious). So I tried something else:
Exited Eclipse
Spotted three subdirectories under
%ANDROID_HOME%\extras\google\market_billing\gen\com: (1) android
(2) example (3) billtheape
Deleted the subdirectory example.
Started Eclipse and cleaned the project.
Debug version builds now properly, but signed release still generates the same error. It turns out that deleting that extraneous subdirectory wasn't what did the magic, but rather restarting Eclipse and then cleaning the project.
OK, so at least I got the "debug version" working back, but the signed release Export keeps failing with the same error.
Any idea what this error means, why it happens and how to fix it?
Short answer: Because Eclipse + ADT sucks. That's why.
Longer answer: I just imported the same exact project to a different machine with a slightly different configuration: Eclipse 3.6.2 (instead of 3.6.1 in the problematic system described above) and SDK R13 (instead of R9 in the problematic system).
Then I tried to export it, using the same exact steps described above. Works like a charm!
What is this? Voodoo?
What happened to the days in which the IDE behaved more predictably than the software I was trying to develop?
Next step: Upgrade Eclipse (to 3.6.2) only, on the problematic system and see whether this solves the problem in that system, too.
Update: I just finished updating Eclipse 3.6.1 to 3.6.2 on the offending system. It turns out that it is impossible to install Eclipse and keep the existing ADT. https://dl-ssl.google.com/android/eclipse/ forces you to install "the latest & greatest" even if you want otherwise (for configuration management & tracking reasons for example). So with the new Eclipse 3.6.2 I got ADT 16.0.0.v201112150204-238534 as well. Works like a charm!
The root cause and explanation for the odd behavior of the combination Eclipse 3.6.1 + ADT 9.0.1.v201101191456-93220 will never be known... and this is a combo with which developers were supposed to (and did) release commercial grade apps to the Android Market at some point in time. Amazing.
I too had the same issue and i solved it by :
Delete bin & gen folder
Remove the dependency libraries(if any) and add them back
Finally clean up the project and build it again.
Done!
have an odd one..
Using Eclipse Juno, and everything was working fine for the last couple months. At some point yesterday, while Eclipse was cleaning my project, something crashed - popped up the Windows error reporting. (Didn't catch the name of what crashed..)
Now, I have no R.java class in /gen, and nothing I've tried will generate it. On top of that, when doing a clean rebuild of the project, the Output window remains blank. (No errors, no status message.. nothing.)
Tried just about everything - including the latest which included reinstalling Eclipse and then ADT. Still hadn't helped. (I have NOT tried clearing the workspace metadata yet, will do that soon.)
Any thoughts on what else to check?
--Fox.
Edit: Updating a random file - either .java or an XML layout/drawable does not have any effect, still nothing. Also, removing saved preferences from workspace .metdata data didn't have an effect either.
Edit 2: Okay - not sure WHY it was happening, but creating a new project and the issue was corrected.
So somehow either the project settings (.settings or project.settings) must have gotten corrupted. I have the origianl project still, and am curious to see why it happened, but creating a new project and copying sources and resources over, and no more issue.
Thanks to all that offered comments - goes to show that any kind of little corruption can cause strange things to happen.
The reason in 99% of the cases is that you are missspelling something in some xml file.
The R class file won't appear until all xml files are correct.
I suggest look carefully into your XMLs for a very small syntax error.
Or try taking off 1 by 1, until you figure it out wich one is the problematic.
:) kind of annoying, i know.
If you don't have any errors in your xml files, you tried to reboot your eclipse, your emulator, then open the sdk manager and apply all update. My R have finally been generated.
I found this happened after updating my Android SDK Manager and related eclipse plugins. I am running in Ubuntu, and it would not let me update the plugins unless I ran as the root user (using "sudo eclipse")
This left some of the Android SDK Manager items, and the eclipse plugins, owned by root. This stopped the "clean" working on the project - it must have been something that had been added as the root user, and not accessible as my normal user.
I had to "chown" my eclipse directory and my Android SDK Manager directory so it was owned again by my normal user:
cd /home/myacct/android-sdk/
chown -R myacct:myacct *
After this the clean option worked, and R was regenerated.
This was it for me:
In your AndroidManifest.xml file, make sure that you have the SDK installed for the version number in android:minSdkVersion="##".
You can install SDKs from the Android SDK Manager, found under Window -> Android SDK Manager in Eclipse / ADT.
For me it ended up being gen/com/(appname)/R.java missing.
Not in my recycle bin, not anywhere... just took a surprise vacation and never returned.
I had a backup copy in a different folder. Copied it back and all's good now
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.
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.