Importing Android project into eclipse gives me two project - java

I am importing the following project : ActionBarCompat-Basic from the Android Developers website into Eclipse.
by doing so: File -> Import => Android existing project.
However, in my package explorer, it creates me two projects :
1) The first project is named MainActivity
2) The second project is named tests.
Also, the two projects both have errors
Is that normal ? If yes, how can I solve the errors issue ?

Note, because you do not say wich project you are importing, this a blind answer.
You get two project simply because in the downloaded folder are two project.
To resolve errors first of all try to do a clean Project=>Clean... and select the projects you want to clean.
Unfortunately errors are common when you import project coming from around the web.
You should right click those projects, open Properties and check the Android tab, check if you are missing some library and try to figure out wich library is (or are).
Check Android 4.4.2 as build target.
Open the Java Build Path tab and open the Source tab, check if the gen and src folders are there, if not, add them.
If error are still there open the files marked with the error icon and try to figure out wich library they miss.
Check the Eclipse error Log.
I hope this help.

Related

After creating android project in Eclipse ADT, tons of errors show up

I'm using eclipse ADT (most recent version) to develop some android apps. I've followed the getting started tutorial at the dev.android.com and it worked just fine.
But when i tried to create another project with the same targets and sdk's, i've got nothing but errors:
Some errors and my sdk's:
That's the same sdk's i used before these errors started showing up.
What can be causing this?
EDIT: my project won't generate the R.java file
You might need to add a support library to your new project.
Check this link for downloading the support libraries -
http://developer.android.com/tools/support-library/setup.html#download
Please notice that you need to import them into your eclipse and then include one (preferably the newest, not sure about this) in your project.
EDIT:
Before downloading the support libraries you should first check if you have them already.
Try this, right click project folder in the eclipse package explorer, Properties>Android>Library>Add>select a library if you have one.
There might be an invalid library included in your project already, if that happens then you will see it in the Library>Add> menu, remove it and add a new one.
You might have clean your project ........
if yes.....you must check whether R.java file is present in **Project(your project)->gen->package name->R.java**
if not than u have to update Tool Folder in SDK manager

Build path problems with sdk

I just downloaded the Android SDK and the plugin but when I try to create a project it automatically makes a library for the support and my project that I created has errors. Here is what I mean:
This is after I clean up the projects [Project -> Clean]
Additionally, R does not work (even when I import it) :
This is all with a clean project. I would appreciate it if you could help me.
Note: I know there are similar questions out there, but I could not get it working.
I think I need to import the appcompat package again, but I do not know where to locate it.
The error the container "Android Dependencies references non existing library" probably means your build path isn't pointing to any jar file. I recommend checking your build path:
Right click and choose 'build path'
Click on 'Android'. Make sure app_compact appears under the library target. If it does not click 'add' under library to add it.

Renaming Library project doesnt update reference to Project

I have download one project from https://github.com/bauerca/drag-sort-listview, it is containing library and a sample. I tried to rename the library by refactoring and build it successfully as library_dragdrop. Now when I am trying to run the sample that is "Launcher" after modify the reference of the library so it is not letting be build the project.
Updated Reference of library as :
Right click on Launcher project --> Android ---> Library and remove previous and added new from project dropdown and it is showing green but when I am cleaning and build so it goes onto previous reference as library and showing me all red.
I tried copying the package from library to "Launcher sample" but although it resolved many errors but now R cannot be resolved and still can't run the sample project.
Have you tried Project-> Clean Project?
Check all you .xml files, not only your layouts. Just a slightly error can make big problems. The editor might not show where the error is, so look thoroughly!

Error when importing an existing project to eclipse

So I'm trying to import an existing project to eclipse and when I do I get the following error. The main folder of the project in the package explorer has a red exclamation mark (!) next to it and console says the same error 3 times:
[2013-07-10 14:23:39 - Myproject1] Project has no target set. Edit the project properties to set one.
[2013-07-10 14:23:39 - Myproject1] Project has no target set. Edit the project properties to set one.
[2013-07-10 14:23:39 - Myproject1] Project has no target set. Edit the project properties to set one.
I did my research on this error and found a bunch of stuff on this website already but nothing helps. People are mostly getting this error when they try to execute the imported project, not as soon as they import it. I also tried setting the "target set" in the project properties, as the error tells me to, but I can't find where to set the "target set" anywhere in the properties.
One more thing worth mentioning also, if I open the src folder and try to open any of the *.java, everything is blank, the "code" opens but it's blank. Any help would be greatly appreciated!
The file 'project.properties' is missing. It must reside in the root-folder of your project.
( Where the AndroidManifest.xml is located )
You should create a new android-project and import the sources and resources
OR create it manually.
Example content for project.properties:
# Project target.
target=android-17
Greetings
Christopher
set android target version on your project manifest xml file or eclipse ->right click project click properties->select android tab->check latest android version on the list like below screen shot:
after click ok button will apply wait some seconds after your issue will be solved!
you should try fixing project properties:
rightClick on Project -> Android Tools -> Fix Project Properties.
That resolved my issue!
You are probably importing your project folder on your workspace. In my case, i got that same error, so i just move the project folder to "C:" and tryed to import again. And bingo!

