运行应用程序时出现SQLCipher错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了运行应用程序时出现SQLCipher错误相关的知识,希望对你有一定的参考价值。

我在我的依赖项中使用sqlcipher。我的build.gradle文件如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "com.dell.prapproval"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName "$rootProject.ext.versionName"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

       // setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")")

        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        consumerProguardFiles file('proguard.cfg')
        ndk {
            abiFilters "armeabi-v7a"
        }

    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    signingConfigs {
        config {
            keyAlias 'emc_mobile'
            keyPassword 'P@ssw0rd'
            storeFile file('EMC_MOBILE')
            storePassword 'P@ssw0rd'
        }
    }
    buildTypes {
        debug {
            minifyEnabled true
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
            //versionNameSuffix "-T"
        }
        release {
            debuggable true
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
           // versionNameSuffix "-R"

        }
    }
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'
    implementation(name: 'AirWatchSDK-release-18.5.5-SNAPSHOT', ext: 'aar')
    implementation(name: 'AWFramework-release-18.5.17-SNAPSHOT', ext: 'aar')
    implementation(name: 'AWNetworkLibrary-release-18.5.14-SNAPSHOT', ext: 'aar')
    implementation(name: 'CredentialsExt-18.3-SNAPSHOT', ext: 'aar')
    implementation(name: 'android-database-sqlcipher-3.5.9', ext: 'aar')
    implementation(name: 'littleproxy-1.1.0-beta2-d', ext: 'jar')
    implementation(name: 'slf4j-android-1.6.1-RC1', ext: 'jar')
    implementation(name: 'kotlin-stdlib-1.2.50', ext: 'jar')
   // implementation(name: 'okio-1.14.1', ext: 'jar')
   // implementation(name: 'gson-2.4', ext: 'jar')
    implementation(name: 'netty-all-4.0.34.Final.AW.a', ext: 'jar')
   // implementation(name: 'lang3-3.1', ext: 'jar')
   // implementation(name: 'zxing-3.2.1', ext: 'jar')
   // implementation(name: 'okhttp-3.6.0', ext: 'jar')
    implementation(name: 'guava-20.0', ext: 'jar')
    implementation(name: 'awrepackagedhttpclient-1.0.3', ext: 'jar')
    implementation(name: 'apptunnellib-07082016', ext: 'jar')

    implementation("com.android.support:preference-v14:$rootProject.ext.supportLibraryVersion") {
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'appcompat-v7'
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }

    implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support:support-vector-drawable:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support:animated-vector-drawable:$rootProject.ext.supportLibraryVersion"
    implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutLibraryVersion"
    implementation "com.jpardogo.googleprogressbar:library:$rootProject.ext.googleprogressbarVersion"
    implementation "com.android.volley:volley:$rootProject.ext.volleyVersion"
    implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion"
    implementation "com.github.Shashank02051997:FancyToast-Android:$rootProject.ext.fancyToastVersion"
    //implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation "junit:junit:$rootProject.ext.junitLibraryVersion"
    androidTestImplementation "com.android.support.test:runner:$rootProject.ext.runnerLibraryVersion"
    androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.ext.espressoCoreLibraryVersion"

    implementation "com.google.android.gms:play-services-base:$rootProject.ext.googlePlayServiceVersion"

}  

因此,当我在移动设备上运行我的代码时,我得到以下错误:

