2

基本的なAndroidプロジェクトを行いました。私はそれをAVDで日食で実行し、すべてうまくいきます。それが実行するアプリ。しかし、私が試してみるとmvn android:deploy、すべてがうまくいくように見えますが、AVDは次のように述べています。Unfortunately App has stopped

mvnクリーンインストール

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SakebuApp 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ SakebuApp ---
[INFO] Deleting C:\Workspace\SakebuApp\target
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:generate-sources (default-generate-sources) @ SakebuApp ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe [package, -m, -J, C:\Workspace\SakebuApp\target\generated-sources\r, -M, C:\Workspace\SakebuApp\AndroidManifest.xml, -S, C:\Workspace\SakebuApp\res, --auto-add-overlay, -A, C:\Workspace\SakebuApp\assets, -I, C:\Program Files (x86)\Android\android-sdk\platforms\android-15\android.jar]
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ SakebuApp ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Workspace\SakebuApp\src\main\resources
[INFO] skip non existing resourceDirectory C:\Workspace\SakebuApp\target\generated-sources\extracted-dependencies\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ SakebuApp ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Workspace\SakebuApp\target\classes
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:proguard (default-proguard) @ SakebuApp ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ SakebuApp ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Workspace\SakebuApp\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ SakebuApp ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ SakebuApp ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Workspace\SakebuApp\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- android-maven-plugin:3.2.0:emma (default-emma) @ SakebuApp ---
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:dex (default-dex) @ SakebuApp ---
[INFO] C:\Program Files\Java\jdk1.6.0_22\jre\bin\java [-Xmx1024M, -jar, C:\Program Files (x86)\Android\android-sdk\platform-tools\lib\dx.jar, --dex, --output=C:\Workspace\SakebuApp\target\classes.dex, C:\Workspace\SakebuApp\target\classes]
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ SakebuApp ---
[INFO] Building jar: C:\Workspace\SakebuApp\target\SakebuApp.jar
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:apk (default-apk) @ SakebuApp ---
[INFO] Copying local assets files to combined assets directory.
[INFO] C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe [package, -f, -M, C:\Workspace\SakebuApp\AndroidManifest.xml, -S, C:\Workspace\SakebuApp\res, --auto-add-overlay, -A, C:\Workspace\SakebuApp\target\generated-sources\combined-assets\assets, -I, C:\Program Files (x86)\Android\android-sdk\platforms\android-15\android.jar, -F, C:\Workspace\SakebuApp\target\SakebuApp.ap_]
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:internal-pre-integration-test (default-internal-pre-integration-test) @ SakebuApp ---
[INFO] No InstrumentationRunner found - skipping tests
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:internal-integration-test (default-internal-integration-test) @ SakebuApp ---
[INFO] No InstrumentationRunner found - skipping tests
[INFO] 
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) @ SakebuApp ---
[INFO] Building jar: C:\Workspace\SakebuApp\target\SakebuApp-sources.jar
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ SakebuApp ---
[INFO] Installing C:\Workspace\SakebuApp\target\SakebuApp.apk to C:\Users\HP\.m2\repository\com\sakebu\android\SakebuApp\1.0.0-SNAPSHOT\SakebuApp-1.0.0-SNAPSHOT.apk
[INFO] Installing C:\Workspace\SakebuApp\pom.xml to C:\Users\HP\.m2\repository\com\sakebu\android\SakebuApp\1.0.0-SNAPSHOT\SakebuApp-1.0.0-SNAPSHOT.pom
[INFO] Installing C:\Workspace\SakebuApp\target\SakebuApp.jar to C:\Users\HP\.m2\repository\com\sakebu\android\SakebuApp\1.0.0-SNAPSHOT\SakebuApp-1.0.0-SNAPSHOT.jar
[INFO] Installing C:\Workspace\SakebuApp\target\SakebuApp-sources.jar to C:\Users\HP\.m2\repository\com\sakebu\android\SakebuApp\1.0.0-SNAPSHOT\SakebuApp-1.0.0-SNAPSHOT-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.910s
[INFO] Finished at: Fri Jun 15 02:39:34 CEST 2012
[INFO] Final Memory: 20M/152M
[INFO] ------------------------------------------------------------------------

