android-support-v4.jar isn't importing correctly in Eclipse

爱⌒轻易说出口 提交于 2019-11-30 06:40:23

Looks like it is looking for jar here :/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar

android-support-v4.jar is found in <sdk>/extras/android/compatibility/v4

Please make sure you add this as an external jar in the java build path

I could solve this problem by 1- delete "android-support-v4.jar" from lib 2- right click on the name of the project choose "Android Tools" and "Add Support Library"

If this is still not solved: Like already said, in Eclipse go to your Project Properties > Java Build Path > Libs > Add External and get the one from the adk directory.

Also set up Java 1.6 as your default compile version if you already haven't. This should solve the Override Errors you described.

It turns out that my Debug Certificate had expired so I just needed to delete ~/.android/debug.keystore and restart Eclipse and everything worked.

I realize that this question has been answered, but this is a known issue that is supposed to be fixed in the ADT-17 plugin release according to comment 9 here: http://code.google.com/p/android/issues/detail?id=21488

In addition, people who have this problem can copy the compatibility JAR to the location it says it can't find it. Clearly it's looking in the wrong place (since it's checking the Eclipse directory rather than the android-sdk directory), so the simple fix, for now, is simply to put the package where it wants to find it, even though it doesn't belong.

For me it was as simple as copying the v4 directory within C:/android-sdk/extras/android/support/ into the C:/eclipse/ directory.

I had the same problem running in Ubuntu. Go to Tools->Options. Check Force https://... to http:// Open Android SDK Manager. Check Extras->Android Support Library.

Something similar happened to me. At the top of MainActivity.java I had the next imports giving errors:

import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

In each of the lines on the left they had the light bulb making some suggestions. If you click on it, one of the options will be "Fix project setup". You then will be able to choose between several options for fixing the imports, you should choose the one that specifies the android-support-v4.jar.

Right click on ur project --> select android tools --> select add support library and simply installed the supporting libraries.

Do you try not to do Android Tools -> Add Compatibility Library, and only add the jar in java build path library?.

I use this jar library of this way and it works without any problem.

I had the same problem.

Under the project properties:Java Build Path:Order and Export tab, the box next to android-support-v4.jar wasn't checked. I checked the box, and the error went away.

Dmitri

Another caveat was running Android SDK Manager in Windows 7 without administrator privileges. It would try to install support package, but would always fail, and the actual package never got downloaded to

C:\Program Files (x86)\Android\android-sdk\extras\android\support\v4\android-support-v4.jar

Solution: Make sure that you enter the same API for "Target SDK" and "Compile with" during Android project creation (or in the Manifest file once created).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!