I am trying to run the code provided HERE
I downloaded the code from their Github and imported into Android SDK, but it shows error at the lines
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
in multiple files. However if I check the Android SDK Manager, the Android Support Library
as well as the Android Support Repository
in the Extras folder are both installed. I can also see the support folder and it's contents in the SDK_INSTALL\sdk\extras\android\support
directory. It also has the v4 folder which also contains the android-support-v4.jar
and the src
folder. THen why is it still showing the error, how do I resolve it and how do I get that sample code running? THe sample code is for an RSS reader app, if that's relevant.
I have resolved it by deleting
android-support-v4.jar
from my Project. Becauseappcompat_v7
already have a copy of it.If you have already import appcompat_v7 but still the problem doesn't solve. then try it.
I followed the instructions above by Gene in Android Studio 1.5.1 but it added this to my build.gradle file:
so I changed it to:
And it started working.
Another way to solve the issue.
If you are using support library you need to add the compat lib to the project. This link shows how to add the support lib to your project
Assuming you have added the support lib earlier but you are getting the mentioned issue, you can follow below steps to fix that.
1- Right click on the project and navigate to Build Path->Configure Build Path
2- On left side of the pop up windowd select Android. You will see an image as like this:
3- You can notice that no libaray is referenced at the momonet. Now click on the add button shown at the bottom-right side. You will see a pop up windows as shown below.
4- Select the appcompat lib and press ok. (note: the lib will be shown if you have added them as mentioned earlier). Now you will see the following window.
5- Press ok. Thats it. The lib is added to your project (notice the red mark) and the errors relating inclusion of support lib must go now.