Hi all,
I've experienced a strange issue running applications on the HTC
Desire.
When I call getApplicationContext().getCacheDir() or
getApplicationContext().getFilesDir() from my activity this always
returns null. In the emulator /data/data/com.myapp.android/cache
respectively /data/data/com.myapp.android/files is returned.
Because of that I'm not able to use the webview class as it tries to
create cache files and crashes with a null pointer exception. The
logs:
10-23 12:24:38.055: ERROR/Database(16692): sqlite3_open_v2("/data/data/
com.myapp.android/databases/webview.db", &handle, 6, NULL) failed
10-23 12:24:38.055: ERROR/Database(16692): sqlite3_open_v2("/data/data/
com.myapp.android/databases/webviewCache.db", &handle, 6, NULL) failed
10-23 12:24:38.545: WARN/cache(16692): Unable to create webviewCache
directory
10-23 12:24:38.665: ERROR/webviewdatabase(16692): Exception:
java.lang.NullPointerException
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): FATAL EXCEPTION:
WebViewWorkerThread
10-23 12:24:41.555: ERROR/AndroidRuntime(16692):
java.lang.NullPointerException
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): at
android.webkit.WebViewDatabase.getCacheTotalSize(WebViewDatabase.java:
793)
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): at
android.webkit.CacheManager.trimCacheIfNeeded(CacheManager.java:548)
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): at
android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:190)
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): at
android.os.Handler.dispatchMessage(Handler.java:99)
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): at
android.os.Looper.loop(Looper.java:144)
10-23 12:24:41.555: ERROR/AndroidRuntime(16692): at
android.os.HandlerThread.run(HandlerThread.java:60)
10-23 12:24:41.575: WARN/ActivityManager(92): Force finishing
activity com.myapp.android/.StockDetailActivity
I noticed that other apps have issues as well. For example the google
finance app logs the following message:
10-23 12:18:59.415: ERROR/ApplicationContext(16073): Couldn't rename
file /data/data/com.google.android.apps.finance/shared_prefs/
com.google.android.apps.finance_preferences.xml to backup file /data/
data/com.google.android.apps.finance/shared_prefs/
com.google.android.apps.finance_preferences.xml.bak
Why I cannot create folders in this directory?
Is there a possibility to set the fileDir and cacheDir paths to the sd
card or somewhere else?
I looked at some classes like Context, Webview and CacheManager but I
could not find a way to change it.
Do I need to set a permission to create cache files?
Thank you for your help!
Kind regards,
Dominik
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en