Android/RoboGuice/Maven:Eclipse 中的 ClassNotFoundException,但不是来自 Maven 命令行

发布于 2024-12-03 07:59:41 字数 16756 浏览 0 评论 0原文

我有一个处理 Guice 绑定的类。这是需要运行的第一个东西,称为 ApplicationAutoworkout.java。

package com.redsoft.android.autoworkout;

import java.util.List;

import roboguice.application.RoboApplication;

import com.google.inject.Module;
import com.redsoft.android.autoworkout.service._ModuleQueryFor;
import com.redsoft.android.autoworkout.service._ModuleService;
import com.redsoft.android.autoworkout.ui._ModuleUi;

public class ApplicationAutoworkout extends RoboApplication {
     private Module testModule;

@Override
protected void addApplicationModules(List<Module> modules) {
    modules.add(new _ModuleUi(this.getApplicationContext()));
    modules.add(new _ModuleService(this.getApplicationContext()));
    modules.add(new _ModuleQueryFor());

    if (testModule!=null)modules.add(testModule);

    super.addApplicationModules(modules);
}
    //Allows the testModule to be added during tests
    public void setModule(Module module) {
        this.testModule = module;
    }

}

无论出于何种原因,当从 eclipse 构建/部署该类时,Android 模拟器都无法找到该类。

09-05 03:43:42.745: ERROR/AndroidRuntime(843): FATAL EXCEPTION: main
09-05 03:43:42.745: ERROR/AndroidRuntime(843): java.lang.RuntimeException: Unable to instantiate application com.redsoft.android.autoworkout.ApplicationAutoworkout: java.lang.ClassNotFoundException: com.redsoft.android.autoworkout.ApplicationAutoworkout in loader dalvik.system.PathClassLoader[/data/app/com.redsoft.android.autoworkout-2.apk]
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:649)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread.access$3000(ActivityThread.java:125)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.os.Looper.loop(Looper.java:123)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.reflect.Method.invokeNative(Native Method)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.reflect.Method.invoke(Method.java:521)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at dalvik.system.NativeStart.main(Native Method)
09-05 03:43:42.745: ERROR/AndroidRuntime(843): Caused by: java.lang.ClassNotFoundException: com.redsoft.android.autoworkout.ApplicationAutoworkout in loader dalvik.system.PathClassLoader[/data/app/com.redsoft.android.autoworkout-2.apk]
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.Instrumentation.newApplication(Instrumentation.java:942)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:644)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     ... 11 more

但是,如果我从命令行运行该类:

mvn clean process-classes android:dex android:apk android:deploy

一切正常。 Eclipse 中发生了什么导致 Android 无法找到该类?

编辑:这是 AndroidManifest.xml。

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.redsoft.android.autoworkout" android:versionCode="0" android:versionName="0.0.1-SNAPSHOT" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:targetSdkVersion="7" android:minSdkVersion="7"></uses-sdk>

  <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:name="ApplicationAutoworkout">
    <activity android:label="@string/app_name" android:name=".ui.ActivityMain">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name=".ui.profile.ActivityProfile"></activity>
    <activity android:name=".ui.routine.ActivityRoutine"></activity>

    <activity android:name=".ui.train.ActivityTrain"></activity><activity android:name=".ui.exercise.ActivityExercise"></activity>
    <activity android:name=".ui.exercise.ActivityViewExercise"></activity><activity android:name=".ui.exercise.ActivityAddEditExercise"></activity>
    <activity android:name=".ui.profile.ActivityAddProfile"></activity>
    <activity android:name=".ui.profile.ActivityEditProfile"></activity>
    <activity android:name=".ui.routine.ActivityRoutineView"></activity>
    <activity android:name=".ui.routine.ActivityRoutineEdit"></activity>
    <activity android:name=".ui.routine.ActivityRoutineAdd"></activity>
    <activity android:name=".ui.routine.ActivityRoutineAddExercise"></activity>

  </application>

</manifest>

另外,POM:

<?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>

  <parent>
    <groupId>com.seventheye.android</groupId>
    <artifactId>autoworkout-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>autoworkout-app</artifactId>
  <packaging>apk</packaging>
  <name>autoworkout - Application</name>
<dependencies>
 <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice-no_aop</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice-assisted-inject</artifactId>
    </dependency>
    <dependency>
      <groupId>org.roboguice</groupId>
      <artifactId>roboguice</artifactId>
  </dependency>
  <dependency>
    <groupId>com.j256.ormlite</groupId>
    <artifactId>ormlite-core</artifactId>
  </dependency>
  <dependency>
    <groupId>com.j256.ormlite</groupId>
    <artifactId>ormlite-android</artifactId>
  </dependency>
     <dependency>
        <groupId>com.pivotallabs</groupId>
        <artifactId>robolectric</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.seventheye.android</groupId>
      <artifactId>robolectric-sqlite</artifactId>
      <version>1.0-RC5-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
