Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented generation of main dex classes list for multi dex #675

Merged
merged 1 commit into from
Mar 23, 2017

Conversation

psorobka
Copy link
Contributor

I've promised some time ago that I will do better multi dex support, so here it is :)
Implementation is based on mainDexClasses script, included in build-tools 21.1.1+, but it's written in Java - there should be no problems with multi OS support (doh).

There is a sample project included with integration test: multidexsample
Basically, all you need to do is to specify in pom.xml:

<configuration>
    ....
    <dexMultiDex>true</dexMultiDex>
    <dexGenerateMainDexList>true</dexGenerateMainDexList> 
    ....
</configuration>

Then add dependency:

        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>multidex</artifactId>
            <version>1.0.1</version>
            <type>aar</type>
        </dependency>

If you don't have the jar in your repo, you can use bundled with Android SDK Maven repo:

    <repositories>
        <repository>
            <id>local-android-repository</id>
            <url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
        </repository>
    </repositories>

Finally, use multidex in your Application class:

...
import android.support.multidex.MultiDex;
...
public class YourApplication extends Application {
...
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        ...
        MultiDex.install(this);
    }

I've tested it on linux and windows box.

Change-Id: I32d76d8cc08d159f791e98ad75c780ca340ea0fb
@athkalia
Copy link
Contributor

Any updates on this ?

@@ -0,0 +1,58 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove that class its usage. It hides too much detail and makes the tests harder to read imho.

@mosabua
Copy link
Member

mosabua commented Jan 19, 2016

Can you rebase this and ensure all tests pass?


Set< File> inputFiles = getDexInputFiles();
StringBuilder sb = new StringBuilder();
sb.append( '"' ).append( StringUtils.join( inputFiles, File.pathSeparatorChar ) ).append( '"' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I remember this was necessary for things to work on OSX, Linux and windows..

@sytolk
Copy link

sytolk commented Jan 29, 2016

Maybe my issue #556 is for the file separator difference on my OS ?

@mosabua
Copy link
Member

mosabua commented Jan 29, 2016

I released 4.4.1 now but I would like to release another version soon and include this. Could you rebase and ensure tests path please.

@MobiDevelop MobiDevelop mentioned this pull request Dec 22, 2016
@mosabua mosabua merged commit be35eed into simpligility:master Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants