dora
dora

Reputation: 2077

ClassNotFoundException: android.support.v4.View.ViewPager

Iam using ActionBarActivity in my app, which has minSdk as 8. i have imported the " android-sdk\extras\android\support\v7\appcompat " project as "Existing Android Code Into Workspace" into my workspace and then added it as library project to my app. The first layout i try to inflate in my app is

<android.support.v4.View.ViewPager 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pager" >
</android.support.v4.View.ViewPager>

But i keep getting the error displayed in the title. So, i have tried to add both the following jars again in libs folder in my app (even though IMHO, it need not be added as they are already there in the library project)

but there is no use.i have checked both of them in configure-build-path and put them in top.but still there is no use.

Note: i have done the following checks already

  1. i have checked in the library project that i have imported to see if both jars are added to build path and checked and put at top( in "order and export" tab).and yes they are perfectly done.

  2. i have restarted eclipse and cleaned my project several times over and over again.

    so please can anyone tell me what i am still missing and should do..

Upvotes: 1

Views: 5868

Answers (3)

Gilberto Ibarra
Gilberto Ibarra

Reputation: 2927

Delete android-support-v4 from the forder 'libs' in your project, this crash with the support in the viewpager...

and Import the support library v4 like this.

1-Right click on your project Properties 2.Click Libraries 3. Add External Jars , and add android-support-v4 jar...

Make you sure that in order and Export have selected Android Private Libraries, and in some cases , select android-support-v4.jar after you add the external jar..

and select android-support-v7-appcompat.jar

Upvotes: 0

ramaral
ramaral

Reputation: 6179

Change android.support.v4.View.ViewPager to android.support.v4.view.ViewPager

Upvotes: 4

znat
znat

Reputation: 13474

To import the support library, remove any support library you have imported first. Then:

  1. Right click on your project
  2. choose Android tools
  3. Select add support library.

Upvotes: 3

Related Questions