</dependencies>

  <profiles>
  <profile>
      <id>proguard</id>
      <build>
              <plugins>
              <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.4</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>4.6</proguardVersion>
                    <maxMemory>512m</maxMemory>
                    <injar>android-classes</injar>
                    <libs>
                      <lib>${rt.jar.path}</lib>
                      <lib>${jsse.jar.path}</lib>
                    </libs>
                    <obfuscate>false</obfuscate>
                     <addMavenDescriptor>false</addMavenDescriptor>
                     <proguardInclude>${project.basedir}/proguard.conf</proguardInclude>
                  </configuration>
                <dependencies>
              <dependency>
                <groupId>net.sf.proguard</groupId>
                <artifactId>proguard</artifactId>
                <version>4.6</version>
                <scope>runtime</scope>
              </dependency>
            </dependencies>
            </plugin>
            </plugins>
      </build>
      </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
              <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.4</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>4.6</proguardVersion>
                    <maxMemory>512m</maxMemory>
                    <injar>android-classes</injar>
                    <!-- <injar>scala-library</injar>-->
                    <libs>
                      <lib>${rt.jar.path}</lib>
                      <lib>${jsse.jar.path}</lib>
                    </libs>
                    <obfuscate>false</obfuscate>
                     <addMavenDescriptor>false</addMavenDescriptor>
                     <proguardInclude>${project.basedir}/proguard.conf</proguardInclude>
                  </configuration>
                <dependencies>
              <dependency>
                <groupId>net.sf.proguard</groupId>
                <artifactId>proguard</artifactId>
                <version>4.6</version>
                <scope>runtime</scope>
              </dependency>
            </dependencies>
            </plugin>
          <plugin>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-application-apk</id>
                <phase>package</phase>
                <goals>
                  <goal>sign</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>maven-android-plugin</artifactId>
             <executions>
        <execution>
            <id>startemulator</id>
            <phase>initialize</phase>
            <goals>
            <goal>emulator-start</goal>
            </goals>
        </execution>
              <execution>
                <id>zipalign-application-apk</id>
                <phase>package</phase>
                <goals>
                  <goal>zipalign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <zipalign>
                <verbose>true</verbose>
                <inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
                <outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
              </zipalign>
              <sign>
                <debug>false</debug>
              </sign>
              <emulator>
            <avd>Android2.2</avd>
            <wait>10000</wait>
            <options>-no-skin</options>
              </emulator>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/proguard_map.txt</file>
                  <type>map</type>
                  <classifier>release</classifier>
                </artifact>
              </artifacts>
            </configuration>
            <executions>
              <execution>
                <id>attach-signed-aligned</id>
                <phase>package</phase>
                <goals>
                  <goal>attach-artifact</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
         <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>tmp</directory>
                            <includes>
                                <include>*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.8</version>
    <!-- see http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html for more information -->
    <configuration>
      <downloadSources>true</downloadSources>
      <downloadJavadocs>true</downloadJavadocs>
      <projectnatures>
        <projectnature>org.scala-ide.sdt.core.scalanature</projectnature>
        <projectnature>org.eclipse.jdt.core.javanature</projectnature>
      </projectnatures>
      <buildcommands>
        <buildcommand>org.scala-ide.sdt.core.scalabuilder</buildcommand>
      </buildcommands>
      <classpathContainers>
        <classpathContainer>org.scala-ide.sdt.launching.SCALA_CONTAINER</classpathContainer>
        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
      </classpathContainers>
      <excludes>
        <exclude>org.scala-lang:scala-library</exclude>
        <exclude>org.scala-lang:scala-compiler</exclude>
      </excludes>
      <sourceIncludes>
        <sourceInclude>**/*.scala</sourceInclude>
        <sourceInclude>**/*.java</sourceInclude>
      </sourceIncludes>
    </configuration>
  </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>

I have a class that handles Guice bindings. It is the very first thing that needs to run, called ApplicationAutoworkout.java.

package com.redsoft.android.autoworkout;

import java.util.List;

import roboguice.application.RoboApplication;

import com.google.inject.Module;
import com.redsoft.android.autoworkout.service._ModuleQueryFor;
import com.redsoft.android.autoworkout.service._ModuleService;
import com.redsoft.android.autoworkout.ui._ModuleUi;

