← Back to team overview

dhis2-devs team mailing list archive

Re: [Android] Sdk method count

 

Hi Nhan Cao,

in EyeSeeTea we're also integrating Crashlytics and the DHIS2 SDK in our
projects, and we've experimented that problem, so here I tell you how we
solved it.

1. Add to the dependencies of your project, in your gradle.build, the
multidex library

compile 'com.android.support:multidex:1.0.1'


2. Create, if your project doesn't have it now, an Application class that
extend from Dhis2Application

public class EyeSeeTeaApplication extends Dhis2Application  {
..
}
(after that, whenever you tell Crashlytics to integrate with your
problem, it will probably introduce its code inside the "onCreate()"
method)

4. Import MultiDex in your Application class (EyeSeeTeaApplication in
the example)
import android.support.multidex.MultiDex;

5. Override in your Application class the attachBaseContext() method
to make DBFlow work with MultiDex:
/**
 * Function used to make DBFlow compatible with multidex
 * @param base
 */
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

5. Consequently, in your AndroidManifest.xml there would be something like...
<application
    android:name=".EyeSeeTeaApplication"
    android:allowBackup="true"
    android:icon="@drawable/qualityapp_logo"
    android:label="@string/app_name"
    android:theme="@style/EyeSeeTheme"
    tools:replace="android:icon,android:theme" >
...

this is...you have to declare your application in your AndroidManifest.xml.


And I think that I didn't forget anything. I hope this can help you
and anyone else with the same problems (enabling MultiDex in a project
with DBFlow)


Best regards



2016-02-06 13:09 GMT+01:00 Nhan Cao <nhancv@xxxxxxxxxxx>:

> Hi all,
>
> I have problems when I integrate fabric into my project. UNEXPECTED
> TOP-LEVEL EXCEPTION (the dex 65K method limit). I try to set multidex but
> it's not stable, some feature not found class rx occur. So I create new
> default app and include sdk for test method of sdk, it's bit number: 57894
> method. I think it's problem for anyone want to extend it. Who can provide
> me a proguard file to reduce it. I has include file method count of
> sdk-2.22-legacy.
>
>
>
>
> Yours sincerely,
> Nhan Cao
> nhancv@xxxxxxxxxxx
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
----
Clave pública PGP:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8185416E

Follow ups

References