There is no AppCompatActivity
class in the android-support-v7-appcompat library. Where to download with class AppCompatActivity
?
I look at the library in% AndroidSDK% / extras / android / support / v7 / appcompat / libs
Answer 1, authority 100%
To add support for the AppCompat library, at the stage of creating a new project on the screen of the Configure Activity wizard, select the Backwards compatibility (AppCompat) checkbox – backward compatibility:
If for some reason it was not possible to do this, then support for the library can be added later.
Via wizard:
File – & gt; Project Structure or CTRL + ALT + SHIFT + S or toolbar icon
Next, select your module (number 1 in the screenshot), click the Dependences tab (number 2 in the screenshot), then + (plus) in the upper right corner (number 3 in the screenshot) and there in drop-down list 1.Library Dependency (number 4 on the screen)
the library search dialog will appear, where in the search line we write what we want to add to the dependency (appcompat), then press Enter on the keyboard to start the search, select the desired library in the window below and press OK , to close the dialog and apply the changes, then OK of the Project Structure
wizard
Synchronization will take place and the library will be connected.
You can also add manually:
In the project tree, open the build.gradle file of the project module and write the dependency in the dependencies section:
dependencies {
implementation 'com.android.support:appcompat-v7:27.0.2'
}
where 27.0.2 is the version of the library, it usually corresponds to the latest current one (see version here ). An inscription-link Sync Now will appear in the upper right corner, click on it to synchronize the project