user1634451
user1634451

Reputation: 5212

ViewPager.PageTransformer cannot be resolved to a type

I am getting ViewPager.PageTransformer cannot be resolved to a type I have updated the sdk to the latest and have the latest version of android-support-v4 in my libs folder and i read this post ViewPager.PageTransformer showing error ViewPager cant rersolved to a type i am using androidsupportv4 jar revision 9 and did the same steps but it didn't work.

Upvotes: 7

Views: 8019

Answers (6)

Jeeri
Jeeri

Reputation: 504

  1. Update your android support library from sdk manager.
  2. Copy the android-support-v4.jar from \sdk\extras\android\support\v4 to your project's libs folder.
  3. import android.support.v4.view.ViewPager.PageTransformer
  4. Change ZoomOutPageTransformer implements ViewPager.PageTransformer to ZoomOutPageTransformer implements PageTransformer.

Thats it all errors will be gone and the animation works really well.

Upvotes: 0

user1634451
user1634451

Reputation: 5212

Realized I never answered this question. To solve this I grabbed the android-support-v4 from another computer and it worked. This could have the same effect as uninstalling and re-installing but i didn't try it.

Upvotes: 2

codeFood
codeFood

Reputation: 1251

You will need to get the Version 18 of the Android Support Library. Make sure to update to that version using the SDK manager and then copy "android-support-v4.jar" and "android-support-v13.jar" to "libs" folders of your project.

That should take care of the issue.

Upvotes: 0

Hesam
Hesam

Reputation: 53600

Okay, I found the solution. You need to update your Android Support Library package. But if you have it now you need to uninstall it first then install it again in order to get new one.

If you have IntellijIdea:

  1. Open SDK Manager window from "Tools/Android/SDK Manager"
  2. Find Exteras folder then check Android support library. If its status is installed click "Delete 1 package..." in order to delete it.
  3. Check this package and click on install button.
  4. Navigate to \extras\android\support\v4 then copy android-support-v4.jar and paste it into your Libs folder.
  5. Idea should recompile the project automatically, however if it didn't do that then you should recompile it manually by click on "Build/Rebuild Project"

That's it ;)

Upvotes: 7

ivan.mylyanyk
ivan.mylyanyk

Reputation: 2101

You should remove ViewPager. from the begginging of declaration.

So, that would looks like just PageTransformer

Plus, import android.support.v4.view.ViewPager.PageTransformer;

that worked perfect for me.

Upvotes: 10

Jay Snayder
Jay Snayder

Reputation: 4338

At one point I had also found myself with the same issue. Apparently it is because whenever I decide to launch the Android SDK Manager within Eclipse I had been excluding an important step in the update process.

I always 'uncheck' the 'installed' option when trying to update. It was always my assumption that since the other checkmark labelled 'new/updates' would keep the updates visible to the installation. This actually is not the case though. Once I left 'installed' check-marked I saw updates from previously installed components. Then I was able to install the missing features that I thought were already up-to-date on my computer.

Hopefully, you find this helpful for getting the latest. It was misleading to me.

--Edit--

After getting the latest however, the post you referenced was what ended up resolving the issue for me however. I did not find a quick efficient way to sync with the latest version of the compatibility library. It is probably because on creation of the application it copies int he latest version locally into a project. So, you have to manually copy over the latest compatibility library.

Be sure to copy over the latest compatibility library however to all other supporting Android libraries that it also depends on as well. Otherwise you will get build errors with the new compatibility library in you local project settings.

Upvotes: 0

Related Questions