I am trying to use ehCache in Android, and getting the following error
java.lang.ExceptionInInitializerError
at net.sf.ehcache.EhcacheDefaultClassLoader.
Ehcache is not able to locate the ehcach.xml file. It has no idea about res/xml folder.
So try to configure your cache programmatically in this way (ehcache 2.10):
// create default CacheManager
Configuration config = new Configuration();
config.setName("Mngmt");
// [...]
CacheManager cacheManager = CacheManager.create(config);
int maxEntriesLocalHeap = 100;
String cachName = "cacheName";
Cache cache = new Cache(
new CacheConfiguration(cachName, maxEntriesLocalHeap)
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
.eternal(false)
.timeToLiveSeconds(120)
.timeToIdleSeconds(60)
.diskExpiryThreadIntervalSeconds(0));
cacheManager.addCache(cache);
More Information you will find here: Creating Caches Programmatically