eclipse error "android.jar" missing - android

I'm trying to import my android projects to my new pc. but eclipse fires the following error-
"Project 'MyProject' is missing required library: 'C:\Users\myName\AppData\Local\Android\android-sdk\platforms\android-10\android.jar' Build path Build Path Problem.
but there is no folder called 'C:\Users\myName\AppData~", my user folder is 'C:\Users\PC\AppData~.
how to fix this guys??

Delete the android.jar from Project->Properties->Java Build Path

Right click on AndEngine go to Properties ->Android select Android 4.03 and click ok . This will build your project in Android 4.03 and get the required Andengine.jar file.

Change your computer name to "myName".

I also came across this kind of issue occationally, doing clean or selecting android project build target doesn't work, restart eclipse works though.

Your sdk have missing .jar file
Download android.jar file from https://github.com/Sable/android-platforms and paste it.
It will work fine on Windows and Linux

Related

Eclipse giving error, missing R.java file after recent update

I have updated my SDK and ADT to the latest version, I have also update the Eclipse to Kepler the latest one after Juno.
My ADT version is 22.0. After this update when I create a new project, I'm getting error, stating R cannot be resolved to a variable. I have imported import android.R;, but it is showing as unused import stating Don't include android.R here; use a fully qualified name for each usage instead.
Same thing is happening with Mac OS also with the latest update. I have tried renaming activity_main.xml to other name, but still my R.java is not generated.
Tried all the things which are possible. Cleaned the project, build the whole workspace. Nothing helping.
I think ADT or Eclipse compatibility is having problem after the update.
I have updated my whole SDK, here is the screenshot, but same problem is there.
After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools.
After installing this, clean your projects and rebuild.
Yesterday, I made an update with sdk manager, and I had the same problem as you. I fixed the issue: I have updated another time the android sdk (with the sdk manager tool), then I check update from eclipse for install the updated ADT plugin and I rebuid my project. "Android sdk Build-tools" from Android sdk manager is now rev 17 and now it is OK. I think the issue is from adt plugin from eclipse
import android.R - remove this statement from all your classes and then do a clean your R file will be generated. if this did not work then check all your xml files for any errors and then do a clean. These 2 are the most common reasons for R file to go missing
Changes in your Build target also can effect R.java in Eclipse so
Right Click Project >> Properties >> Android >> Select Latest(usually) Android API Platform >> Click OK
Hope this is helpful.
Follow These steps...
Right Click Your Project.
Select Properties->Android Check Project Build Target and API Level.
Again come back and open Android Sdk Manager Chekc the Tools and make sure you are installed Curresponding Android SDK Build Tools.
Eg : IF you selected api level 17 in properties you should install Android SDK Build Tools 17..
Try this:
make a backup of your projects on desktop
close eclipse
delete your workspace
restart eclipse and import your projects again.
I had same problem.. I solved by doing the following:
check all xml files and drawable files if there are any CAPITAL LETTERS in file name, if you have then change it to lower case, if you are using selector xml files then check the other files you are linking in those files..all should be lower case.
Go to java files which show error and remove IMPORT R.java file from imports list.
Go to Projects>>Clean.
This should fix the problem. This is how i fixed :)
My issue was that I had android:orientation misspelled in my activity_main.xml file and I was getting this error. I fixed the spelling and problem went away! So make sure activity_main.xml doesn't have any errors in it.
Sometimes when you extract your file it miss some part so better when its extracting make sure all file are extracting properly and then run eclipse after that run a simple file and install plugin of avd
it helped in my case
if the problem persists then try closing the other projects by
right click -> close Unrelated projects !
this worked in my case
For eclipse users:
Comment the lines including R.*
Clean and build.
R.java will be generated and then uncomment the R.* and rebuild.
the best solution for r.java missing for linux...
R.java is self generated in gen folder.. so better dont edit or create manually by urself ..
-open terminal(alt + ctrl + t)
-change directory to skd->tools
-then provide executive attribute to all executable file by(sudo chmod +x filename)
-do the same for files in sdk->platform tools .. (ie sudo chmod +x filename) ..
-----every executable file sud b provided with +x attribute...
just delete gen folder all of your error will be cleared
Proven successful method, check the file (AndroidManifest.xml) and delete all comments in it, and make sure there are no errors in this file, I tried and did work with me.

