Search code examples
javaandroidadt

how can i download AppCompatActivity librery for ADT


I have a problem with importing the package : "import android.support.v7.app.AppCompatActivity".. i think because i should download AppCompatActivity librery before importing it

Please, how can i download AppCompatActivity librery??

[1]: https://i.sstatic.net/mMPQs.png

Solution

  • To Setup Android Support Library :

    The Android Support Repository package is provided as a supplemental download to the Android SDK and is available through the Android SDK Manager.

    Follow the instructions below to obtain the Support Library files.

    To download the Support Library through the SDK Manager:

    1.Start the Android SDK Manager.

    2.In the SDK Manager window, scroll to the end of the Packages list, find the Extras folder and, if necessary, expand to show its contents.

    3.Select the Android Support Repository item.

    4.Click the Install packages... button.

    Then After Downloading,

    Adding Support Libraries

    In order to use a Support Library, you must modify your application's project's classpath dependencies within your development environment. You must perform this procedure for each Support Library you want to use.

    To add a Support Library to your application project:

    Make sure you have downloaded the Android Support Repository using the SDK Manager. Open the build.gradle file for your application. Add the support library to the dependencies section. For example, to add the v4 core-utils library, add the following lines:

    dependencies {
    ...
    compile "com.android.support:support-core-utils:25.3.1"
    }
    

    Then you can use your Support Library elements.