Want to use ViewPager, cannot get android.support.* to be recognized?

偶尔善良 提交于 2019-12-09 03:34:42

问题


EDIT Sorry about all the pictures. I tried to give you the best idea of where I am at.

I am trying to get ViewPager working on my application, but it will not recognize the Support Library that I downloaded in the SDK manager.

I am coding for SDK Version 10. This is a screen shot of my SDK Manager:

After installing the Android Support Library and the most recent Tools, I went to Help >> Check for Updates. After running this I receive the two pop ups shown below.

The Problem Occured pop up says that it can't find a repository at that site. I installed the Sequoyah Natice Code Support when I first started developing this application but have never used it. I tried to re-install the package to get rid of this pop-up but it will not let me as it is already installed.

In my code I get an error when trying to import android.support.v4.view.ViewPager;. The screen shot is below. When I hover my cursor over the import line, it says The import android.support.v4 cannot be resolved.


回答1:


To add the Android Support Library to an existing Android Project:

  • Right click on your project
  • Click Android Tools
  • Click Add Support Library

That should take care of setting up the android-support jar so it can be used by the project.




回答2:


For Android Studio 1.2.2

  • Right click on your project from the file hierarchy (should say "app")
  • Select "Open Module Settings" from the menu
  • Click on the "Dependencies" tab
  • Click the plus button at the bottom
  • Select "Library dependency"
  • Search/Choose your desired support library
  • Click OK


来源:https://stackoverflow.com/questions/14218519/want-to-use-viewpager-cannot-get-android-support-to-be-recognized

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