简体   繁体   中英

Error in xml layout:The following classes could not be found: - android.support.v4.view.Viewpager

My android.support.v4.jar is in my libs folder and in my android private libraries also.

But I got a problem appearing over top of my my xml layout saying- "The following classes could not be found: - android.support.v4.view.Viewpager."

I'm not sure whats wrong please help! I've searched around many forums and nothing seems to be working. The same problem occured when I tried integrating admod into my application it said, on the xml layout, The following classes could not be found: - android.support.v4.ads.AdRequest. I have a hunch it has to do with my jar being in the wrong spot..

hey i've fixed this by converting the ViewPager from "android.support.v4.view.Viewpager" to "androidx.viewpager.widget.ViewPager".

to do that you just have to open up the .xml file > design and then right click on that ViewPager > Convert view as shown the next picture

在此处输入图片说明

then you just type viewPager and the search bar will auto complete that.. thats all of it.

在此处输入图片说明

Hope this fix the issue like it did to me.

您必须使用此库引用您的项目。

  • Make sure you have downloaded the Android Support Library using the SDK Manager.
  • Create a libs/ directory in the root of your application project.
  • Copy the JAR file from your Android SDK installation directory (eg, /extras/android/support/v4/android-support-v4.jar) into your application's project libs/ directory.
  • Right click the JAR file and select Build Path > Add to Build Path.

http://developer.android.com/tools/support-library/setup.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM