A cryptography library and a SharedPreferences wrapper for Android that encrypts the content with 256 bit AES encryption. The Encryption key is securely stored in device's KeyStore.
562
stars
97
forks
source link
App Crashed in lollipop OS version with error "java.lang.IllegalStateException: Must call init() before using the store" #31
First of all thank you for sharing this awesome library.
My app perfectly working in other OS versions. Tested on Marshmallow Nougat working fine.
Here's the full stack trace for crash.
06-13 12:20:51.745 7726-7726/my.com.abc.app E/AndroidRuntime: FATAL EXCEPTION: main Process: my.com.abc.app, PID: 7726 java.lang.RuntimeException: Unable to start activity ComponentInfo{my.com.abc.app/my.com.abc.app.activities.LoginActivity}: java.lang.IllegalStateException: Must call init() before using the store at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.IllegalStateException: Must call init() before using the store at devliving.online.securedpreferencestore.SecuredPreferenceStore.getSharedInstance(SecuredPreferenceStore.java:58) at my.com.abc.app.activities.LoginActivity.initialization(LoginActivity.java:93) at my.com.abc.app.activities.LoginActivity.onCreate(LoginActivity.java:84) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I have use init method in Application like bellow.
`public class Global extends Application {
@Override
public void onCreate() {
Stetho.initializeWithDefaults(this);
try {
SecuredPreferenceStore.init(getApplicationContext(), new DefaultRecoveryHandler());
} catch (Exception e) {
//TODO: handel get
e.printStackTrace();
}
super.onCreate();
}
First of all thank you for sharing this awesome library. My app perfectly working in other OS versions. Tested on Marshmallow Nougat working fine. Here's the full stack trace for crash.
06-13 12:20:51.745 7726-7726/my.com.abc.app E/AndroidRuntime: FATAL EXCEPTION: main Process: my.com.abc.app, PID: 7726 java.lang.RuntimeException: Unable to start activity ComponentInfo{my.com.abc.app/my.com.abc.app.activities.LoginActivity}: java.lang.IllegalStateException: Must call init() before using the store at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.IllegalStateException: Must call init() before using the store at devliving.online.securedpreferencestore.SecuredPreferenceStore.getSharedInstance(SecuredPreferenceStore.java:58) at my.com.abc.app.activities.LoginActivity.initialization(LoginActivity.java:93) at my.com.abc.app.activities.LoginActivity.onCreate(LoginActivity.java:84) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I have use init method in Application like bellow.
`public class Global extends Application {
}`