我正在使用 IntelliJ 12.1,当我尝试构建和安装时,一切都运行良好。当我尝试通过 Maven 构建和安装应用程序时,出现以下错误:
04-10 21:28:03.044: WARN/dalvikvm(12727): Unable to resolve superclass of Lcom/moneydesktop/finance/shared/activity/BaseActivity; (105)
04-10 21:28:03.044: WARN/dalvikvm(12727): Link of class 'Lcom/moneydesktop/finance/shared/activity/BaseActivity;' failed
04-10 21:28:03.044: WARN/dalvikvm(12727): VFY: unable to resolve static field 5288 (sInForeground) in Lcom/moneydesktop/finance/shared/activity/BaseActivity;
04-10 21:28:03.044: INFO/dalvikvm(12727): Could not find method com.flurry.android.FlurryAgent.onError, referenced from method com.moneydesktop.finance.exception.CustomExceptionHandler.uncaughtException
04-10 21:28:03.044: WARN/dalvikvm(12727): VFY: unable to resolve static method 8300: Lcom/flurry/android/FlurryAgent;.onError (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
04-10 21:28:03.104: INFO/greenDAO(12727): Creating tables for schema version 1
04-10 21:28:03.285: WARN/dalvikvm(12727): Unable to resolve superclass of Lcom/moneydesktop/finance/shared/activity/BaseActivity; (105)
04-10 21:28:03.285: WARN/dalvikvm(12727): Link of class 'Lcom/moneydesktop/finance/shared/activity/BaseActivity;' failed
04-10 21:28:03.285: WARN/dalvikvm(12727): Unable to resolve superclass of Lcom/moneydesktop/finance/SplashActivity; (1158)
04-10 21:28:03.285: WARN/dalvikvm(12727): Link of class 'Lcom/moneydesktop/finance/SplashActivity;' failed
04-10 21:28:03.285: WARN/dalvikvm(12727): threadid=1: thread exiting with uncaught exception (group=0x40cf0930)
04-10 21:28:03.285: ERROR/CustomExceptionHandler(12727): Error
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.moneydesktop.finance/com.moneydesktop.finance.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.moneydesktop.finance.SplashActivity" on path: /data/app/com.moneydesktop.finance-1.apk
我的 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>1.0</version>
<groupId>com.moneydesktop.finance</groupId>
<artifactId>moneymobile</artifactId>
<name>MoneyMobile</name>
<packaging>apk</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
<android.version>4.1.1.4</android.version>
<android.platform>16</android.platform>
<android-maven.version>3.5.3</android-maven.version>
<maven-compiler.version>3.1</maven-compiler.version>
<nineoldandroids.version>2.4.0</nineoldandroids.version>
<viewpageindicator.version>2.4.1</viewpageindicator.version>
<timessquare.version>1.0.3</timessquare.version>
<menudrawer.version>2.0.2</menudrawer.version>
<greendao.version>1.3.1</greendao.version>
<eventbus.version>2.0.2</eventbus.version>
<jackson.version>2.1.4</jackson.version>
<lang.version>2.6</lang.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>${nineoldandroids.version}</version>
</dependency>
<dependency>
<groupId>com.viewpagerindicator</groupId>
<artifactId>library</artifactId>
<version>${viewpageindicator.version}</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.squareup</groupId>
<artifactId>android-times-square</artifactId>
<version>${timessquare.version}</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>net.simonvt</groupId>
<artifactId>android-menudrawer</artifactId>
<version>${menudrawer.version}</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>de.greenrobot</groupId>
<artifactId>greendao</artifactId>
<version>${greendao.version}</version>
</dependency>
<dependency>
<groupId>de.greenrobot</groupId>
<artifactId>eventbus</artifactId>
<version>${eventbus.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.lang</artifactId>
<version>${lang.version}</version>
</dependency>
<dependency>
<groupId>com.saulpower.communication</groupId>
<artifactId>library</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.saulpower.fayeclient</groupId>
<artifactId>library</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.flurry</groupId>
<artifactId>FlurryAgent</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}/libs/FlurryAgent.jar</systemPath>
</dependency>
<dependency>
<groupId>com.devsmart</groupId>
<artifactId>DevsMart</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}/libs/devsmartlib.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<scope>system</scope>
<version>r12</version>
<systemPath>${basedir}/libs/android-support-v4-r12.jar</systemPath>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven.version}</version>
<configuration>
<sdk>
<platform>${android.platform}</platform>
</sdk>
<sign>
<debug>auto</debug>
</sign>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.7</version>
<configuration>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifest>
<debuggable>true</debuggable>
</manifest>
</configuration>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>../checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
要运行 Maven 构建和安装,我使用以下命令:
mvn clean package install android:deploy android:run -Dandroid.device=usb