mvn android:deploy

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SakebuApp 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- android-maven-plugin:3.2.0:deploy (default-cli) @ SakebuApp ---
[INFO] C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe [dump, xmltree, C:\Workspace\SakebuApp\target\SakebuApp.apk, AndroidManifest.xml]
N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=2)
    A: android:versionCode(0x0101021b)=(type 0x10)0x1
    A: android:versionName(0x0101021c)="1.0" (Raw: "1.0")
    A: package="com.sakebu.android" (Raw: "com.sakebu.android")
    E: uses-sdk (line=7)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0xf
    E: application (line=9)
      A: android:label(0x01010001)=@0x7f040001
      A: android:icon(0x01010002)=@0x7f020000
      E: activity (line=12)
        A: android:label(0x01010001)=@0x7f040001
        A: android:name(0x01010003)=".SakebuAppActivity" (Raw: ".SakebuAppActivity")
        E: intent-filter (line=15)
          E: action (line=16)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=18)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
[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 not set, using all attached devices
[INFO] Successfully uninstalled com.sakebu.android from emulator-5554_sakebuEM_unknown_sdk
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Successfully installed C:\Workspace\SakebuApp\target\SakebuApp.apk to emulator-5554_sakebuEM_unknown_sdk
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.919s
[INFO] Finished at: Fri Jun 15 02:42:38 CEST 2012
[INFO] Final Memory: 11M/111M
[INFO] ------------------------------------------------------------------------

pom.xml

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sakebu.android</groupId>
    <artifactId>SakebuApp</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>SakebuApp</name>

    <dependencies>

        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.0.1.2</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <sdk>
                        <platform>15</platform>
                    </sdk>
                    <emulator>
                        <avd>sakebuEM</avd>
                    </emulator>
                    <deleteConflictingFiles>true</deleteConflictingFiles>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>

アイコンアプリをクリックすると出力されます。 Unfortunately App has stopped

mvn android:deployを実行するとDalvikが出力されます

06-15 08:53:39.025: D/AndroidRuntime(2173): Shutting down VM
06-15 08:53:39.025: W/dalvikvm(2173): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-15 08:53:39.055: E/AndroidRuntime(2173): FATAL EXCEPTION: main
06-15 08:53:39.055: E/AndroidRuntime(2173): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.sakebu.android/com.sakebu.android.SakebuAppActivity}: java.lang.ClassNotFoundException: com.sakebu.android.SakebuAppActivity
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.os.Looper.loop(Looper.java:137)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.ActivityThread.main(ActivityThread.java:4424)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at java.lang.reflect.Method.invokeNative(Native Method)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at java.lang.reflect.Method.invoke(Method.java:511)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at dalvik.system.NativeStart.main(Native Method)
06-15 08:53:39.055: E/AndroidRuntime(2173): Caused by: java.lang.ClassNotFoundException: com.sakebu.android.SakebuAppActivity
06-15 08:53:39.055: E/AndroidRuntime(2173):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-15 08:53:39.055: E/AndroidRuntime(2173):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
06-15 08:53:39.055: E/AndroidRuntime(2173):     ... 11 more
06-15 08:53:39.265: I/dalvikvm(2173): threadid=3: reacting to signal 3
06-15 08:53:39.285: I/dalvikvm(2173): Wrote stack traces to '/data/anr/traces.txt'
06-15 08:53:39.705: I/dalvikvm(2173): threadid=3: reacting to signal 3
06-15 08:53:39.775: I/dalvikvm(2173): Wrote stack traces to '/data/anr/traces.txt'
4

1 に答える 1

0

新しいMavenAndroidプロジェクトを作成しました。問題は間違った原型だったと思います。私は新しいプロジェクトで次の手順を実行しました:m2Eclipse Integrationですが、android-maven-pluginをバージョン3.2.0に更新する必要があります。そうしないと機能しません。

于 2012-06-16T10:51:12.610 に答える