sqlcipher / sqlcipher-android-tests

A collection of tests that can be run on an emulator or device to verify SQLCipher for Android.
Other
94 stars 65 forks source link

Unable to run test suite, if you change the minSdkVersion as 15 #29

Closed ashishdimi09 closed 5 years ago

ashishdimi09 commented 5 years ago

Hi @developernotes

As per your suggestion, I have just modify the minSdkVersion setting (API Level 15) within build.gradle but getting below failed build error

Task :app:processDebugManifest FAILED C:\Users\Downloads\sqlcipher-android-tests-master\app\src\main\AndroidManifest.xml Error: uses-sdk:minSdkVersion 15 cannot be smaller than version 26 declared in library [:android-database-sqlcipher-4.0.1-debug:] C:\Users.gradle\caches\transforms-1\files-1.1\android-database-sqlcipher-4.0.1-debug.aar\070d772ead12d02f9e2288e7d976f857\AndroidManifest.xml as the library might be using APIs not available in 15 Suggestion: use a compatible library with a minSdk of at most 15, or increase this project's minSdk version to at least 26, or use tools:overrideLibrary="net.sqlcipher" to force usage (may lead to runtime failures)

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:processDebugManifest'.

    Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 26 declared in library [:android-database-sqlcipher-4.0.1-debug:] C:\Users.gradle\caches\transforms-1\files-1.1\android-database-sqlcipher-4.0.1-debug.aar\070d772ead12d02f9e2288e7d976f857\AndroidManifest.xml as the library might be using APIs not available in 15 Suggestion: use a compatible library with a minSdk of at most 15, or increase this project's minSdk version to at least 26, or use tools:overrideLibrary="net.sqlcipher" to force usage (may lead to runtime failures)

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s 11 actionable tasks: 1 executed, 10 up-to-date

Then i tried to add below code in android manifest and its works <uses-sdk tools:overrideLibrary="net.sqlcipher"/>

But while running its crashed in Moto G(2nd Generation/ Android Marshmallow 6.0)

--------- beginning of crash 2019-03-12 18:01:56.021 21967-21967/net.zetetic.sqlcipher.test E/AndroidRuntime: FATAL EXCEPTION: main Process: net.zetetic.sqlcipher.test, PID: 21967 java.lang.IllegalStateException: attempt to re-open an already-closed object: net.sqlcipher.database.SQLiteQuery (mSql = SELECT * FROM t1;) at net.sqlcipher.database.SQLiteClosable.acquireReference(SQLiteClosable.java:35) at net.sqlcipher.database.SQLiteQuery.fillWindow(SQLiteQuery.java:74) at net.sqlcipher.database.SQLiteCursor.fillWindow(SQLiteCursor.java:324) at net.sqlcipher.database.SQLiteCursor.onMove(SQLiteCursor.java:283) at net.sqlcipher.AbstractCursor.moveToPosition(AbstractCursor.java:195) at android.database.CursorWrapper.moveToPosition(CursorWrapper.java:197) at android.widget.CursorAdapter.getView(CursorAdapter.java:280) at android.widget.AbsListView.obtainView(AbsListView.java:2365) at android.widget.ListView.makeAndAddView(ListView.java:2052) at android.widget.ListView.fillSpecific(ListView.java:1482) at android.widget.ListView.layoutChildren(ListView.java:1803) at android.widget.AbsListView.onLayout(AbsListView.java:2164) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:498) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:761) at android.view.View.layout(View.java:19659) at android.view.ViewGroup.layout(ViewGroup.java:6075) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:658) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 2019-03-12 18:01:56.030 769-3657/? W/ActivityManager: Force finishing activity net.zetetic.sqlcipher.test/net.zetetic.activities.TestRunnerSelectionActivity

Can please suggest how can we run test suite for Android v4.4.4 (API level 19) or v7.0 (API level 24) as in SQLCipher's test suite project having minSdkVersion 26?

developernotes commented 5 years ago

Hi @ashishdimi09

The reason you are seeing this is that SQLCipher for Android is moving to a minimum Android SDK requirement per deployment requirements Google Play has put in place. You can read more about the details of this here.

You can still use the test suite however by modifying the build.gradle file to use a remote version of the SQLCipher for Android AAR package versioned at 4.0.1 and adjust your minSdkVersion to a lower level. You will need to comment out the tests such as CreateOpenDatabaseWithByteArrayTest which have been recently added and are not supported in 4.0.1.

