How to Add a Library (Android-Support-V7-Appcompat) in Intellij Idea

How do I add a library (android-support-v7-appcompat) in IntelliJ IDEA

Without Gradle (Click here for the Gradle solution)

  1. Create a support library project.

  2. Import your library project to Intellij from Eclipse project (this step only applies if you created your library in Eclipse).

  3. Right click on module and choose Open Module Settings.

  4. Setup libraries of v7 jar file
    Setup libraries of v7 jar file

  5. Setup library module of v7
    Setup library module of v7

  6. Setup app module dependency of v7 library module
    Setup app module dependency of v7 library module

how to use android.support.v7 in intellij idea

You can just refer this post.

How to add android.support.v7.widget.GridLayout into intelliJidea?

And after this I also facing the problem of compile error, after some study finally find the root cause is the Project SDK setting, in my setting I set to 4.4.2, but the version21 is not recongized by 4.4.2. After I set to 6.0 everything is fine.

Add Android Support Library to get access to AppCompatActivity

use this on your app gradle file

compile 'com.android.support:appcompat-v7:25.1.0'

How to add android.support.v7.widget.GridLayout into intelliJidea?

It's late for an answer but here it is, at least for future people looking for a solution on how to add the support library and resources for GridLayout (or ActionBarActivity / AppCompat, see below).

The easiest way is as follows.

  1. Make sure you have installed the Android Support Library, from the Android SDK Manager.
    Sample Image

  2. In IDEA: Open your project, then select File / Import Module

    • select the directory under the SDK: {SDK}\extras\android\support\v7\gridlayout
      Sample Image
    • select Import module from external model and Eclipse
    • you can then select Create module files near .classpath files, or choose to put them elsewhere if you can't / don't want to write into your SDK path
    • in the next screen you should see Select Eclipse projects to import and android-support-v7-gridlayout, IDEA will also ask you to reload the project.
    • this should add a module gridlayout [android-support-v7-gridlayout] in your project.
  3. Now you have to update your project dependencies to this module for the resources, and add the .jar libraries. Select File / Project Structure

    • select the Modules project settings, and select your project (in the picture below, testv7)
    • select the Dependencies on the right panel
    • add with the + button (on the right panel) a Module dependency... to the android-support-v7-gridlayout
      Sample Image
    • similarly, add a Jars or directories... pointing to the {SDK}\extras\android\support\v7\gridlayout\libs directory (or to the .jar within). If you intend to use the v4 as well, choose {SDK}\extras\android\support\v7\appcompat\libs instead since it contains both v4 and v7 jars
    • your settings should look like this:
      Sample Image

And now you should be fine.

For me it was the only way out of the similar problem with the ActionBarActivity, which is solved using the same technique on the {SDK}\extras\android\support\v7\appcompat module. And I did try a few other ways ;)

can not connect android-support-v7-appcompat to my project

In your project, change Android Build Target to 5.0

To support values-v21, Your Build Target should be 5.0


Go to File -> "Project Structure"

Under Platform Settings -> SDKs you can see android sdk path, classpath and build target.

Update your sdk first with latest build target using sdk manager.

If you're sdk is not up-to date then in the classpath you can see android version below 21.

If you have latest one, then You can see, classpath selected to \android-21\android.jar.

or

In you're Module Settings you can see "Build Tool Version".

Android Studio (IntelliJ IDEA) will be taking latest build version. So first update you're sdk manager to latest version.

Android support Library v7 appcompat

add this in your build.gradle(Module:app) dependencies:

compile 'com.android.support:appcompat-v7:21.0.3'

and then sync your project

it will add the library automatically

What is com.android.support:appcompat-v7:20.+ or com.android.support:leanback-v17:+? What's the relationship and difference between them?

They are both Android Support APIs from Google.

Android App Compat API:

v7 appcompat library

This library adds support for the Action Bar user interface design
pattern. This library includes support for material design user
interface implementations.

https://developer.android.com/tools/support-library/features.html#v7

Android Lean Back API:

The android.support.v17.leanback package provides APIs to support
building user interfaces on TV devices. It provides a number of
important widgets for TV apps. Some of the notable classes include:

https://developer.android.com/training/tv/start/layouts.html

https://developer.android.com/tools/support-library/features.html#v17-leanback



Related Topics



Leave a reply



Submit