ayushmaharjan | Posts: 10

Error due to duplicate DefaultRealmModule.class

0 votes
Hi I am trying to integrate ESignLive Android SDK into my app. I am already using Realm as my database. When I try to integrate the SDK. I get the following error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForLftDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: io/realm/DefaultRealmModule.class
I have researched and found out an issue in the realm repository: https://github.com/realm/realm-java/issues/1545 They have mentioned the following link: https://realm.io/docs/java/latest/#sharing-schemas Can you help me with this issue?

Approved Answer
harishaidary | Posts: 1812

Reply to: Error due to duplicate DefaultRealmModule.class

1 votes
Hi there, The Realm module has been added to the SDK. You can download the latest SDK from our documenation: http://docs.esignlive.com/content/c_integrator_s_guide/sdk/l_esignlive_mobile_sdk/esignlive_android_sdk.htm

harishaidary | Posts: 1812

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
Hello, As per our mobile dev team, the android sdk doesn't have the Realm as module. It will be available in the next version of the sdk. Until then you can use the sdk implementation of Realm by calling:
PersistentDataManager.getInstance().getRealmForCurrentThread();
That will give you a normal Realm object that you can use. The issue you are having is that you can’t use classes named the same way as the one used in the SDK. I would recommend however that you don't close that object, because the sdk uses on a per thread basis, and it that might cause issues within the sdk.

ayushmaharjan | Posts: 10

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
I have replaced all my 'Realm.getDefaultInstance()' with 'PersistentDataManager.getInstance().getReralmForCurrentThread(). But I am still getting the same error. Do you have any timeline for the next sdk release?

harishaidary | Posts: 1812

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
The recommendation of our mobile dev team will only work if you remove your previous implementation. You should not have Realm implementation on the application side. In other words, you should not have executed code such as Realm.setDefaultConfiguration(…); and RealmConfiguration realmConfiguration = new RealmConfiguration.Builder. As for the next release of the android sdk, there is no confirmed date yet. I will post back here once it has been released.

ayushmaharjan | Posts: 10

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
I had already removed all such configurations. I am still getting the same error. The only way I could remove the error was to implement 'RealmModel' class instead of inheriting 'RealmObject' class. After refactoring all my code, I tried to save my objects using 'PersistentDataManager' but I get the following exception:
 io.realm.exceptions.RealmException: class .LocationEntry is not part of the schema for this Realm. 
It is almost a week not and I cannot even integrate the sdk in my app. Is there any way you can provide a version of sdk that resolves this issue?

harishaidary | Posts: 1812

Reply to: Error due to duplicate DefaultRealmModule.class

1 votes
Hey, Sorry for the late reply. Our mobile dev team is currently working on a patch to fix this issue. It should be released next week or the following week. I'll post back here once it's available.

ayushmaharjan | Posts: 10

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
Hello Haris Are there any updates?

harishaidary | Posts: 1812

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
Hi, I spoke to our mobile dev team and a new version should be released sometime this week.

ayushmaharjan | Posts: 10

Reply to: Error due to duplicate DefaultRealmModule.class

0 votes
Thank you. I'll try out the new SDK and let you if I have any problems.

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off