Invalid project description when importing project into Eclipse - android

I know this question is posted already here, but that doesn't solve my problem.
I pull a project from github branch, and when i try to import it : File->Import->General->Existing projects into workspace then Select root directory and here when i click on Finish button i get Invalid project description.
I am pulling the project into a folder called Android, this folder contains the main folder of the project MyAndroidProject which i imported in Eclipse.
I don't know what is wrong here.

I know I'm late to the party, but just in case someone else is stuck at this point, just like me a couple of minutes ago: You could try File>Import>Existing Android Code into Workspace. I had the Git repository I wanted to import directly in my workspace. Still, I needed to check the Copy projects into workspace option in order to make it work.
Edit
I just checked out the link from one of the comments above, recommending File>Import>General>Existing Project into Workspace. I should mention that the eclipse project metadata was not under version control in my case, rendering an import as existing project impossible! This solution applies to existing android code without .project files etc.
Edit 2
Just another remark: I realized recently that this issue only seems to occur if the project root also is the repository root, much like this:
workspace
└─ project root
└┬ .git
├ src
└ ...
When I moved the project just one directory level lower, the issue disappeared.

Just move the project folder one directory lower ( make another folder in the directory & copy your project into that folder. Now import the project with this newly created version. )

Had same issue, changed the workspace to one directory above the project and then imported project. Worked for me

I've just read this very old question. The problem is in the Eclipse specific folders.
Simply remove .settings and .project and reimport.

Related

How to import existing projects from another folder to workspace in Android studio