unable to get system library for the project on eclipse ide

I was working on an android tutorial and it wanted me to import the library from another project .The import worked and the project works correctly. But I noticed that doing that messed up several of my other projects (the ones that use Android 2.1) by apparently messing with the build path. Now instead of seeing "Google APIs [Android 2.1]" under the gen folder I see "Unable to get system library for project".
I verified the following:
I right-clicked the project and went to Properties I see that the correct Project Build Target is checked(Google APIs [Android 2.1]), but "Unable to get system library for project" is still shown above the assets folder and below gen and Android Dependencies. Cleaning all projects doesn't help.
How can I fix this problem?
is there a way to fix this issue globally or do I have to do it one by one?
I had the same problem. Try
Right click on your project
Go to properties
Click the Android section
Select a different target api (assuming one is already selected, as mine was - otherwise, select the one you want and jump to step 9)
Click OK
Do steps 1-3 again
Select your original target api
Click OK
Clean and build your project
Worked for me, anyway.
Derived the solution from:
"Unable to get system library for project" after I upgraded to Android SDK 2.3 and ADT 8.0
Error in .classpath on your project. It not connect to android sdk. Fix it and clean project. :-)
This happens when you are targetting an API version that for some reason is not mapped on your buildpath.
See which is the version of the SDK you are pointing to at the project.properties file.
Go to the SDK Manager at Window->Android SDK Manager
Check the Android API item that matches the version you want to use, OR, click on the latest one and then update your project.properties file.
Make sure your project build configuration is Project->"Build Automatically"
Retsart Eclipse (claning and rebuilding may not refresh all the project properties)
Borrowing from #Erhannis answer :
"
Right click on your project
Go to properties
Click the Android section
"
When I view the build target everything looked fine :
So I checked another build target , hit apply, and then re checked my original build target (Android 4.4.2) and re-hit apply. My project then compiled.
For me the project.properties file was missing (it was code from a repo I checked out). So I just created one with this line:
target=android-20
After that, Erhannis' solution worked for me.
Just for completing Erhannis answer: If you fixed the problem but it appears again when you restart Eclipse, then just go to the file local.properties on your workspace folder and verify that the location of the Android SDK there is correct.
At times, when only single Android SDK version is installed on your system, and if it gets changed either by un-installing / re-installing Eclipse, or otherwise (directly through SDK Manager), then this issue might crop up.
.
This is accompanied by the message like this on Eclipse console:
YourApp] Unable to resolve target 'android-22'
.
A simple workaround to this issue is:
Open AndroidManifests.xml of the project, and in the:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
change the targetSdkVersion to the one currently installed on your system
Next, open the project.properties file and update
target=android-21
to your current SDK version
Finally, clean and re-build the project
Right Click on Project-> Select Android tools -> Select Fix Project Properties
This did the trick for me.
You need to click on the menu icon with the Android sitting in the grey box with a white arrow pointing down "Opens the Android SDK Manager".
or, from the command line, run:
%ANDROID_HOME%\tools\android sdk

The project was not built since its build path is incomplete

