Mat*_*adt 6 android maven-3 maven android-maven-plugin
我使用的是Android的Maven的插件3.2.0并运行,以安装并启动设备上的APK(歌Nexus One的Android 2.3.6),它是通过USB和可见的亚洲开发银行连接的唯一一个以下; 也没有并行运行的模拟器.
mvn install android:deploy android:run
Run Code Online (Sandbox Code Playgroud)
下面是我的shell中的输出,看起来很好,我甚至收到一条消息说
已成功安装/Users/myuser/Projects/MyCompany/com.mycompany.abc/target/com.mycompany.abc-1.0-SNAPSHOT.apk至HT9CPP805008_HTC_NexusOne
但事实并非如此,我的设备上没有安装apk,在应用程序下无法找到.我目前能够真正安装apk的唯一方法是通过解决方法,因为android:deploy似乎无法正常工作.(亚行本身工作正常不过,我可以运行任何命令(推,安装等),通过ADB手动和它也发现我的设备没有问题.我在Mac OS X狮子与亚行v1.0.29)
更新:
这里有一个有趣的发现,我只是做了:android:deploy/run工作正常,如果我有应用程序之前就已经安装在我的设备上,然后运行Maven,这则取消部署旧APK先,然后重新部署新的.这有效!但是 - 如果我之前没有在我的设备上安装该应用程序,或者在运行maven之前手动删除该应用程序,它将无法正常工作.更改的值<undeployBeforeDeploy>从true以false不作任何这里既区别.
以前有人遇到过这个问题吗?
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.mycompany:com.mycompany.abc:apk:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:exec-maven-plugin is missing. @ line 85, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building com.mycompany.abc 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- android-maven-plugin:3.2.0:deploy (default-cli) @ com.mycompany.abc ---
[INFO] Waiting for initial device list from the Android Debug Bridge
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter set to usb
[INFO] Device HT9CPP805008_HTC_NexusOne found.
[INFO] Successfully installed /Users/myuser/Projects/MyCompany/com.mycompany.abc/target/com.mycompany.abc-1.0-SNAPSHOT.apk to HT9CPP805008_HTC_NexusOne
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.334s
[INFO] Finished at: Sat Jun 30 01:23:01 CST 2012
[INFO] Final Memory: 12M/126M
[INFO] ------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
pom.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompanyany</groupId>
<artifactId>com.mycompany.abc</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>com.mycompany.abc</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Simply read properties from file -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>android.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>11</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>false</undeployBeforeDeploy>
<!--<sign><debug>false</debug></sign>-->
<device>usb</device>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<configuration>
<executable>${basedir}/scripts/run_app.sh</executable>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
sou*_*els 11
我正在使用maven插件没有问题(Linux和Galaxy Nexus)并且工作正常.
试试这个:
mvn clean install android:deploy android:run -Dandroid.device=usb
Run Code Online (Sandbox Code Playgroud)
这是我的pom:
希望对你有帮助
| 归档时间: |
|
| 查看次数: |
6046 次 |
| 最近记录: |