ashishdimi09 commented 5 years ago

Hi @developernotes

I have commented the tests such as CreateOpenDatabaseWithByteArrayTest but now getting below error

Logs: https://gist.github.com/ashishdimi09/c2821d52779d4bb031fc54a461ee0692

--------- beginning of main 03-14 17:06:21.561 1799-1809/? V/MotorolaSettingsProvider: getSecureSetting(aov_google_now_component_name, 0) 03-14 17:06:21.562 1799-2984/? I/ActivityManager: START u0 {cmp=net.zetetic.sqlcipher.test/net.zetetic.activities.TestScrollingCursorActivity} from uid 11698 on display 0 03-14 17:06:21.756 3513-3513/net.zetetic.sqlcipher.test D/AndroidRuntime: Shutting down VM --------- beginning of crash 03-14 17:06:21.767 3513-3513/net.zetetic.sqlcipher.test E/AndroidRuntime: FATAL EXCEPTION: main Process: net.zetetic.sqlcipher.test, PID: 3513 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memcpy4" referenced by "/data/app/net.zetetic.sqlcipher.test-1/lib/arm/libsqlcipher.so"... at java.lang.Runtime.loadLibrary(Runtime.java:372) at java.lang.System.loadLibrary(System.java:1076) at net.sqlcipher.database.SQLiteDatabase$1.loadLibraries(SQLiteDatabase.java:223) at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:240) at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:219) at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:212) at net.zetetic.activities.TestScrollingCursorActivity.initializeEnvironment(TestScrollingCursorActivity.java:96) at net.zetetic.activities.TestScrollingCursorActivity.onCreate(TestScrollingCursorActivity.java:48) at android.app.Activity.performCreate(Activity.java:6245) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 03-14 17:06:21.769 1799-6890/? W/ActivityManager: Force finishing activity net.zetetic.sqlcipher.test/net.zetetic.activities.TestScrollingCursorActivity 03-14 17:06:21.775 1799-6890/? W/ActivityManager: Force finishing activity net.zetetic.sqlcipher.test/net.zetetic.activities.TestRunnerSelectionActivity

developernotes commented 5 years ago

Hi @ashishdimi09

Is that from running the test suite on device, or within an emulator? Can you verify that you are able to run the test suite on an emulator first if you haven't tried that?

ashishdimi09 commented 5 years ago

Hi @developernotes

I have tested the same project with another device LG Nexus 5x (Android 8.1.0), it's working fine but getting above error in Moto G(2nd Generation/ Android Marshmallow 6.0) :(

developernotes commented 5 years ago

Hi @ashishdimi09

We have just released a new build of SQLCipher for Android 4.1.1 (release details here). The new minimum SDK version for the library will be 21.

ashishdimi09 commented 5 years ago

Hi @developernotes

Thanks, Nick! I have checked the dashboards for android distribution, KitKat (API 19) itself taking 7.6% active devices. We will lose a lot of active users for using the new SQLCipher 4.1.1.

Why did you decide to set minSdkVersion to API21? https://github.com/sqlcipher/android-database-sqlcipher/issues/432#issuecomment-474749729

developernotes commented 5 years ago

Hi @ashishdimi09

We recently released SQLCipher for Android 4.1.2 which adjusts our API support back down to 14 for 32-bit CPU's. Would you give that a try and let us know your results? Thanks!

ashishdimi09 commented 5 years ago

Hi

I have tried to test the updated test suite (with SQLCipher v4.1.3), not faced any crash or issue but its failed for Java Client Library Version Test, Is it okay?

Behaviour Test Suite.txt And Run Reverse scroll Cursor Suite.txt

(image

developernotes commented 5 years ago

Hello @ashishdimi09

Would you pull down the latest from the test suite and try again? It now references 4.1.3 directly which should address what you are seeing.

stale[bot] commented 5 years ago

Hello, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug", "enhancement", or "security" and I will leave it open. Thank you for your contributions.

ashishdimi09 commented 5 years ago

Hi @developernotes

It's working for me so I am closing this ticket. Thank you!

developernotes commented 5 years ago

Hi @ashishdimi09

Great, we are happy to hear everything is working. Take care!