元々はEmacs(android-mode)+Antで開発していたのだが
新規にEclipseの環境にそれらのファイル群を移行しようとするとそれができない。
以前からなんとなくやっていたのだが、きちんと整理しておこうと。
サンプルソースなどネットから落としてプロジェクト化とか。
入り口としては、[File]-[New]-[AndroidProject]からか、[File]-[Import]から。
Eclipseのworkspaceというのはどういう意味かはわからないが。
[File]-[New]-[AndroidProject]-[Create new project in workspace]
新規に空プロジェクトをつくる。
[File]-[New]-[AndroidProject]-[Create project from existing source]
プロジェクトでないファイル群からプロジェクトをつくる。
ワークスペースに表示されるが実際はワークスペースディレクトリにはファイルはコピーされない。
プロジェクト名がメインアクティビティ名になる。
[File]-[Import]-[Exciting Project into Workspace]
Eclipseで作成されたプロジェクトをワークスペース内に取り込む。
ワークスペース内にコピーを保存するかどうかを選択できる。
まとめ
Emacs環境から移行するには、同名の空プロジェクトを作ってImportすると新規にプロジェクト名とかターゲット指定とか面倒くさい。
結局、
[File]-[New]-[AndroidProject]-[Create project from existing source]でプロジェクト登録して、
[Refactor]-[Move]-[Use default location]でワークスペースに実体リソースを移動で。
メモ
そのディレクトリがプロジェクトであるかどうかは、.classpathと.projectファイルがあるかどうかで判別できる。
Eclipse is looking for eclipse projects, meaning its is searching for eclipse-specific files in the root directory, namely .project and .classpath. You either gave Eclipse the wrong directory (if you are importing a eclipse project) or you actually want to create a new project from existing source(new->java project->create project from existing source).
$ cat .classpath <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="output" path="bin"/> </classpath> $ cat .project <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>C2dm</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>com.android.ide.eclipse.adt.ApkBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>com.android.ide.eclipse.adt.AndroidNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>