开发者

Import Android Test Project into Eclipse from Version Control

I have an Android Eclipse project and an associated Android Test Eclipse project checked into a subversion repository. Given a checked out working co开发者_如何学Cpy, how do I bring the Android Test project into an Eclipse workspace?

It's easy to add the Android project to the workspace (just File->New Project->Android Project->From Existing Source and point it at the directory in the svn working copy). But, the 'New Android Test Project' does not have an option to create from existing source.


  1. File -> Import...
  2. Existing Android Code into Workspace
  3. Import the project as you would with a regular Android project
  4. You'll have errors becase the imported test project does not have references to the parent project
  5. Right Click test project -> Properties
  6. Java Build Path -> Projects tab
  7. Add -> Choose the project that you're testing
  8. Ok
  9. Refresh / Clean (optional)
  10. Right Click test project -> Run As -> Android JUnit Test


Was searching for this functionality and didn't find it either :)

What I did in the end is this:

  1. Moved my existing test project directory (checked out from version control) to a temp dir
  2. In Eclipse I created a new empty Android Unit Test project, located it in the directory with the name of the original test project directory
  3. Closed Eclipse and copied a .classpath and .project files from newly created test project to a current root directory of old test project (in a temp dir)
  4. Removed a new empty test project directory, moved old one from temp location back to original location

Simply put, I just generated new .classpath and .project files and copied them to checked out project dir.

After cleaning and refreshing in Eclipse this worked out :) Of course this is not a real solution, but an ugly workaround which I even don't expect to work in any situation, but who knows, might help you. Cheers.


I think you want Import > Existing project, especially if the .project and .classpath files are checked into version control.


I also had to R. click the test app (after importing as a normal Existing Android app) -> Properties -> Resource -> Android -> check the appropriate emulated Android box to get the Android JUnit Test option for running/debugging which was otherwise missing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