Benoit Benoit - 1 year ago 818
Android Question

import failed

I want to use DiskLruCache in my project as explained in Caching Bitmaps, but cannot import the correct lib.

Where can I find the jar containing this class ?

As suggested in similar questions, I added the following line to my


dependencies {
compile 'org.robovm:robovm-rt:+'

Gradle seems to find the lib, but my code still does not compile :

package com.example ;

import android.util.LruCache;


public class ObjectCache {

private LruCache<String, String> memoryCache;
private DiskLruCache diskLruCache ;

public ObjectCache(int cacheSize) {
memoryCache = new LruCache<String, String>(cacheSize);
diskLruCache = null ;

It fails with following errors :

Error:(5, 18) error: package does not exist
Error:(10, 13) error: cannot find symbol class DiskLruCache

Answer Source

When you use '+' (plus sign), it appears that gradle uses the latest available version of the lib. In this case, it is 1.14.0. But DiskLruCache is no more present in this version.

Moreover between version 0.2 and 1.0.0, it was moved from package to package


It all depends on what version of robovm you user :

  • 0.0.2 or 0.0.4 : import
  • 1.0.0 to 1.13.0 : import
  • 1.14.0 to ... : (no more DiskLruCache)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download