Every time I try to import a project downloaded from googlecode into Eclipse but I get some errors:
The project was not built since its build path is incomplete. Cannot
find the class file for java.lang.Object. Fix the build path then try
building this project
Unable to resolve target 'android-10' (this changes from 1 to 15)
I've already checked the other answers on the site but no solution worked.
In
Properties -> Java Build Path -> Libraries
there's 1 item:
Unable to get system libraries for the project
Right click on project -> Properties -> Java Build Path (From Left List) -> Libraries (Tab) -> Add Library (Button on right) -> JRE System Library -> Next -> Workspace default JRE -> Finish
This should solve at least one of your errors. Any others might require you to add further libraries.
Close eclipse and re-open worked for me. You may have to do this two or three times. Each time give it a minute for the auto build startup process (check bottom right hand corner) to complete, as these errors often disappear at this time.
Or try to clean the affected projects.
'Turn it off and on again'
It seems that you lack JDK (java.lang.Object comes from there )
The problem is that you used the same Android API on different PC. Eclipse is lost with path names that are differents but with same API.
To solve it, first re-select Android API version (set to another one and valid, then restore the on you want and validate it -> it will force Eclipse to reload API).
Then go into project->properties-> java build path. Then remove "Unable to get system library for the project" then "Add library" and select "Android Classpath container".
Initially I was trying to import an android project from github and encountered the above problem
cannot configure build path
unable to get system libraries
Package Explorer -> Right click the project -> “Properties” ->
"Android" -> "Project Build Target" = 2.3.3
Note: Also try Clean (On Windows: Project -> Clean) then Refresh (F5) at random. There's a good chance this will magically solve all your problems.
courtesy: KYLE CLEGG
reference link
None of this worked for me. I created a new workspace for the projects. That worked for me! Switching to a new workspace usually miraculously solves a lot of these configuration problems. Simply create a new folder where you would want your new workspace to be and then use 'import project from existing code'.
Goto eclipse → Preferences → Java → Build path.
Do you see a JRE_LIB configured there? If not, add JRE_LIB from JDK/jre lib location. These can be overridden per project. It seems your eclipse isn't aware of Java libraries.
I have seen such errors in past while importing projects in eclipse. The solution to that is to go to properties->Android and select project build target appropriately (Android x.x.x or Google APIs)
Was struggling with this while trying to load the Vuforia Sample App for way too long today. The solution that finally got my project to build was:
1) Window->Android SDK Manager and Install the latest updates
2) Project->Build Path->Configure Build Path->Android and under Project Build Target mark Android 4.4.2 and click OK
3) Clean, Build and Run
I hope this solves somebody else's issue as well, Eclipse is frustrating as F$##!!!
I encountered with the similar problem.....
Make sure that
You create your project within your workspace. If your project is not in the default workspace where .metadata folder within which other plugin folders, and etc. will be present, then it will ask you to configure build path as the project is not build because of incomplete build path.
If the first step is clear, then go for this.....
Right click on your project -> build path -> configure build path -> libraries -> Add libraries -> JRE system libraries -> Apply and close.
I've had similar problem. Exact same error, but in Ubuntu after I worked on project in dropbox folder from Windows.
I've just added android.jar to project. Somehow it disappeared from build path.
For me this problem was related to OpenJDK 6 on Ubuntu.
Update your JRE or install Sun's proprietary JRE instead and restart Eclipse.
I know this is too late. but I am also facing this issue and I fix this by following below steps.
This issue is occurred only if the project shared between different machines.
For me I found java JDK is the problem.
My colleague used mac system and using jdk 1.7. but in my system I used jdk 1.6.
I guess that may be the issue. So I select project and open properties and change my jdk to 1.7
Change target=Google Inc.:Google APIs:19
Clean & Build
Finally issue is fixed. I think this is because of If you build your project with higher JDK version thereafter you should build with same version.
NOTE : we are not facing this issue before until my colleague build with JDK 1.7. After he started to using JDK 1.7 only this issue occur.
Hope it will work for some one. And no need for install new eclipse.
I had my "Build Automatically" turned off in "Project". I turned it off, because the Eclipse was not loading the projects correctly, for various unknown reasons. Turning this on, solved my problem.
if the project is not very big, you can copy the packages and paste it into a new project, you won't see the errors in the new project.
I was having target-18 in my project.properties. But I wasn't having android-18 sdk. So I changed 18 to some other version which I had in my SDK manager, and it fixed the issue.
You just exit eclipse once or twice to reload. It works for me.
Steve's answer does help for some projects, but still, for some projects, it remains the same. I guess that projects were previously build-in early JDK 1.5 (in my case). But I found a workaround for them:
Find the class that causes the problem (Keep expanding the project in the Package Explorer).
Copy the class's contents after the import block.
Delete the whole class.
Right Click on the project then Android Tools >> Fix Project Properties
Create a class with the same name under the same package the deleted class was before. (If the project is imported and the deleted class was an Activity/Service/Provider/Reciever, I guess the class is already included in the AndroidManifest.xml).
Paste the content of the class and import packages.
Clean the project.
I had to delete R.java in the gen folder, then do a clean build. This solved my issue.

