Android Studio Can't resolve fragmentActivity and ViewPager imports

后端 未结 5 1637
野性不改
野性不改 2021-01-13 10:11

I follow the tutorial of developing swipe-able tabs. When I import:

import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;         


        
相关标签:
5条回答
  • 2021-01-13 10:20
    1. Click on File, then select Project Structure
    2. Choose Modules "app"
    3. Click "Dependencies" tab
    4. Click on the + sign, choose Library Dependencies
    5. Select support-v4 or other libraries as needed
    6. OK
    0 讨论(0)
  • 2021-01-13 10:27

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

    Right click on your project Select Android Tools Select Add Support Library.

    Usually even after you add through SDK manager,you have to individually add in this process.This will set up the jar files needed.

    0 讨论(0)
  • 2021-01-13 10:32

    I have solved it. I installed everything but I did not import the external library into my library. It was not installed automatically during creation of the new project. So I just opened the project structure and imported the dependencies -> add support-v4 library.

    Btw, thanks you guys for helping me a lot and posting the suggestion to me.

    0 讨论(0)
  • 2021-01-13 10:36
    1. Make sure you have downloaded the Android Support Repository using the SDK Manager.
    2. Open the build.gradle file for your application.
    3. Add the support library to the dependencies section. For example, to add the v4 support library, add the following lines:

      dependencies { ... compile "com.android.support:support-v4:18.0.+" }

    0 讨论(0)
  • 2021-01-13 10:38

    If you had installed all tools and configed it, Try to do like this in your IDE menu : Build-> Clean Project

    0 讨论(0)
提交回复
热议问题