I'm developing an android application and I've gotten pretty far already.
but recently I opened my eclipse again to continue my work, but there was a problem with my settings for the google play services. (I'm kinda sure it happened after I installed the new version (revision 7) from the android SDK manager.)
So I imported the google-play-services_lib and the google-play-services.jar again and the errors went away, so far so good I thought.
But now eclipse can't resolve R to a type and I can't run the app either...
I've searching the whole day to save my project from these errors and now I'm getting this one...
btw the project ran perfectly for 4 months...
can anyone tell me wat to do?
EDIT:
what I tried so far:
I've added all android build tools, google play services (libraries and projects),... Imported the google play services project into workspace and cleaned the project like 30 times. I Already checked private libraries, android dependencies etc. to export
I had the same problem I think.
In /gen there was no R.java for me but when I updated my SDK-Tools everything was fine since they seem to have changed the order in the last version.
Try that maybe!
Found it:
the SDK was already updated, but the device settings were changed somehow (now it was compiling for android 4.2.2 instead of 4.0.3) and when I cleaned the project, it updated some code I didn't notice, when setting the 4.0.3 build target again it wouldn't compile nor generate the R.java file (giving me loads of errors).
So what I did was change the project build target to 4.0.3 again, but I must have missed some lines of code that were updated to the 4.2.2 target... (leading to the R file not being generated, leading to more errors that were leading to more errors... just a vicious circle)
I didn't exactly remember what line caused the error, I was too happy it was solved I guess :)
Related
I'm trying to add admob to my android app and can't seem to solve this problem. I have imported the whole google__play_services_lib into my workspace, added it to my android project file as a lib, cleaned it a 100 times, updated the android sdk manager 10 times, checked for updates, upgraded to eclipse mars from juno, replaced jar files all over the place and got errors in my res file because of that, I have built projects, then got errors with my appcompat_v7 lib, I have managed to solve that, but the google thing is very-very frustrating and I dont have ideas anymore. I have messed around with my build path again & again. When I refresh the SDK manager, the google-play-services-lib.jar is nowhere to be found on my computer, however, I assume it should be, idk.I have downloaded it, but even that did not work out well. I have a jar.properties file that I shows up from time to time. I have also searched for sources where I can find this whole thing zipped, so I can use that instead of the SDK, cause I dont trust it anymore. So I am stuck.
enter image description here
I have tried so far every solution; clean, change the namespace etc. I still cannot get this resolved.
I have created an Android project with API 19 and it creates another project alongside mine called appcompat_7. This project has quite a few erros and one of them is " article_view cannot be resolved or is not a field ".
The following files have the errors;
ArticleFragment.java
HeadlinesFragment.java
MainActivity.java
All of these files seem to have issues with R.layout.*
I am not sure what would resolve this issue at this point as this is completely new project and I have tried almost every API above 17 and each project has definitely an error that does not get resolved with clean etc. I am using Eclipse Luna and I am sure I was able to install the correct SDK.
As a note: Am I the only one who thinks this IDE for Android is somewhat messy and not friendly at all?
Thank you for any insight.
Edit:
I solved the problem by trying API 18 for both compiler and target. It did not create the appcompat_v7 project so I just fixed the dependencies and changed the namespaces. I still think Eclipse is not working well with Android plugin.
I was also stuck with the same issue few day ago,
I resolved the same issue by updating sdk to latest version 23.0.4. and extras: Android support Repository to rev. 6 Android support Library to rev. 20
first of all open up your Android sdk Manager from eclipse and download all latest sdk updates and extra downloads.
And then after downloading all updates , you have need to use a fresh Eclips editor because your existing eclipse will not let you successfully update from Android sdk tool 20 to 21.0.4 Then just use a fresh eclips editor and set up updated android sdk path in the fresh eclips (the same one you have used in your last eclipse editor , you can find it at Window>> Prefrences >> Android).
Hopefully this will solve your problem.
This is the detailed version of what happened. Please have a little patience and read this. I think my problem is unique.
Initially I had installed Eclipse and followed all procedures and was happily coding my first app. One fine day I fired up the SDK manager and saw the Android Tools had a new update. I tried to install the package. Then may be due to my slow net, something went wrong and Eclipse didn't work at all. It said there was something wrong in some file as an error message.
So I installed Eclipse again and followed all procedures. The address of the workspace and the Android SDK was kept same so that my projects will be automatically imported. But now Eclipse is underlining the R or Resource references in my src files. I do not know what to do.
Did you try opening the sample project that is shipped with andoid SDK? If even that one has the problrm, I think you must update ADT plug-in. Updating SDK and not ADT plug-in caused the problem for me. Once I updated ADT plug-in, everything worked fine.
Although I know this question has been asked a million times, I have tried going through many of the stackoverflow questions and none of the answers have worked.
I have an old version of my project that I know worked and built correctly, which I added back into my eclipse workspace. When I clean and build the project, I am given with errors with the R cannot be resolved..
What I've tried:
- Building/Cleaning project
- Was going to clear the gen folder, BUT R.java didn't even exist in there
- Checking through my XML files to ensure there's no errors
- Restarting Eclipse
Extra note:
- My ADT plugin and Android SDK was the LAST version directly after Google released it's updates to merge everything over to Android Studio.
I just solved this problem for myself. I was using the Eclipse Android SDK on Windows 7. The problem was that the Eclipse program did not have permission to create the R file. To fix it I went to "User Account Control" settings in the Windows Control panel and lowered the slider to a lower security level. After rebooting the computer and cleaning the application in Eclipse Android SDK there were no more errors.
I've experienced the same problem a week ago. After installing the beta version of android studio I was unable to run android projects in eclipse. Uninstalling android studio fixed all the "R cannot be resolved to.." errors.
After trying everything I tried one last thing.. which was to update all of my plugins and libraries for Android. This actually solved the issue. I'm sure not that many people will probably have my specific issue since it will eventually go away, but it is a different problem I have not found and a different solution I have also not found...
I faced Simmilar problem, i cleaned project, Restarted Eclipse, and many other things like remove errors from problems,
but it was DUE TO: an Image Name in Drawable it contained Capital Latter i did Re factor -->Rename and Problem solved..
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.