Gen folder is empty for Android project

I'm starting to learn Android in Eclipse. But every time I try to create a project the gen folder is empty. So I don't get the R file(or whatever else is in that folder, if anything). Clean does NOT work. There was never an R to begin with. Do I need to download something to make it generate it?
had the same problem. Check in the Android sdk manager, tools and check if you have installed android sdk build-tools. had the same problem because i hadn't installed it.
I had this problem because I had two projects in the same folder and one was the library of the other. Then Eclipse built the projects in the wrong order. What I did to fix this was close the non-library project and then open it again (after the built of the library project), which made it work.
None of the solutions posted here worked for me: Clean, changing options, build errors, etc. The problem was caused by importing the Android project as a normal project, i.e. using:
Import > General > Existing Projects Into Workspace
instead of using
Import > Android > Existing Android Code Into Workspace
One of those
Getting rid of 'import android.R' line.
Cleaning the project and then building it again.
Closing project and then opening it again.
may help.
May be your problem was related to incorrect target build settings.For example if you use an element in your layout that is available in greater Android targets.You can see more details here.
STRUGGLING FROM THIS BUG FROM LAST TWO DAYS. FINALLY SOLVED IT :)
The best way to get rid of this is to go to WINDOWS option on the tool bar -> ANDROID SDK MANAGER -> and tick TOOLS option on the top tools bar (i.e. all all android sdk tools , android sdk platform tools , android sdk build-tools.) and install.
After updating all these too latest versions , go to HELP and hit CHECK FOR UPDATES and install all these new version plugins.
Last step is to go to PROJECT option in the tool bar and uncheck the BUILT AUTOMATICALLY option and go to CLEAN and perform clean on required or on all projects.
I know this method might consume some of your net mb's but will definitely solve your problem.
E.njoy...:)
I ran into the same problem. I had incorrectly set the path of the Android SDK. Setting the path in Windows -> Preferences -> Android did the trick for me.
I had the same problem. Just add these two line in your project.properties file
target=android-19
android.library.reference.1=../appcompat_v7
I happened to have the same problem, solved by "Right click on your project and then click Build Project".
Try this,
Right click your project
Select properties.
Select Java Build Path
Click add Folder
Select the gen folder
Click OK.

could not find apk in android

I am using spring and maven plugins in eclipse but when i want to run this project it returns Could not find ShopZilla.apk? How this will resolved, Please suggest me.
Make sure after updating your android sdk sdk build tools are updated properly. You can check it by Open sdk manager -"Android Sdk Build Tools" status must be installed. if the status is not installed then install Android Sdk Build Tools for the same.
If you have got all required plugins installed (ADT, M2E and M2E Android), the apk should be automatically generated by IDE.
Sometimes the apk file is not generated simply because there are some android build error in your project, unfortunately, these are not compile error so they are not shown in Eclipse problems view. For example, if you attach a icon.jpg file in your res/drawable folder and change the extension to png, you get no compile error in problems view, but if you then manually delete the apk file in your project output folder, the apk file will not be generated again and in this situation Eclipse only gives very generic message "could not find *.apk file" in console view, when you trying to run it on emulator.
Now the only question is how can we tell if there are android build error. right click your project, choose Android Tools -> Fix Project Properties. in my jpg/png example, Eclipse will show "libpng error: Not a PNG file, ERROR: Failure processing PNG image C:\android-sandbox\source\yourproj\res\drawable-mdpi\icon.png" and project marked as a error in package explorer view. as soon as you replace icon.jpg with a real png file, bingo, apk automatically generated. Though I am not sure if this can detect all subtile android build error.
If you are using the ADT plugins greater than ADT17 then rename your "lib" folder to "libs".
Then Right click on project => Android tools => Fix project Properties => Clean your project
If still issue then just restart your eclipse. Your issue will be gone.
Please follow these steps; this might help you out:
Go to Project->Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
or
projects -> clean

Categories

Resources