public class ApplicationAutoworkout extends RoboApplication {
     private Module testModule;

@Override
protected void addApplicationModules(List<Module> modules) {
    modules.add(new _ModuleUi(this.getApplicationContext()));
    modules.add(new _ModuleService(this.getApplicationContext()));
    modules.add(new _ModuleQueryFor());

    if (testModule!=null)modules.add(testModule);

    super.addApplicationModules(modules);
}
    //Allows the testModule to be added during tests
    public void setModule(Module module) {
        this.testModule = module;
    }

}

This class, for whatever reason, cannot be found by the Android emulator when it is built/deployed from eclipse

09-05 03:43:42.745: ERROR/AndroidRuntime(843): FATAL EXCEPTION: main
09-05 03:43:42.745: ERROR/AndroidRuntime(843): java.lang.RuntimeException: Unable to instantiate application com.redsoft.android.autoworkout.ApplicationAutoworkout: java.lang.ClassNotFoundException: com.redsoft.android.autoworkout.ApplicationAutoworkout in loader dalvik.system.PathClassLoader[/data/app/com.redsoft.android.autoworkout-2.apk]
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:649)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread.access$3000(ActivityThread.java:125)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.os.Looper.loop(Looper.java:123)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.reflect.Method.invokeNative(Native Method)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.reflect.Method.invoke(Method.java:521)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at dalvik.system.NativeStart.main(Native Method)
09-05 03:43:42.745: ERROR/AndroidRuntime(843): Caused by: java.lang.ClassNotFoundException: com.redsoft.android.autoworkout.ApplicationAutoworkout in loader dalvik.system.PathClassLoader[/data/app/com.redsoft.android.autoworkout-2.apk]
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.Instrumentation.newApplication(Instrumentation.java:942)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:644)
09-05 03:43:42.745: ERROR/AndroidRuntime(843):     ... 11 more

However, if I run this from the command line:

mvn clean process-classes android:dex android:apk android:deploy

everything works. What's going on in Eclipse that keeps Android from finding the class?

EDIT: Here's the AndroidManifest.xml.

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.redsoft.android.autoworkout" android:versionCode="0" android:versionName="0.0.1-SNAPSHOT" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:targetSdkVersion="7" android:minSdkVersion="7"></uses-sdk>

  <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:name="ApplicationAutoworkout">
    <activity android:label="@string/app_name" android:name=".ui.ActivityMain">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name=".ui.profile.ActivityProfile"></activity>
    <activity android:name=".ui.routine.ActivityRoutine"></activity>

    <activity android:name=".ui.train.ActivityTrain"></activity><activity android:name=".ui.exercise.ActivityExercise"></activity>
    <activity android:name=".ui.exercise.ActivityViewExercise"></activity><activity android:name=".ui.exercise.ActivityAddEditExercise"></activity>
    <activity android:name=".ui.profile.ActivityAddProfile"></activity>
    <activity android:name=".ui.profile.ActivityEditProfile"></activity>
    <activity android:name=".ui.routine.ActivityRoutineView"></activity>
    <activity android:name=".ui.routine.ActivityRoutineEdit"></activity>
    <activity android:name=".ui.routine.ActivityRoutineAdd"></activity>
    <activity android:name=".ui.routine.ActivityRoutineAddExercise"></activity>

  </application>

</manifest>

Also, the POM:

<?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>

  <parent>
    <groupId>com.seventheye.android</groupId>
    <artifactId>autoworkout-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>autoworkout-app</artifactId>
  <packaging>apk</packaging>
  <name>autoworkout - Application</name>
<dependencies>
 <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice-no_aop</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice-assisted-inject</artifactId>
    </dependency>
    <dependency>
      <groupId>org.roboguice</groupId>
      <artifactId>roboguice</artifactId>
  </dependency>
  <dependency>
    <groupId>com.j256.ormlite</groupId>
    <artifactId>ormlite-core</artifactId>
  </dependency>
  <dependency>
    <groupId>com.j256.ormlite</groupId>
    <artifactId>ormlite-android</artifactId>
  </dependency>
     <dependency>
        <groupId>com.pivotallabs</groupId>
        <artifactId>robolectric</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.seventheye.android</groupId>
      <artifactId>robolectric-sqlite</artifactId>
      <version>1.0-RC5-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
