2013-07-31 125 views

回答

2

Thanks to yorkw,我找到了解決辦法。

注:

  • Ant任務僅適用於Windows,但很容易被調整爲其他操作系統。
  • 所選擇Android的目標是非常重要的,因爲一些目標需要用戶交互來創建一個AVD:

Managing AVDs from the Command Line:「如果你選擇 目標是一個標準的Android系統映像(」類型:平臺」 ),android 工具接下來會詢問您是否要創建自定義硬件 配置文件。「


的pom.xml

 <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <configuration> 
       <tasks> 
        <exec executable="cmd.exe"> 
         <arg value='/c ${env.ANDROID_HOME}\tools\android create avd --name myDefaultAVD --target "Google Inc.:Google APIs:10" --force'/> 
        </exec> 
       </tasks> 
      </configuration> 
      <executions> 
       <execution> 
        <id>createDefaultAVD</id> 
        <phase>generate-test-resources</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin>