[jitsi-dev] Dex class limit for Android app


#1

Hi all,

Today I wanted to add OTR plugin to Android project and I've
encountered problem with dex methods limit of 65535. Sooner or later
we'll have to solve this issue if we want to add anything more to the
app.

I tried searching net for solutions and there is an option of spliting
project into multiple .dex files and loading them at runtime.

The first thing that comes to mind is to separate Jitsi bundles from
/lib/bundles to second .dex. The bad thing is that we do packages
renaming and this may cause troubles. Here I've found a guide
explaining how to do this:
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

The guide says that dalvik class loader have to be used in order to
create object instances. I wonder much modifications have to be done
to make it work and if that's possible. What do you think ? Maybe it
will be possible to use this loader from Android OSGI implementation.

Regards,
Pawel


#2

Hi all,

Today I wanted to add OTR plugin to Android project

Way to go! This will be important to add.

and I've
encountered problem with dex methods limit of 65535. Sooner or later
we'll have to solve this issue if we want to add anything more to the
app.

You are right!

I tried searching net for solutions and there is an option of spliting
project into multiple .dex files and loading them at runtime.

The first thing that comes to mind is to separate Jitsi bundles from
/lib/bundles to second .dex. The bad thing is that we do packages
renaming and this may cause troubles. Here I've found a guide
explaining how to do this:
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

Opinions?

Emil

···

On 17.07.13, 15:22, Paweł Domas wrote:

--
https://jitsi.org


#3

Hi Emil,

Hi all,

Today I wanted to add OTR plugin to Android project

Way to go! This will be important to add.

and I've
encountered problem with dex methods limit of 65535. Sooner or later
we'll have to solve this issue if we want to add anything more to the
app.

You are right!

I tried searching net for solutions and there is an option of spliting
project into multiple .dex files and loading them at runtime.

The first thing that comes to mind is to separate Jitsi bundles from
/lib/bundles to second .dex. The bad thing is that we do packages
renaming and this may cause troubles. Here I've found a guide
explaining how to do this:

http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html

Opinions?

Emil

Sorry, but we've been discussing this with Yana and Damian off the
list(it was urgent and there was no intrest here). The issue is
already resolved using method mentioned above.

Regards,
Pawel

···

On Thu, Jul 25, 2013 at 11:26 PM, Emil Ivov <emcho@jitsi.org> wrote:

On 17.07.13, 15:22, Paweł Domas wrote:

--
https://jitsi.org


#4

Hi Emil,

>>
>> Hi all,
>>
>> Today I wanted to add OTR plugin to Android project
>
>
> Way to go! This will be important to add.
>
>
>> and I've
>> encountered problem with dex methods limit of 65535. Sooner or later
>> we'll have to solve this issue if we want to add anything more to the
>> app.
>
>
> You are right!
>
>
>> I tried searching net for solutions and there is an option of spliting
>> project into multiple .dex files and loading them at runtime.
>>
>> The first thing that comes to mind is to separate Jitsi bundles from
>> /lib/bundles to second .dex. The bad thing is that we do packages
>> renaming and this may cause troubles. Here I've found a guide
>> explaining how to do this:
>>
>>

>
>
> Opinions?
>
> Emil

Sorry, but we've been discussing this with Yana and Damian off the
list(it was urgent and there was no intrest here).

There is always interest here.

The issue is
already resolved using method mentioned above.

Could you please sum it up? What parts did you split exactly and who is
doing the auto loading?

Emil

···

On Jul 25, 2013 11:52 PM, "Paweł Domas" <pawel.domas@jitsi.org> wrote:

On Thu, Jul 25, 2013 at 11:26 PM, Emil Ivov <emcho@jitsi.org> wrote:
> On 17.07.13, 15:22, Paweł Domas wrote:

Regards,
Pawel

>
> --
> https://jitsi.org
>


#5

Bundles that are not referenced directly from code can be put into
separate dex file which resides in asset dir. These are in most cases
impl bundles like sip and jabber protocol. Then our Android OSGI
implementation when loads bundle activator uses external classloader
in case ClassDefNotFoundException is thrown on default classpath.

Note that other classes from external classloader are not accessible
for those loaded using default one. I'm not sure, but in order to be
able to load all classes from separate dex we will have to override
classloaders for all threads. But I'm not sure how Java works here.

Regards,
Pawel

···

On Thu, Jul 25, 2013 at 11:58 PM, Emil Ivov <emcho@jitsi.org> wrote:

On Jul 25, 2013 11:52 PM, "Paweł Domas" <pawel.domas@jitsi.org> wrote:

Hi Emil,

On Thu, Jul 25, 2013 at 11:26 PM, Emil Ivov <emcho@jitsi.org> wrote:
> On 17.07.13, 15:22, Paweł Domas wrote:
>>
>> Hi all,
>>
>> Today I wanted to add OTR plugin to Android project
>
>
> Way to go! This will be important to add.
>
>
>> and I've
>> encountered problem with dex methods limit of 65535. Sooner or later
>> we'll have to solve this issue if we want to add anything more to the
>> app.
>
>
> You are right!
>
>
>> I tried searching net for solutions and there is an option of spliting
>> project into multiple .dex files and loading them at runtime.
>>
>> The first thing that comes to mind is to separate Jitsi bundles from
>> /lib/bundles to second .dex. The bad thing is that we do packages
>> renaming and this may cause troubles. Here I've found a guide
>> explaining how to do this:
>>
>>
>> http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
>
>
> Opinions?
>
> Emil

Sorry, but we've been discussing this with Yana and Damian off the
list(it was urgent and there was no intrest here).

There is always interest here.

The issue is
already resolved using method mentioned above.

Could you please sum it up? What parts did you split exactly and who is
doing the auto loading?

Emil