2012-06-29 9 views
6

Ich benutze das android-maven-plugin 3.2.0 und führe folgendes aus, um die apk auf meinem Gerät zu installieren und zu starten (Nexus One, Android 2.3.6), die einzige, die über USB verbunden ist und adb sichtbar ist; kein Emulator läuft parallel.mvn android: deploy funktioniert nicht (trotz Erfolgsbestätigung)

mvn install android:deploy android:run 

Unterhalb der Ausgang in meiner Schale ist, die alle gut aussieht, und ich bekomme auch eine SMS-Nachricht:

erfolgreich installiert /Users/myuser/Projects/MyCompany/com.mycompany.abc /target/com.mycompany.abc-1.0-SNAPSHOT.apk HT9CPP805008_HTC_NexusOne

aber es ist nicht wahr, die apk nicht auf meinem Gerät installiert ist, kann nicht unter Anwendungen gefunden werden. Der einzige Weg, wie ich derzeit die apk wirklich installiert bekommen kann, ist über eine workaround, weil android:deploy scheint nicht richtig zu funktionieren. (adb selbst funktioniert gut, ich kann einen beliebigen Befehl (Push, installieren, etc.) manuell über adb und es findet auch meine Geräte ohne ein Problem. Ich bin auf Mac OS X Lion mit adb v1.0.29)

Update:

Hier ist ein interessanter Befund ich gerade gemacht: android:deploy/run feine funktioniert, wenn ich die App bereits installiert auf meinem Gerät vor habe und dann maven laufen, die undeploy alte apk dann wird zuerst und dann erneut bereitstellen der Neue. Das funktioniert! Aber - wenn ich die App noch nicht auf meinem Gerät installiert habe oder die App manuell lösche, bevor Maven läuft, wird es nicht funktionieren. Das Ändern des Wertes von <undeployBeforeDeploy> von true zu false macht auch hier keinen Unterschied.

Hat jemand dieses Problem schon einmal erlebt?

[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] ------------------------------------------------------------------------ 

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> 

Antwort

11

ich mit Maven Plugin ohne Probleme gerade arbeite (Linux und Galaxy Nexus) und funktioniert gut.

Try this:

mvn clean install android:deploy android:run -Dandroid.device=usb 

Das ist mein pom:

http://pastebin.com/tzuFyjSx

Hope this helfen Ihnen

+1

Ich habe es versucht, aber keinen Unterschied. Beachten Sie jedoch, dass ich bereits usb in meiner pom.xml habe, sollte ich nicht den zusätzlichen Parameter benötigen; aber trotzdem, auch damit, kein Unterschied. Sehr komisch, da ich keinen Fehler bekomme. –

+0

Hier ist ein interessanter Befund, den ich gerade gemacht habe: Android: deploy/run funktioniert einwandfrei * wenn ich die App bereits auf meinem Gerät installiert habe * und dann maven ausführen, die dann zuerst die Anwendung deimplementieren und die neue erneut bereitstellen würde. Das funktioniert!Aber - wenn ich die App vorher noch nicht auf meinem Gerät installiert habe, oder sogar die App manuell lösche, bevor Maven läuft, wird es nicht funktionieren. Noch weiter testen ... Das Ändern von 'undeployBeforeDeploy' von true auf false macht auch hier keinen Unterschied. –

+0

Dies ist der Pom http://pastebin.com/RvBcVFKr – sourcerebels

0

Ich weiß, es altes Problem ist, aber ich habe das gleiche und Ich habe hier keine Lösung gefunden.

mvn clean android:emulator-start install android:deploy