09-11 15:48:23.876 30829-30878/com.dell.prapproval E/art: Failed to register native method net.sqlcipher.database.SQLiteDatabase.native_getDbLookaside()I in /data/app/com.dell.prapproval-1/split_lib_directories_apk.apk
09-11 15:48:23.877 30829-30878/com.dell.prapproval E/art: ----- class 'Lnet/sqlcipher/database/SQLiteDatabase;' cl=0x12d64ac0 -----
      objectSize=600 (136 from super)
      access=0x0008.0001
      super='java.lang.Class<net.sqlcipher.database.SQLiteClosable>' (cl=0x12d64ac0)
      vtable (33 entries, 4 in super):
         0: void net.sqlcipher.database.SQLiteDatabase.addSQLiteClosable(net.sqlcipher.database.SQLiteClosable)
         1: void net.sqlcipher.database.SQLiteDatabase.addToCompiledQueries(java.lang.String, net.sqlcipher.database.SQLiteCompiledSql)
         2: void net.sqlcipher.database.SQLiteDatabase.beginTransaction()
         3: void net.sqlcipher.database.SQLiteDatabase.beginTransactionWithListener(net.sqlcipher.database.SQLiteTransactionListener)
         4: void net.sqlcipher.database.SQLiteDatabase.close()
         5: net.sqlcipher.database.SQLiteStatement net.sqlcipher.database.SQLiteDatabase.compileStatement(java.lang.String)
         6: int net.sqlcipher.database.SQLiteDatabase.delete(java.lang.String, java.lang.String, java.lang.String[])
         7: void net.sqlcipher.database.SQLiteDatabase.endTransaction()
         8: void net.sqlcipher.database.SQLiteDatabase.execSQL(java.lang.String)
         9: net.sqlcipher.database.SQLiteCompiledSql net.sqlcipher.database.SQLiteDatabase.getCompiledStatementForSql(java.lang.String)
        10: java.lang.String net.sqlcipher.database.SQLiteDatabase.getPath()
        11: int net.sqlcipher.database.SQLiteDatabase.getVersion()
        12: long net.sqlcipher.database.SQLiteDatabase.insert(java.lang.String, java.lang.String, android.content.ContentValues)
        13: long net.sqlcipher.database.SQLiteDatabase.insertWithOnConflict(java.lang.String, java.lang.String, android.content.ContentValues, int)
        14: boolean net.sqlcipher.database.SQLiteDatabase.isOpen()
        15: boolean net.sqlcipher.database.SQLiteDatabase.isReadOnly()
        16: int net.sqlcipher.database.SQLiteDatabase.lastChangeCount()
        17: long net.sqlcipher.database.SQLiteDatabase.lastInsertRow()
        18: void net.sqlcipher.database.SQLiteDatabase.lock()
        19: void net.sqlcipher.database.SQLiteDatabase.native_execSQL(java.lang.String)
        20: void net.sqlcipher.database.SQLiteDatabase.onAllReferencesReleased()
        21: void net.sqlcipher.database.SQLiteDatabase.onCorruption()
        22: net.sqlcipher.Cursor net.sqlcipher.database.SQLiteDatabase.query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String)
        23: net.sqlcipher.Cursor net.sqlcipher.database.SQLiteDatabase.query(boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String)
        24: net.sqlcipher.Cursor net.sqlcipher.database.SQLiteDatabase.queryWithFactory(net.sqlcipher.database.SQLiteDatabase$CursorFactory, boolean, java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String)
        25: net.sqlcipher.Cursor net.sqlcipher.database.SQLiteDatabase.rawQuery(java.lang.String, java.lang.String[])
        26: net.sqlcipher.Cursor net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(net.sqlcipher.database.SQLiteDatabase$CursorFactory, java.lang.String, java.lang.String[], java.lang.String)
        27: void net.sqlcipher.database.SQLiteDatabase.removeSQLiteClosable(net.sqlcipher.database.SQLiteClosable)
