← Back to team overview

dhis2-devs team mailing list archive

Re: [Android] Sdk method count

 

Hi Araz Abishov, 

Thank for your support. That way I usually do in my project when release or limit dex and avoid view/copy code. In first email I had mention
>>> Who can provide me a proguard file to reduce it.

I just need content proguard some lib of dhis2-sdk. Anyway, I has removed some lib and refactor code and temporary success. 
Noticed: in one app, can't not use dagger2 and  dbflow concurrent without proguard, should be separate module.

Thank you all. 

Yours sincerely,
Nhan Cao
nhancv@xxxxxxxxxxx



> On Feb 8, 2016, at 4:31 PM, Araz Abishov <araz.abishov.gsoc@xxxxxxxxx> wrote:
> 
> Hello Nhan,
> 
> I am sorry for responding late. Some suggestions are below:
> 
> As a hacky solution, you can try to use default proguard configuration for debug builds. (android studio includes it by default when you create a new project). 
> 
> If you have removed it, you need to modify your gradle build script by adding proguard configuration. You will also need to put proguard-rules.pro file in the root directory of your android project (if you have removed it):
> buildTypes {
>         debug {
>             minifyEnabled true
>             proguardFiles getDefaultProguardFile('proguard-android.txt'),
>             'proguard-rules.pro'
>         }
>     }
> In this case, proguard will be used to strip out unused methods for debug builds. 
> 
> 
> In general, this approach is not recommended way of handling dexing issues, but in order to provide better solution I need more details about project dependencies or an access to your codebase.
> 
> 
> Will be waiting for updates from you.
> 
> Best Regards,
> Araz Abishov
> 
> On February 7, 2016 at 1:27:40 PM, Nhan Cao (nhancv@xxxxxxxxxxx <mailto:nhancv@xxxxxxxxxxx>) wrote:
> 
>> Hi Ignacio Foche, 
>> 
>> Thanks for reply. So in my previous mail, I had said 
>>> I try to set multidex but it's not stable, some feature not found class rx occur.
>> 
>>  I had done similar like you (a lot results on google or stackoverflow). You can read full docs at http://developer.android.com/tools/building/multidex.html <http://developer.android.com/tools/building/multidex.html> and noticed Multidex support for Android 5.0 and higher  and Avoiding the 65K Limit part. 
>> 
>>  With this you'll build success, but your apk higher, but if your project is injected some more lib using more annotation or not common declare (like reactiveX, dagger, retrolamda, ... ) it will not work stable, sometime will crash with no reference error. That why I'm not continue with that solution and try to review and do anything about reduce method.
>> 
>> Yours sincerely,
>> Nhan Cao
>> nhancv@xxxxxxxxxxx <mailto:nhancv@xxxxxxxxxxx>
>> 
>> 
>> 
>>> On Feb 7, 2016, at 5:20 PM, Ignacio Foche <nacho.foche@xxxxxxxxx <mailto:nacho.foche@xxxxxxxxx>> wrote:
>>> 
>>> 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 <mailto: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 <mailto:nhancv@xxxxxxxxxxx>
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs>
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx <mailto:dhis2-devs@xxxxxxxxxxxxxxxxxxx>
>>> Unsubscribe : https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs>
>>> More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
>>> 
>>> 
>>> 
>>> 
>>> --
>>> ----
>>> Clave pública PGP:
>>> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8185416E <http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8185416E>
>> _______________________________________________ 
>> Mailing list: https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs> 
>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx <mailto:dhis2-devs@xxxxxxxxxxxxxxxxxxx> 
>> Unsubscribe : https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs> 
>> More help : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>

References