NickF
NickF

Reputation: 5737

Android dex injection with Proguard and Maven

In my app I'm using dex injection for some business logic.
I'm using maven to build the project and that dex separatly with maven plugin com.jayway.maven.plugins.android.generation2

The connection from this dex to my app is through an interface. I need to find a way to be able to obfuscate my app and that external code with the same names.

example of my pom.xml:

<build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <extensions>true</extensions>
                <version>3.7.0</version>
                <configuration>

                    <dex>
                        <jvmArguments>
                            <jvmArgument>-Xms256m</jvmArgument>
                            <jvmArgument>-Xmx1500m</jvmArgument>
                        </jvmArguments>

                    </dex>
                    <proguard>
                        <skip>false</skip>
                        <proguardJarPath>${env.ANDROID_HOME}/tools/proguard/lib/proguard.jar</proguardJarPath>
                        <jvmArguments>
                            <jvmArgument>-Xms256m</jvmArgument>
                            <jvmArgument>-Xmx1500m</jvmArgument>
                        </jvmArguments>
                    </proguard>
                    <sdk>
                        <platform>19</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
            </plugin>
        </plugins>
    </build>

Is that like multi dex or I need something else?

Upvotes: 0

Views: 100

Answers (1)

T. Neidhart
T. Neidhart

Reputation: 6200

You can use the configuration option -applymapping to re-use an existing mapping. So the workflow would be to build the additional dex file using ProGuard and use the resulting mapping file when building the whole application. You should also use the following option (both for dex and application) to reduce the risk of problems.

-useuniqueclassmembernames

Upvotes: 1

Related Questions