Import an existing Android project into Eclipse

project.properties does not update correctly when importing an existing Android project into Eclipse. This file exists in the source control:

# 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 use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=Google Inc.:Google APIs:14 

After importing the project (and doing nothing), the file looks like this:

 # 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 use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=android-8 

The manifest has the following elements:

 <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14"/> 

This means that every time someone imports a project, we must reset to create a target in the menu project-> properties-> android. I have the latest ADT tools installed and all SDKs are downloaded and available.

Things I tried:

  • Delete the entire project, including contents on disk, clone and delete the project.properties file before importing. The same result.
  • Delete the entire project, including the contents on the disk, clone and delete the .settings folder before importing. The same result.
  • Removing an entire project, including contents on disk, cloning and importing only for smiles. The same result.
  • It is drawn through the .project file. Nothing interesting.
  • Double-checked ant.properties, build.xml and every other plain-text file for hints. Nothing interesting.
  • The problem is with Google and double-checked the Eclipse and ADT error sites for known issues. Nada.
  • It was checked on the file system that the file really has the correct settings after cloning and that import is the culprit.
  • Removing the entire project, including contents on the disk, cloning, MANUALLY editing the project.properties file for android-14, import. This led to an immutable project.properties file, but since I use the Google APIs for mapping, this is not acceptable.

I just confirmed that I can “fix” the project after importing it. Delete the project from Eclipse, but leaving the contents on disk. When importing a project, project.properties is not edited correctly. The import process does not recognize Google API entries in project.properties.

This is how I get the project from the file system in Eclipse:

enter image description here

Thoughts?

+8
android eclipse
source share
2 answers

Now use General -> Existing projects in Workspace instead of Android -> Existing Android code in Workspace to avoid unpredictable automatic creation of the project.properties file.

You are right, if your android project does not have .classpath, the structure of the android package is lost. But if your Android project is already an Eclipse project, it should import only a fine.

This is a bug in eclipse. http://code.google.com/p/android/issues/detail?id=40161

This passage explains the problem.

“If you import an Eclipse project (which has a .classpath), just use the general mechanism for importing an Eclipse project that still exists (Import> General> Existing Projects Into Workspace). We added Import> Android> Existing Android Code Into Workspace because many people imported projects other than Eclipse that weren’t well supported, you had to create “Create” and then use the checkbox to select “existing code”, etc. Also the project location and the location of existing sources were ambiguous We made an import option for creatures. Android code is also for Eclipse projects, so that would be one obvious way to get the source code, but this is new code, not the general import code of the embedded Eclipse, so it doesn't pick up the project name like it's used to. (Related code, which handled the addition of a new project from the source code, acted in the same bizarre way that the code does now by selecting the project name from the manifest). However, forcing him to look for the project name from the .project file as the best default, if present, should be doable, so I will also try to add this. "

+2
source share

import your project the way you do, i.e.

Existing Android code in the workspace.

now remove project.properties. clean and build the project.

Approach 2:

if the existing project has a project to import the build.xml file using this option to import the ant build file

New → other → Java project from existing ant file →

follow the further parameters and you are done

Approach 3

right click your project ---> project properties go to Android Select the appropriate API level. Clean and create your project ... Done now

-one
source share

All Articles