GCX-HCI / tray

a SharedPreferences replacement for Android with multiprocess support
Apache License 2.0
2.29k stars 273 forks source link

java.lang.IllegalStateException #50

Closed HandsomeL closed 8 years ago

HandsomeL commented 8 years ago

java.lang.IllegalStateException: could not access stored data with uri content://com.taobao.qianniu.tray/internal_preferences/qianniu/version. Is the provider registered in the manifest of your application? at net.grandcentrix.tray.provider.TrayProviderHelper.queryProvider(SourceFile:196) at net.grandcentrix.tray.storage.TrayStorage.getVersion(SourceFile:85) at net.grandcentrix.tray.accessor.Preference.changeVersion(SourceFile:158) at net.grandcentrix.tray.accessor.Preference.(SourceFile:52) at net.grandcentrix.tray.accessor.TrayPreference.(SourceFile:33) at net.grandcentrix.tray.TrayModulePreferences.(SourceFile:40)

MediaPad X1 7.0 11 PE-TL00M 7 Coolpad 9150W 6 HUAWEI P7-L07 6 PE-TL20 6 Che2-UL00 6 G621-TL00 5 vivo X5Pro D 5 Coolpad 8675-A 4 SM-N900

garijp commented 8 years ago

I have the same problem.

java.lang.IllegalStateException: could not access stored data with uri content://com.andcreate.app.trafficmonitor.tray/internal_preferences/tether/version. Is the provider registered in the manifest of your application? at net.grandcentrix.tray.provider.TrayProviderHelper.getInternalUri() at net.grandcentrix.tray.storage.TrayStorage.get() at net.grandcentrix.tray.accessor.Preference.changeVersion() at net.grandcentrix.tray.accessor.Preference.() at net.grandcentrix.tray.accessor.TrayPreference.() at net.grandcentrix.tray.TrayModulePreferences.() at com.andcreate.app.trafficmonitor.tray_pref.TetherTrayPreference.() at com.andcreate.app.trafficmonitor.aggregate.TrafficJournalIO.output() at com.andcreate.app.trafficmonitor.aggregate.TrafficJournalOutputService.onHandleIntent() at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:211) at android.os.HandlerThread.run(HandlerThread.java:61)

How to solve? I'm using 0.9.2 version.

passsy commented 8 years ago

Please answer the following questions:

The problem is simple: The Cursor returned from the ContentProvider is null. This can happen if the authority is not set with resValue "string", "tray__authority", "${applicationId}.tray" or if the provider returns null because the underlaying database could not be accessed.

HandsomeL commented 8 years ago

Thanks for your replication. This problem occurs in a low probability that I can not reproduce. I have set configs as requested. I think this may happen in systems that deeply transformed. I just use try & catch to prevent crash.

passsy commented 8 years ago

I checked analytics and found this crash too. This happens once in a million or to be exact: 10 times per month with 1.000.000 app sessions. And I'm sure tray preferences get accessed more than 10 times per session.

I'm not sure how this should be handled. I could catch the exception in the constructor and retry it when accessing data of a preference. But what should happen if the database could not be accessed when writing data? Maybe that's the reason why the SharedPreferences have commit() which returns a boolean if writing to disk was successful.

Exception handling is next on the list.

garijp commented 8 years ago

Thank you for reply.

Is there a way how to reproduce it?

I don't know because the fabric report.

Was it working in the past?

I began to use from 0.9.2.

Is the authority set as string resource?

Yes.

On which process does this problem occur?

Remote process.

This problem has occurred in the 800 users of 10,000users.

indywidualny commented 8 years ago

The same problem here. Remote process. Happens rarely but still...

shivakumars commented 8 years ago

I am getting the same problem and it is consistent. It occurs only on my Samsung SM-T231 running on Android 4.4.2. The same code works perfectly fine with my Nexus 5 and Samsung S3 running on Android 5.1.1 & Android 4.3 respectively. Not sure if i am doing something wrong. Can u help?

java.lang.IllegalStateException: could not access stored data with uri content://com.mockup.sample.beta.tray/internal_preferences/userPreferences/version?backup=true. Is the provider registered in the manifest of your application?

Answers to your question,

Is there a way how to reproduce it?

Every time i instantiate preference it crashes.

Was it working in the past?

It works on my Android 5.1.1 & 4.3 device

Is the authority set as string resource?

Yes

On which process does this problem occur?

Application process(UI)

I am using 1.0.0-rc3

shivakumars commented 8 years ago

Hey,

Never mind. Found the issue. The particular device is on Safe Mode. I turned off the safe mode and it started to work.

ningacoding commented 8 years ago

This happen randomly, i restarted device and Tray its working well, but this shouldn't be happening because we need stable libraries.

(Tested with: Samsung Grand Neo > Android 4.4.4 Official Rom > Tray 1.0.0-rc3 > Remote Service)

mengdd commented 8 years ago

HI, @passsy Our project suffers from this crash and we are waiting for the release 0.11.0 which has it fixed. Could I know when will it be released?

passsy commented 8 years ago

0.11.0 is released