package android.support.v4.util does not exist

2019-02-02 21:58发布

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

9条回答
不美不萌又怎样
2楼-- · 2019-02-02 22:46

In my case I was porting an Android Googlemaps app API1 to API2, and after many hours I realized I was not adding

C:\Program Files\..(your_path_)..
  ..\adt-bundle-windows-x86_64\sdk\extras\android\support\v4

to External Libraries..

Hope this helps

查看更多
乱世女痞
3楼-- · 2019-02-02 22:47

If you're using Gradle, I had to also add this line to the dependencies section of my inner build.gradle, the file where you specify your minSdkVersion and targetSdkVersion:

dependencies {
  compile "com.android.support:support-v4:19.0.+"
}

I believe the '19' is supposed to be whatever your compileSdkVersion. If I'm wrong, it will tell you what it's supposed to be.

查看更多
可以哭但决不认输i
4楼-- · 2019-02-02 22:47

add dependency

dependencies { compile 'com.android.support:support-v4:+'}

Change Build Tool

 dependencies {  classpath 'com.android.tools.build:gradle:2.3.0'}

Worked for me.

查看更多
登录 后发表回答