Skip to content

Commit

Permalink
Fix maven build issues
Browse files Browse the repository at this point in the history
Always ensure that both the 'apk' and'jar' dependency of the 'impl' project
have scope 'provided'.

The 'commons-io' exclusion in agit-integration-tests is necesssary to avoid
this error:

W/dalvikvm( 2242): Class resolved by unexpected DEX: Lcom/madgag/agit/MarkdownActivityBase;(0x40514e90):0x2aecb8 ref [Lorg/apache/commons/io/IOUtils;] Lorg/apache/commons/io/IOUtils;(0x40514e90):0x2a34e8
W/dalvikvm( 2242): (Lcom/madgag/agit/MarkdownActivityBase; had used a different Lorg/apache/commons/io/IOUtils; during pre-verification)
D/AndroidRuntime( 2242): Shutting down VM
W/dalvikvm( 2242): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 2242): FATAL EXCEPTION: main
E/AndroidRuntime( 2242): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
E/AndroidRuntime( 2242): 	at com.madgag.agit.MarkdownActivityBase.loadMarkdown(MarkdownActivityBase.java:39)
E/AndroidRuntime( 2242): 	at com.madgag.agit.MarkdownActivityBase.onCreate(MarkdownActivityBase.java:30)
E/AndroidRuntime( 2242): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 2242): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime( 2242): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 2242): 	at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 2242): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 2242): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2242): 	at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 2242): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 2242): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2242): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 2242): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 2242): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 2242): 	at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(   70): Error in app com.madgag.agit running instrumentation ComponentInfo{com.madgag.agit.tests/android.test.InstrumentationTestRunner}:
W/ActivityManager(   70):   java.lang.IllegalAccessError
W/ActivityManager(   70):   java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
I/ActivityManager(   70): Force stopping package com.madgag.agit uid=10041

This might actually work

seriously this might work
  • Loading branch information
rtyley committed Jan 5, 2012
1 parent a014c97 commit e2b1fac
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 150 deletions.
91 changes: 48 additions & 43 deletions agit-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,61 @@

<packaging>apk</packaging>
<name>Agit integration tests</name>
<dependencies>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>toy-ssh-agent</artifactId> <!-- Needs to come before Agit -->
<version>1.4</version>
<type>apk</type>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>agit</artifactId>
<dependencies>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>toy-ssh-agent</artifactId>
<version>1.4</version>
<type>apk</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>agit</artifactId>
<version>${project.version}</version>
<type>apk</type>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>agit</artifactId>
<scope>provided</scope>
<type>apk</type>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>agit</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<scope>provided</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>agit-test-utils</artifactId>
<groupId>com.madgag</groupId>
<artifactId>agit-test-utils</artifactId>
<version>${project.version}</version>
</dependency>
<exclusions>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>calculon</artifactId>
<version>1.0.5-UNOFFICIAL-BUILD</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>mini-git-server-war</artifactId>
<version>0.4</version>
<type>war</type>
</dependency>
</dependencies>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>calculon</artifactId>
<version>1.0.5-UNOFFICIAL-BUILD</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>mini-git-server-war</artifactId>
<version>0.4</version>
<type>war</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand All @@ -67,10 +76,6 @@
<extractDuplicates>true</extractDuplicates>
</configuration>
</plugin>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
Expand All @@ -97,7 +102,7 @@
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.1</version>
<version>1.1.4</version>
<executions>
<execution>
<id>start-container</id>
Expand Down

This file was deleted.

54 changes: 28 additions & 26 deletions agit-test-utils/pom.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
<?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.madgag</groupId>
<artifactId>agit-test-utils</artifactId>
<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.madgag</groupId>
<artifactId>agit-test-utils</artifactId>

<parent>
<version>1.26-SNAPSHOT</version>
<groupId>com.madgag</groupId>
<artifactId>agit-parent</artifactId>
</parent>
<parent>
<version>1.26-SNAPSHOT</version>
<groupId>com.madgag</groupId>
<artifactId>agit-parent</artifactId>
</parent>

<packaging>jar</packaging>
<name>agit test utils</name>
<dependencies>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>util-compress</artifactId>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>org.eclipse.jgit</artifactId>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>madgag-hamcrest-matchers</artifactId>
<version>0.3</version>
</dependency>
</dependencies>
<packaging>jar</packaging>
<name>agit test utils</name>
<dependencies>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>util-compress</artifactId>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>madgag-hamcrest-matchers</artifactId>
<version>0.3</version>
</dependency>
<dependency>
<groupId>com.madgag</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
4 changes: 0 additions & 4 deletions agit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@
<androidManifestFile>${project.build.directory}/filtered-manifest/AndroidManifest.xml</androidManifestFile>
</configuration>
</plugin>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
65 changes: 15 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,26 @@
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</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.0.0</version>
<version>3.0.2</version>
<extensions>true</extensions>
<configuration>
<dex>
<jvmArguments>
<jvmArgument>-Xms256m</jvmArgument>
<jvmArgument>-Xmx512m</jvmArgument>
</jvmArguments>
</dex>
<!--
<proguard>
<skip>false</skip>
<config>../proguard.cfg</config>
</proguard>
-->
<sdk>
<platform>10</platform>
</sdk>
Expand All @@ -131,48 +138,6 @@
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<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>
<!-- we need to override the dependency of the plugin to get a newer version of proguard -->
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<proguardVersion>4.4</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>../proguard.cfg</proguardInclude> <!-- sadly, relative to sub-modules -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down
24 changes: 12 additions & 12 deletions proguard.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
-ignorewarnings
-dontoptimize
-dontobfuscate
-dontskipnonpubliclibraryclasses

-renamesourcefileattribute SourceFile

-keepattributes SourceFile,LineNumberTable,*Annotation*

-printmapping map.txt
-printseeds seed.txt


-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
Expand Down Expand Up @@ -32,20 +43,8 @@
-keep class * extends com.jcraft.jsch.KeyExchange
-keep class com.jcraft.jsch.**

-dontskipnonpubliclibraryclasses

-ignorewarnings
-verbose

-renamesourcefileattribute SourceFile

-keepattributes SourceFile,LineNumberTable,*Annotation*

-printmapping map.txt
-printseeds seed.txt
-ignorewarnings
-dontoptimize

-keepclassmembers class com.google.inject.assistedinject.FactoryProvider2 { *; }


Expand All @@ -57,3 +56,4 @@

-keepclassmembers class * extends android.app.Activity { public void *(android.view.View); }

-keep class org.apache.commons.io.IOUtils

0 comments on commit e2b1fac

Please sign in to comment.