1

I am using greendao ORM. I am trying to encrypt my database using SQLCipher. Greendao automativally supports sqlcipher. So I wrote the following code for encryption.

DaoMaster.DevOpenHelper helper = new 
MyDevOpenHelper(HuoYunApplication.getHuoYunApplicationContext(), 
DBManager.DB_NAME, null);
Database db = helper.getEncryptedWritableDb(getEncryptedIMEI());
DaoSession daoSession = new DaoMaster(db).newSession();
return daoSession;

My app gradle dependencies are:-

 compile rootProject.ext.dependencies["greendao"]
 compile 'net.zetetic:android-database-sqlcipher:3.5.4'

However whenever I perform any database operation using this session,it gives an error which caused an crash when my app starts,Even it is not a crash about encryption or greendao itself,but about a third party "so" dependency:

04-19 10:49:08.524 26995-26995/com.wuba.huoyun E/CrashReport: # CRASH STACK: 04-19 10:49:08.524 26995-26995/com.wuba.huoyun E/CrashReport: java.lang.UnsatisfiedLinkError: No implementation found for long com.baidu.platform.comjni.map.commonmemcache.JNICommonMemCache.Create() (tried Java_com_baidu_platform_comjni_map_commonmemcache_JNICommonMemCache_Create and Java_com_baidu_platform_comjni_map_commonmemcache_JNICommonMemCache_Create__) at com.baidu.platform.comjni.map.commonmemcache.JNICommonMemCache.Create(Native Method) at com.baidu.platform.comjni.map.commonmemcache.a.a(Unknown Source) at com.baidu.platform.comapi.util.f.b(Unknown Source) at com.baidu.platform.comapi.a.c(Unknown Source) at com.baidu.platform.comapi.c.a(Unknown Source) at com.baidu.mapapi.SDKInitializer.initialize(Unknown Source) at com.baidu.mapapi.SDKInitializer.initialize(Unknown Source)

I have checked greendaodemo in their official website,and I believe that I have add sqlcipher dependence in right way.So is there any genus that can help us solve this problem?

Renats Stozkovs
  • 2,549
  • 10
  • 22
  • 26
  • This crash has nothing to do with greendao. You forgot an initialization step for some library from Baidu. Not knowing the library, I don't know if it was a loadLibrary call you need to make for the native C library, or if its a java initialization function somewhere. Either that or you forgot to build/package the C library for that architecture. – Gabe Sechan Apr 19 '17 at 03:23
  • But before I added the sqlcipher dependence there is no problem in running my app.Ony when I added the dependency crash begun and the crash report showed that error.So I don't know how to do now. – 池田木子 Apr 19 '17 at 06:18
  • "java.lang.UnsatisfiedLinkError: No implementation found for long com.baidu.platform.comjni.map.commonmemcache.JNICommonMemCache.Create()" That crash is not going to be cause by greendao in any way. – Gabe Sechan Apr 19 '17 at 06:19
  • I agree with you.Well I'll check other reasons.Thank you anyway. – 池田木子 Apr 19 '17 at 06:51
  • Improved Code formatting and positions – Arpit Kulsreshtha Apr 19 '17 at 13:58
  • Oh Thank you so much!!! – 池田木子 Apr 20 '17 at 02:46

0 Answers0