Since the last update for android support libraries, I am having issues with importing LruCache. Eclipse, and now even android studio, keep saying that package android.support.v4.util does not exist.
I am using actionbarsherlock and it has included android support v4 and shows no errors. My application was working fine before this last SDK update. What has changed? How do I fix this?
Here is the error that shows:
java: /Users/amit/App/src/com/app/EMCache.java:5: package android.support.v4.util does not exist
java: /Users/amit/App/src/com/app/EMCache.java:9: cannot find symbol
symbol : class LruCache
location: class com.app.EMCache
java: /Users/amit/App/src/com/app/EMCache.java:20: cannot find symbol
symbol : class LruCache
location: class com.app.EMCache
Go to your Android SDK's directory and:
jar tvf ./extras/android/support/v13/android-support-v13.jar |grep v4.*util
And within this jar file you can see one of the classes (under v4/util) you have used in your applications.
So the error "package android.support.v4.util does not exist" simply means you have to copy the above jar file to your libs subdirectory and recompile.
For those importing the support libraries using gradle like this:
Remember to remove this all*.exclude module: 'support-v4' from configurations
...might have been a dummy mistake from my part though :)
In my case the problem was referencing the jar from sdk installation folder, copying the jar to project's libs folder adding to build path actually resolved the issue.
craned's answer:
worked for me. But (in my case at least) the '19' should match the compileSdkVersion
In my case, the solution was eventually found as documented here:
<sdk>/extras/android/support/v4/android-support-v4.jar
) into your application's project libs/ directory.In my case with Android Studio, this error appeared in the middle of a working project and refused to disappear despite much fooling around. I finally forced a Gradle Sync operation by adding a single space character to a Gradle file. The Gradle Sync fixed it instantly.