09-11 15:48:23.878 30829-30878/com.dell.prapproval E/art:     28: void net.sqlcipher.database.SQLiteDatabase.setTransactionSuccessful()
        29: void net.sqlcipher.database.SQLiteDatabase.setVersion(int)
        30: void net.sqlcipher.database.SQLiteDatabase.unlock()
        31: int net.sqlcipher.database.SQLiteDatabase.update(java.lang.String, android.content.ContentValues, java.lang.String, java.lang.String[])
        32: int net.sqlcipher.database.SQLiteDatabase.updateWithOnConflict(java.lang.String, android.content.ContentValues, java.lang.String, java.lang.String[], int)
      direct methods (29 entries):
         0: void net.sqlcipher.database.SQLiteDatabase.<clinit>()
         1: void net.sqlcipher.database.SQLiteDatabase.<init>(java.lang.String, net.sqlcipher.database.SQLiteDatabase$CursorFactory, int, net.sqlcipher.DatabaseErrorHandler)
         2: void net.sqlcipher.database.SQLiteDatabase.access$000(net.sqlcipher.database.SQLiteDatabase, byte[])
         3: void net.sqlcipher.database.SQLiteDatabase.access$100(net.sqlcipher.database.SQLiteDatabase, char[])
         4: void net.sqlcipher.database.SQLiteDatabase.checkLockHoldTime()
         5: void net.sqlcipher.database.SQLiteDatabase.closeClosable()
         6: boolean net.sqlcipher.database.SQLiteDatabase.containsNull(char[])