Android Eclipse Classpath - want to add classpath container path but eclipse won't let me

I'm using Eclipse to learn to develop Android applications in Java. I haven't used Eclipse before.
The project I'm trying to use (supplied by OReilly as part of 'Android Application Development') is MJAndroid. When attempting to run the project, the Run fails, and the Problems tab mentions com.java.Object can't be found, and Eclipse asks me to check the build path. Clicking
Properties -> Java Build Path -> Libraries, the message 'Unable to get system library for the project' is displayed.
On a working project, Properties -> Java Build Path -> Libraries has an entry for Android 1.1, which if I click Edit, has the classpath container path of com.android.ide.eclipse.adt.ANDROID_FRAMEWORK.
It seems a simple matter of adding the correct container path to my non-working project. However Eclipse seems determined to make this as difficult as possible. No matter what I chose to add - jars, externals jars, variables, libraries, class folders, external class folders, nothing seems to take the form of 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK' that the 'Android 1.1' entry on the working app has.
How can I add this namespace to my project so it resembles the working one?
I'm quite sure it's a problem with Eclipse's somewhat odd user interface. Frankly there' nothing I'd prefer more than a file to modify and set such information - my background is in Python, and the whole eclipse environment seems an unnecessary burden.
I had faced the same issue when I imported a sample code downloaded from the internet. I am using android sdk 1.5 with 0.9 ADT plugins. Here is a simpler way to fix the andoid library reference issues
Right click on the project which has
issues and select properties
Select the appropriate Android build
(1.1, 1.5 or 1.5 with google api) and
say ok
Again right click on the project and
select "Android Tools > Fix Project
Properties"
Fix the imports once (if required)
Refresh the project and you should be
ready to go without any manual
editing
I faced this same problem after importing a project through GIT. The problem was that I didn't have the same target android platform installed, and the build path somehow got corrupted.
The first obvious thing i did was changing the target sdk in the project.properties, but even after cleaning up the project and Android Tools > Fix Project Properties, it didn't help and I was still getting the build error.
My solution after wasting close to 1 hour trying to figure this out?
RESTART ECLIPSE
Everything worked fine after that. Eclipse is pretty fickle. Only through years of experience you'll then understand her well. :)
Had the same problem and it turns out the Android SDK Location was not set which was a really simple fix. Go to Window->Preferences, click on 'Android' on the left hand menu, fill in the location of the Android SDK (e.g. C:\Program Files\Android\android-sdk) and click OK. Everything worked fine for me after that.
Found the answer in this set up guide: http://developer.motorola.com/docstools/library/Installing-Android-Dev-Environment/
Sometimes Eclipse can get a bit funny (technical term) with classpath container resolution.
You have a working project in your workspace, so you can rule out plugin installation issues. You could try opening the .classpath file (hidden by default, select the triangle in the top-right of the Package Explorer view, select Filters... and uncheck .* resources) and manually adding the container declaration.
`<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>`
You may then have to close the project and open it again (right-click->Close Project) before Eclipse recognises the change.
You may also find that there is an Android builder and/or nature. If you compare the .project files for the working and non-working versions you may see entries for Android builders/natures. Copying the relevant entries may resolve the issue.
sometimes, eclipse can help you.
In Android projects, click right button on the project-> Android Tools -> Fix Project Properties.
It's usefull in class path errors!!
Luck!
I would verify you have the correct version of Java installed as well as the Android SDK. I would recommend installing/reinstalling the ADT plugin in your eclipse, makes it alot easier to create the android project.
http://developer.android.com/sdk/1.5_r2/installing.html
Also. I guess the path of the Android SDK must be setup correctly. This happened when I was overloaded with projects and I decided to create a new workspace copying some existing stuff into it.
Seems that the new workspace requires you to setup these details too once again
Is that setup properly?

Categories

Resources