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.
- File -> Import...
- Existing Android Code into Workspace
- Import the project as you would with a regular Android project
- You'll have errors becase the imported test project does not have references to the parent project
- Right Click test project -> Properties
- Java Build Path -> Projects tab
- Add -> Choose the project that you're testing
- Ok
- Refresh / Clean (optional)
- 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:
- Moved my existing test project directory (checked out from version control) to a temp dir
- 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
- 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)
- 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.
精彩评论