install and run an app on multiple devices with a single click under eclipse

前端 未结 5 1403
无人及你
无人及你 2021-02-12 14:43

I am wondering if there is a way to install and run an android application on multiple devices/emulator with a single click under Eclipse.

When I am testing a layout on

5条回答
  •  眼角桃花
    2021-02-12 15:23

    You should be able to add an Ant XML file to your Eclipse project, and fill it with Ant tasks that can run an external program from command line. Probably you should have a separate task item for each device you want to run on, and then a parent task containing all of them.

    Then add a single custom builder step to Eclipse project, choosing Ant as builder and pointing to the XML file you added previously (see here)

    I'm not a big expert on Ant, but at some point I needed to add a custom task to build a Jar out of my project code from within Eclipse, so that I could run it everytime I needed it (like here). This procedure worked quite well.

    The Ant task that should do for you is Exec: http://ant.apache.org/manual/Tasks/exec.html. You might want to have a look at http://ant.apache.org/manual/using.html for a simple starter.

    Your XML could be something like the following (I haven't tried it though):

    
    
      
      
      
      
        
          
        
      
      
        
          
        
      
    
    

    In order to not manually write the package location for each project, there seems to be not such a great integration between Eclipse and Ant. You might try the following suggestions:

    • use the native Ant ${basedir} property as in here
    • pass an Eclipse variable as an additional parameter when invoking Ant as in here: -Dworkspace_loc=${workspace_loc}
    • access Eclipse .project file from within Ant, using a specific XML parsing facility as in here

提交回复
热议问题