09-11 15:48:23.880 30829-30878/com.dell.prapproval E/art:      7: net.sqlcipher.database.SQLiteDatabase net.sqlcipher.database.SQLiteDatabase.create(net.sqlcipher.database.SQLiteDatabase$CursorFactory, char[])
         8: void net.sqlcipher.database.SQLiteDatabase.dbclose()
         9: void net.sqlcipher.database.SQLiteDatabase.dbopen(java.lang.String, int)
        10: void net.sqlcipher.database.SQLiteDatabase.deallocCachedSqlStatements()
        11: void net.sqlcipher.database.SQLiteDatabase.enableSqlProfiling(java.lang.String)
        12: void net.sqlcipher.database.SQLiteDatabase.enableSqlTracing(java.lang.String)
        13: java.lang.String net.sqlcipher.database.SQLiteDatabase.findEditTable(java.lang.String)
        14: byte[] net.sqlcipher.database.SQLiteDatabase.getBytes(char[])
        15: java.lang.String net.sqlcipher.database.SQLiteDatabase.getTime()
        16: void net.sqlcipher.database.SQLiteDatabase.key(byte[])
        17: void net.sqlcipher.database.SQLiteDatabase.keyDatabase(net.sqlcipher.database.SQLiteDatabaseHook, java.lang.Runnable)
        18: void net.sqlcipher.database.SQLiteDatabase.key_mutf8(char[])
        19: void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context)
        20: void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context, java.io.File)
        21: void net.sqlcipher.database.SQLiteDatabase.loadLibs(android.content.Context, java.io.File, net.sqlcipher.database.SQLiteDatabase$LibraryLoader)
        22: void net.sqlcipher.database.SQLiteDatabase.lockForced()
        23: net.sqlcipher.database.SQLiteDatabase net.sqlcipher.database.SQLiteDatabase.openDatabase(java.lang.String, char[], net.sqlcipher.database.SQLiteDatabase$CursorFactory, int)
        24: net.sqlcipher.database.SQLiteDatabase net.sqlcipher.database.SQLiteDatabase.openDatabase(java.lang.String, char[], net.sqlcipher.database.SQLiteDatabase$CursorFactory, int, net.sqlcipher.database.SQLiteDatabaseHook, net.sqlcipher.DatabaseErrorHandler)
        25: void net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(char[], net.sqlcipher.database.SQLiteDatabaseHook)
        26: net.sqlcipher.database.SQLiteDatabase net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(java.lang.String, char[], net.sqlcipher.database.SQLiteDatabase$CursorFactory, net.sqlcipher.database.SQLiteDatabaseHook, net.sqlcipher.DatabaseErrorHandler)
        27: void net.sqlcipher.database.SQLiteDatabase.rekey(byte[])
        28: void net.sqlcipher.database.SQLiteDatabase.unlockForced()
      static fields (4 entries):
         0: java.lang.String[] net.sqlcipher.database.SQLiteDatabase.CONFLICT_VALUES
         1: java.util.regex.Pattern net.sqlcipher.database.SQLiteDatabase.EMAIL_IN_DB_PATTERN
         2: java.util.WeakHashMap net.sqlcipher.database.SQLiteDatabase.sActiveDatabases
         3: int net.sqlcipher.database.SQLiteDatabase.sQueryLogTimeInMillis
      instance fields (27 entries):
         0: int net.sqlcipher.database.SQLiteDatabase.mCacheFullWarnings
         1: java.util.Map net.sqlcipher.database.SQLiteDatabase.mCompiledQueries
         2: net.sqlcipher.DatabaseErrorHandler net.sqlcipher.database.SQLiteDatabase.mErrorHandler
         3: net.sqlcipher.database.SQLiteDatabase$CursorFactory net.sqlcipher.database.SQLiteDatabase.mFactory
         4: int net.sqlcipher.database.SQLiteDatabase.mFlags
         5: boolean net.sqlcipher.database.SQLiteDatabase.mInnerTransactionIsSuccessful
         6: long net.sqlcipher.database.SQLiteDatabase.mLastLockMessageTime
         7: java.lang.String net.sqlcipher.database.SQLiteDatabase.mLastSqlStatement
         8: java.util.concurrent.locks.ReentrantLock net.sqlcipher.database.SQLiteDatabase.mLock
         9: long net.sqlcipher.database.SQLiteDatabase.mLockAcquiredThreadTime
        10: long net.sqlcipher.database.SQLiteDatabase.mLockAcquiredWallTime
        11: boolean net.sqlcipher.database.SQLiteDatabase.mLockingEnabled
        12: int net.sqlcipher.database.SQLiteDatabase.mMaxSqlCacheSize
        13: long net.sqlcipher.database.SQLiteDatabase.mNativeHandle
        14: int net.sqlcipher.database.SQLiteDatabase.mNumCacheHits
        15: int net.sqlcipher.database.SQLiteDatabase.mNumCacheMisses
        16: java.lang.String net.sqlcipher.database.SQLiteDatabase.mPath
        17: java.lang.String net.sqlcipher.database.SQLiteDatabase.mPathForLogs
        18: java.util.WeakHashMap net.sqlcipher.database.SQLiteDatabase.mPrograms
        19: int net.sqlcipher.database.SQLiteDatabase.mSlowQueryThreshold
        20: java.lang.Throwable net.sqlcipher.database.SQLiteDatabase.mStackTrace
        21: java.util.Map net.sqlcipher.database.SQLiteDatabase.mSyncUpdateInfo
        22: int net.sqlcipher.database.SQLiteDatabase.mTempTableSequence
        23: java.lang.String net.sqlcipher.database.SQLiteDatabase.mTimeClosed
        24: java.lang.String net.sqlcipher.database.SQLiteDatabase.mTimeOpened
        25: boolean net.sqlcipher.database.SQLiteDatabase.mTransactionIsSuccessful
        26: net.sqlcipher.database.SQLiteTransactionListener net.sqlcipher.database.SQLiteDatabase.mTransactionListener

我甚至将ndk支持代码添加到build.gradle,但这个错误仍然存​​在。我该如何解决?

答案

我假设你是混淆应用程序。你有没有从SQLChipher申请proguard configuration

不幸的是,他们将其构建为aar库,但不包括proguard配置。

以上是关于运行应用程序时出现SQLCipher错误的主要内容,如果未能解决你的问题,请参考以下文章

为啥在访问二级指针时出现分段错误错误? C语言

使用 Kotlin 在片段中引用 RecyclerView 时出现空指针错误

错误3004:从行开始映射片段时出现问题

ViewPager - 将数据从片段发送到活动时出现 Android 错误 setCurrentItem(int,boolean)

为啥我尝试在真实设备中运行代码时出现以下错误?

运行程序时出现错误 PLS-00103