</dependencies>

  <profiles>
  <profile>
      <id>proguard</id>
      <build>
              <plugins>
              <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.4</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>4.6</proguardVersion>
                    <maxMemory>512m</maxMemory>
                    <injar>android-classes</injar>
                    <libs>
                      <lib>${rt.jar.path}</lib>
                      <lib>${jsse.jar.path}</lib>
                    </libs>
                    <obfuscate>false</obfuscate>
                     <addMavenDescriptor>false</addMavenDescriptor>
                     <proguardInclude>${project.basedir}/proguard.conf</proguardInclude>
                  </configuration>
                <dependencies>
              <dependency>
                <groupId>net.sf.proguard</groupId>
                <artifactId>proguard</artifactId>
                <version>4.6</version>
                <scope>runtime</scope>
              </dependency>
            </dependencies>
            </plugin>
            </plugins>
      </build>
      </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
              <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.4</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <proguardVersion>4.6</proguardVersion>
                    <maxMemory>512m</maxMemory>
                    <injar>android-classes</injar>
                    <!-- <injar>scala-library</injar>-->
                    <libs>
                      <lib>${rt.jar.path}</lib>
                      <lib>${jsse.jar.path}</lib>
                    </libs>
                    <obfuscate>false</obfuscate>
                     <addMavenDescriptor>false</addMavenDescriptor>
                     <proguardInclude>${project.basedir}/proguard.conf</proguardInclude>
                  </configuration>
                <dependencies>
              <dependency>
                <groupId>net.sf.proguard</groupId>
                <artifactId>proguard</artifactId>
                <version>4.6</version>
                <scope>runtime</scope>
              </dependency>
            </dependencies>
            </plugin>
          <plugin>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-application-apk</id>
                <phase>package</phase>
                <goals>
                  <goal>sign</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>maven-android-plugin</artifactId>
             <executions>
        <execution>
            <id>startemulator</id>
            <phase>initialize</phase>
            <goals>
            <goal>emulator-start</goal>
            </goals>
        </execution>
              <execution>
                <id>zipalign-application-apk</id>
                <phase>package</phase>
                <goals>
                  <goal>zipalign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <zipalign>
                <verbose>true</verbose>
                <inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
                <outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
              </zipalign>
              <sign>
                <debug>false</debug>
              </sign>
              <emulator>
            <avd>Android2.2</avd>
            <wait>10000</wait>
            <options>-no-skin</options>
              </emulator>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/proguard_map.txt</file>
                  <type>map</type>
                  <classifier>release</classifier>
                </artifact>
              </artifacts>
            </configuration>
            <executions>
              <execution>
                <id>attach-signed-aligned</id>
                <phase>package</phase>
                <goals>
                  <goal>attach-artifact</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
         <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>tmp</directory>
                            <includes>
                                <include>*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.8</version>
    <!-- see http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html for more information -->
    <configuration>
      <downloadSources>true</downloadSources>
      <downloadJavadocs>true</downloadJavadocs>
      <projectnatures>
        <projectnature>org.scala-ide.sdt.core.scalanature</projectnature>
        <projectnature>org.eclipse.jdt.core.javanature</projectnature>
      </projectnatures>
      <buildcommands>
        <buildcommand>org.scala-ide.sdt.core.scalabuilder</buildcommand>
      </buildcommands>
      <classpathContainers>
        <classpathContainer>org.scala-ide.sdt.launching.SCALA_CONTAINER</classpathContainer>
        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
      </classpathContainers>
      <excludes>
        <exclude>org.scala-lang:scala-library</exclude>
        <exclude>org.scala-lang:scala-compiler</exclude>
      </excludes>
      <sourceIncludes>
        <sourceInclude>**/*.scala</sourceInclude>
        <sourceInclude>**/*.java</sourceInclude>
      </sourceIncludes>
    </configuration>
  </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

满天都是小星星 2024-12-10 07:59:41

问题是Android Development Toolkit Eclipse插件不支持Maven依赖项。如果您想使用它,您需要使用 M2E 的 m2e-android Android 配置器扩展:

http://rgladwell .github.com/m2e-android

The problem is that the Android Development Toolkit Eclipse plugin does not support Maven dependencies. If you want to use it you need to use the m2e-android Android Configurator extension for M2E:

http://rgladwell.github.com/m2e-android

少年亿悲伤 2024-12-10 07:59:41

只是猜测,但当类已重命名/移动时,您的 AndroidManifest 是否可能正在寻找应用程序类 com.redsoft.android.autoworkout.ApplicationAutoworkout ?

我发现即使我不进行移动/重命名,清单也会时不时地得到错误的值。

Just a guess, but is it possible your AndroidManifest is looking for the application class com.redsoft.android.autoworkout.ApplicationAutoworkout when the class has been renamed/moved?

I find that the manifest gets a wrong value in it now and then even if I don't do a move/rename.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文