I want to import an existing android project into my workspace using Android Studio. I tried by the common method like File->Import project->Selected folder but the problem i am facing that the project is getting imported in to the same existing project whereas in eclipse i will be having an checkbox stating that Copy projects in to workspace(so that i can copy my projects easily by ticking the checkbox into my workspace). Since i am new to Android studio i couldn't able to trigger the hidden features to import and copy the projects in to workspace. Kindly help me by your valuable replies.
Note: currently i am copying the file from another location in to my workspace and then importing a project in to Android studio. But it is becoming tedious while handling multiple projects at a time
This is how usually to import projects to Android Studio desired workspace.
Android Studio 1.0.2
File ---> Import Project ---> (your current project folder) ---> Import Destination Directory (your workspace location) ---> Finish
I am just having the same problem.
As it happens, if you have a complete AndroidStudio / gradle project and you want to import it in Android Studio, just copy (or move, which is faster) the entire folder in your workspace, and then Use File -> Open, instead of File -> Import Project.
It seems to be exactly the same for the IDE, I can "import" and build a project flawlessly, but of course the "import" is faster (I don't really know why it is working that way).
EDIT:
after looking closely at the "opened project" structure, I think Android Studio is doing something weird. I copied the project from directory A to directory B, and I'm opening the project on directory B, but some of the files are still pointing to directory A.
I retried copying the project in directory B and then importing the project from B, instead of opening; now the references seem correct.
I solved my problem editing the file settings.gradle in the root:
include ':app', ':myAnotherModule'
project(':myAnotherModule').projectDir = new File('../my-another-project/myAnotherModule')
After run gradle sync, you can import this module inside build.gradle file:
dependencies {
//...
implementation project(':myAnotherModule')
//...
}
If you are trying to import a whole project to your workspace by creating a new application from existing code then that is very easy as long as project you are importing is on already on the folder of your workspace or there is no conflicting project on your workspace with the same name.
On the other hand if you have a project on your workspace that you are working on and you want to import other projects to it then it becomes challenging especially if you dont have a well define working sets. I suggest that you:
Open particular folders of the project you want to import for instance the "src" folder and copy the java files in it directly to your project on your eclipse (If you are using it)
Right click on the src file on your eclipse and paste the java files. It will save you the time of changing the package name on the java files.
Do the same for the resources files by copy pasting them from the respective files to the corresponding files in your project.
Then when you do this dont forget to edit the manifest file with the new changes of the activities you imported. To do this you need to look into the manifest of the project you were importing so that you do not miss a point.
It may appear tidious and cumbersome but it will help you know what exactly you imported. But you will need to change package names in the java files to the current package name.

Can't import projects into Eclipse workspace

So, I have been using eclipse in Windows for years. I have a few android projects that I have been working on lately. But I'm getting stuck on something so weird.
The problem is I'm using eclipse on both windows and Linux now. (Yeah i feel linux is better and much faster). I want to get all my projects that I was using on Windows into Linux Eclipse workspace (Yes I created another workspace because I didnt know if I could work on same workspace in both versions viz linux and windows eclipse). Now, the weird part is I CANNOT IMPORT THOSE PROJECTS INTO MY OTHER WORKSPACE! This is driving me crazy.
I go to my Linux Eclipse workspace -> Import -> Add existing android proj -> browse -> Root dir of my android project -> (Ecipse does show the projects on the frame below -> I click finish -> NOTHING. I just sit there, waiting, and nothing happens. I have searched around here in stackoverflow, but none of the problems resembles this.
Yes I have access to the workspace folder, yes I can create folders, etc etc.
Please can someone tell me how I can import projects that are being detected but NOT imported?
thanks.
I solved this by importing the project in the following manner:
File > Import > Android > Existing Android Code Into Workspace
Click Next, then Browse...
Select your project root directory, and check the box for Copy projects into workspace. Click Finish.
Hope it will help you.
I also faced the same problem for long, today only I found out the solution!
It's all lies in .project and .classpath files inside project's root directory. While trying to import any project into workspace, if your project does not gets listed, that means .project and/or .classpath files are either missing or corrupt. Usually these files are hidden, so you never know what is the issue.
For Ubuntu, follow steps below:
step 1. go to any project root directory in your workspace and press Ctrl+H to see hidden files.
step 2. copy .project and .classpath files from there and paste to the other project directory that you wanted to import.
step 3. Open the .project file and update name tag to project name.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Name of the project</name>
<comment></comment>
....
step 4. close the folder and import the project, it will be definitely listed in the import wizard now!!
I also encountered the same problem.
you need to update ADT (Eclipse Plugin) to work with new Android SDK.
click Help > Check for Updates
after ADT updated, you can import your project from File > Import
Make sure to check to see if the AndroidManifest.xml file is present in either the folder or a sub folder. You must have that file in order to import.
This is the issue I had. Luckily I have the unlimited history feature in DropBox so I was able to use that to get the last existing version of the file. Once I added it, importing worked just fine.
I'm facing the same issue, here what i have done.
- In Eclipse, Go to windows -> Preferences
- choose Android, set your Android SDK Location
make sure you have at least one of the Android platform in the table.
- Apply and Ok.
done, I try import, and it's fine.
Hope it help.
It could be that the project already exists in the workspace. The solution is to either change your workspace location or just rename the project you're importing.
After importing the file, you can deselect the in library from properties section. It worked for me
if all the sulotions above didnt help you, open a new project with the same name as the imported project,after you do that, go to the Original project,open it and selcet all files with ctrl+A,and than copy paste it inside the new project,then click yes to all inside the alaert and it should work.
If none of the above answers help, check the permissions of the folder which contains the projects. In Ubuntu from command line try this:
sudo chmod 777 Folder_Containing_Projects -R
The above command will give permissions recursively.

difficulty in importing the facebook-android-sdk into eclipse

I try to follow the facebook-android tutorial from here: https://developers.facebook.com/docs/mobile/android/build/#sample
I am working in windows 7.
I have installed the Git and cloned the GitHub repository running this command in the git Bash -> git clone git://github.com/facebook/facebook-android-sdk.git
Everything seemed fine and I got the folder “facebook-android-sdk” in my “Users” folder.
But when I try to import the project in eclipse workspace so to use it as a library I cannot make it work. I’ve tried 3 things:
Create the project from existing source (as the tutorial says), when I browse to the “facebook-android-sdk” folder and create the project, I get this message in my cosole: [2011-12-04 14:01:49 - com_facebook_android] AndroidManifest.xml file missing!
Also in the package explorer, the src folder seems to be empty.
If I try to import the project when I browse the folder I get a message “No projects are found to import”
I also tried to make a test project where I copied all the classes of the android facebook sdk so that I can use them. It worked up to a degree, but it does not seem a proper thing to do.
So what do I do wrong? Is there something else I should do using the git repository (I am completely new to git)? Or is there something wrong that I do when I try to import the project? I’ve searched the problem here and in other forums but didn’t find a satisfying answer (or maybe I did not understand it). Please help!
EDIT: I've tried one 4th thing
4: I extracted the jar out of the project I created in 1 (even if it had an error). It is working in terms that I can compile the code of the facebook-android tutorial step 6.2 - https://developers.facebook.com/docs/mobile/android/build/#sample. So far it seems that everything goes ok. But I do not know if this is right or I should have problems in the future..
I had the same problem. But now I think I solved it, even if the solution is not satisfying.
Create the project from existing source as the facebook tutorial says. Then make a right click on the project and choose "Import", choose "General" -> "File System" and go to "Next". Now click on "Browse..." and choose the folder .../facebook-android-sdk/facebook. Repeat these steps with the src and the res folder (right click on these folders for "Import", choosing the src and res folder in .../facebook-android-sdk/facebook).
Now it works. I don't know why Eclipse doesn't import all these things automatically, in the past it worked fine...
Make sure when you select the “facebook-android-sdk” folder you add /facebook at the end. So type into existing source C:/Users/facebook-android-sdk/facebook and it should work.
Make sure that your code's directory is dropped directly in Eclipse's root Workspace directory. There seems to be a bug in the latest version that only allows this kind of import/load when all code is directly in a directory in your Workspace. Otherwise it copies just a couple folders/files from where you put it, and not the rest, and gets quite confused.
I downloaded the file in zip format from the git directory. I created a android project, then i imported the zip archive (import ->archive file). It worked for me.
If you want to import projects into Eclipse, you do not have to go down to the src folder, just do
File > Import > Existing projects into Workspace
then go to the directory where the folder is, say your Documents folder C:\users\Documents
then just click 'ok'
The window then displays all the folders in the Documents folder.
you can then select the project you want to import and click finish.

In eclipse, unable to reference an android library project in another android project

As I was writing up this question I managed to solve it so repeat it here for the benefit of others. Here is the initial problem:
I have created a very simple library project which I want to reference in another project. I have done this previously with no problems so not really sure why it is not working this time. I have:
Flagged the library project via project properties. The default.properties file has this set : android.library=true
In my other project added reference to my library project via project properties. The default.properties file has the reference added as expected ie android.library.reference.1=K:/android_test_ws/applicationRegistrar
The green tick against the referenced library project starts off green and then changes to a red cross.
This implies that there must be something wrong / missing from the library project but I don't know what. My library project on this occasion is MUCH simpler than the previous one I created.
OK Here is the solution which I found when I was looking for the default.properies file of the referencing project (not the library) in my file system. Although the referencing project was in the same eclipse workspace as the library project, the actual files were somewhere else in the file system ie they were'nt in the same parent folder of the library project. As soon as I placed the referencing project in the same physical folder as the library project it all went fine.
I guess that this must be something to do with android using ant underneath the covers.
Edit: The project name needs match the folder name on the file system. What you are seeing in the Project Properties->Android->Library Reference is a relative file system path.
Make Sure both the projects are present in same work space.
To Do it, while importing the projects make sure "copy project into work space" check box is checked.
the same problem will occur if your library project is in different partition from your current workspace. I have the same problem just now. My git source is in C: and I just move my workspace to D: and everything start to collapse.
Simplest way to get the library paths paths correct is to use the GUI from Eclipse to add the library as shown in the following screenshot and let Eclipse take care of putting the correct relative paths in project.properties. Its a common setup to have your library projects hosted at directories vastly different than your main projects that uses the library. This method will work if the "libary project" and the project using it are in the same eclipse "workspace" (they "need not" be in same parent folder):
Please ensure that the library project is marked as "Is Library" - right click on the library project - properties - Android - mark the "Is Library" checkbox - in project.properties of the library project you should have a new entry:"android.library=true. Now add it into the project you want as described in the post below.(the post with image integrated - from Nilesh Pawar).
This bug is referenced several times here 27199, 35786, 36460 & 38052
Maybe by voting for them, it will be fixed one day...
Yet another observation on the same issue.
For me the two projects where on the same parent folder, and were both local inside the workspace. Even then the issue was still happening.
The I edited the "project.properties" file and put the absolute path(with forward slashes '/' for seperator) of the library project. Saved and closed it. Then went to the project properties dialog, removed the library(which was still showing the cross icon but with abs path) and added it back as usual.
Surprisingly the issue is resolved, and the project compiles and runs.
This is really strange and must be a bug with the ADT.
I am using ADT version 20.0.2
when developer referencing the facebook or any other library project then first of all clean the project from eclipse->project->clean project.
that want allow the error of red cross in referencing screen.
For me, I just restart the eclipse and the added library works fine.
I mean first time it showing red marks after adding the library project.
Though eclipse main project and library project are in same workspace folder and no resources files are in outside of the project folder.
So, you can try with to restart your eclipse. Happy coding....
Workaround for me was to
Create a new workspace
Import Library Project in that workspace
Import The desired project in that workspace
Having both project and library project the same target Android OS version
Reference library project in my project
solved my problem
i had the same problem there when i try to change my workspace so this my solution:
import and copy all project data including library project into workspace
delete the old project reference by Right-click on the project-->Properties-->Android-->Library, and select corrupted library(so that waht i call it) and choose Remove
clean project first (to refresh ur project properties)
go to library project Properties-->Android-->Library and check the is library if it does'nt click Apply then OK
if the library project is library is already checked, first Unchecked it then Clean the library project after that do the Step 4 again
go to project that u want the library are in then Right-click on the project-->Properties-->Android-->Library, Add then choose the library project (it should be there) and click Apply then OK
if still doesn't appear clean the project once more time and that should do
Just restart your eclipse. It's solve my problem
When you have a look at the reference-path before and after, it comes from i.e. "C:/workspace/mylib" and goes to "../../mylib" when copied to the correct location, quite interesting.
FYI,
What worked for me was to delete the 'library' projects (the actual projects) from my workspace (without deleting the files), and then re-importing them using the wizard (import existing android project from source code).
Thanks for posting the question.
I had exactly the same problem while integrating Facebook with my Android application. I fixed the issue by moving my development project to the same Windows drive in which library project was located. Somehow Eclipse is unable to read the library project's location properly from default.properties file if it is in a different drive.
Similar to Sufi Khan's post I also solved this issue with a reboot. My case differed in that when I first accessed Properties->Android and added the library I got a lovely green checkmark. When I closed the dialog Eclipse was still showing class-not-found type errors. When I checked the properties again I saw the red X. But Mr. Kahn's solution (delete the bad lib, restart Eclipse, add the lib again) worked fine.
I'm using the 0702 version of the ADT bundle (starts with "cluster", rhymes with "duck").
I followed the accepted answer but also had to make sure my "project.properties" file was readable.
If the file is readonly (checked into source control) eclipse will not edit it. Adding the library reference will succeed, but the change won't be persisted after hitting OK.
If closing the preferences window and reopening in again removes the library you just added, this may be your solution.
In case your library project still doesn't show up try adding library flag in your library project properties
Add android.library=true
project.properties
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
android.library=true

Missing AndroidManifest.xml when importing an old Android project into Eclipse

I have an Android project developed on Eclipse (GNU/Linux) that I last touched half a year ago. I am trying to import the project into Eclipse 3.6 on Windows (with ADT installed) installed using File -> Import Project in Eclipse. When the project is imported, I see the following error twice on the console:
[2010-12-10 02:17:12 -
com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper]
Unable to read C:\Program
Files\Android\android-sdk-windows\AndroidManifest.xml:
java.io.FileNotFoundException:
C:\Program
Files\Android\android-sdk-windows\AndroidManifest.xml
(The system cannot find the file
specified)
Why is Eclipse looking for AndroidManifest.xml on the Android SDK path? The file actually seems to be in the project's directory. How do I fix this problem and get the project to compile?
A simple solution is to either reimport the AndroidManifest.xml file or make a change to the file and save it. This worked for me.
If you see an error about AndroidManifest.xml, or some problems
related to an Android zip file, right click on the project and select
Android Tools > Fix Project Properties. (The project is looking in the
wrong location for the library file, this will fix it for you.)
from: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html
The way you are importing the Android project into Eclipse is wrong. The Correct way of doing is File -> New Android Project. In the Contents Tab in "New Android Project", select "Create project from existing source" and choose the Build Target. That should fix your problem.
It appears that this error is produced because Eclipse thinks the default location for new Android projects is the Android SDK path. Even if the project location is changed, the error fails to be resolved, so the trick is to change the project location before Eclipse is aware of the condition generating the error.
To circumvent this quirk I imported the old project with the following steps:
File -> New -> Android Project
Un-check 'Use default location' and browse to project root directory.
Click 'Create project from existing source'
It's important to do step (2) before (3) otherwise the error persists and prevents running the project.
I had the same problem, all of the above did not work. I cleaned the project and it worked.
Instead of using File ---> New Android Project --> "Create project from existing sources", which will result in the error your are seeing, choose "Create project from existing sample" and choose it from the drop down. This will work.
Experienced JAVA developers tend to go with the first option which is normally there and works for classic Eclipse projects. But this is not your typical project and I bet the Google developers put this special case in the wizard to accommodate the differences.
I had the same problem. I was trying to compile the JakeWharton view page sample, so I checked out the GIT in a directory in a different folder then the workspace which caused the problem.
Eclipse was maintaining 2 folders:
1. A new workspace folder was made under the workspace directory, which eclipse checks for libraries and others source code including the AndroidManifest.xml file
2. The existing folder which was not under the Root workspace
To fix the problem after importing I had to manually move the files in the new workspace folder created by eclipse.
I met this problem when using Facebook SDK, now I solve it by doing this:
Close the project;
Copy "AndroidManifest.xml" file to the project's root path;
Open the project and refresh it, it's Done!
this worked for me by the way:
I changed the project name to the exact name of the project that I am importing.
Eclipse seems somewhat fragile in its naming conventions. One of the causes for this error is a difference between the project name and the folder name in the workspace. I imported a zip file for a project named "HelloDialogs" into a workspace folder named "HelloDialog". This caused the "AndroidManifest.xml file missing" error. Once I renamed the folder correctly, everything worked fine.
Because of the multiple different answers here, I thouhgt I'd add yet another one that worked for me, as I had exactly the same issue when first working with Phonegap android dev tools.
So I found (as mentioned by Gintautas in comments to the accepted answer), that I had to create a new project using the phonegap 'create' script, then when importing the project into eclipse. the only way to get this to work successfully was if the project was originally created in some temp folder somewhere other than the place I actually want to work with it.
So I created a project in windows like this in a cmd window...
c:\phonegap\phonegap-2.6.0\lib\android\bin>create.bat c:\temp\android_boilerplates\test app.test test
Then I imported the project in eclipse like this...
File > New > Project
Within the new project wizard select: "Android Project from Existing Code"
Click "Next"
Now navigate to the temp location of your project and set that to the root directory, check the project you want and check "Copy projects into workspace" as the example below...
Click "Finish"
And that's it, Eclipse should copy all your project files into your workspace and there shouldn't be any errors in your project (fingers crossed).
Your project should look something like this...
Hope that helps, it took me an age to work out why Eclipse didn't like creating a new project from existing code when the new project was being setup in the same place as the existing code. This isn't a problem for other languages I've used, so it was a little weird, but understandable as Eclipse (I'm guessing) seems to want to overwrite certain files.
Eclipse randomly decided to make another folder instead of the one that i had specified, but doesnt have any resources or data or layout etc in it..
it has some conflicts i guess..
anyway, a noob approach to this was, copying the original file to some other location(i put it to desktop)..
now create new project-create existing project, select this one from desktop, n VOILA.. its all fine.. :D
I am a little late to this game but I caused this same problem by generating the initial application into the exact location I was going to work on it. That is to say I put it directly into my current workspace. I then did File, Import, Existing Android Code Into Workspace. The import process blanked out my android.xml file.
I tried above solutions and had no joy. I then generated the initial application into a temp directory and imported from there. This worked for me.
The only way to import a project into eclipse workspace is to create an empty project and then drag and drop all the folders and files into this project. Why is this so is beyond me.
The answer from Raunak is wrong.
I found a .classpath file in the root directory of my Android project. I opened it and updated the file paths in it, and it seemed to fix the problem for me.
I had the problem when I tried to update an old project with recent code from the SVN. I had the Manifest.xml exported to my local file system as backup and deleted it. I've then reverted my complete project to the most recent version from the SVN and then it worked :)
This is what I had to do to get this to work. Fortunately I had backups of earlier "project".
1) Import the project as usual.
2) If the errors with empty xml etc. comes up, close the project.
3) Go to the original project if you have backup.
4) Copy all of the projects root files and directories and paste it over where Eclipse expects the projects root directories and files to be.
5) Open the project and refresh. Make "Clean" if necessary and you're done!
Always make backups because Eclipse f--kups! I learned this the hard way when suddenly my Android project refused to work because of empty manifest-file.
Sometimes if you automatically fix imports in MainActivity IDE imports android.R class instead of one that will be generated for the project. Remove the import and recompile.
when importing project from another workspace add existing project in workspace. and tick to the copy projects in workspace.then check the api level and supporting library from project.properties files.then rebuilt project and clean it.. it is works for me.
2017 Solution: Much Easier and tested solution is to remove your application folder from elipse project only then Import it again and the problem will be fixed immediately!

Categories

Resources