I add android.support.v7.appcompat library in my project but I am not able to use this library class and methods in it. I have done it again and again but same problem exist any one please help me.
try adding this in your app gradle dependencies:
compile 'com.android.support:appcompat-v7:22.2.0'
for the design compile this:
compile 'com.android.support:design:22.2.0'
Related
About Android support library, since 25.0.1 has some bugs, so I want to use 7.24.1,
here's some of my gradle codes
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
But I find the project still refers the latest version; the version number "v7:24.2.1" does not work.
I want use 7:24.2.1, but when I click any Android support class, such as RecyclerView, it opens source code from sdk\extras\android\m2repository\com\android\support\recyclerview-v7\25.0.0\recyclerview-v7-25.0.0-sources.jar
Clean Project will do the trick. Furthermore consider to change compileSdkVersionto24 and also install Android SDK Build-tools in Android SDK Manager.
As the latest version of the support library according to the support library changelog is v7:25.0.1 and not v7:24.2.1 modify your build.gradle to have v7:25.0.1:
compile "com.android.support:appcompat-v7:25.0.1"
However, if you really need v7:24.2.1 then simply put:
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
You dont have to put the rest. They are already included as stated by cricket_007.
It turns out one of the depencencies include the android suppoert library25.0.0,
I solve it by downgrading the depencency library
I tried replacing a local jar of the android-support-v13 library with a maven dependency like this
compile files('libs/android-support-v13.jar')
replaced with
compile 'com.android.support:support-v13:21.0.0'
However, when I try to compile this import fails
import android.support.v4.graphics.drawable.DrawableWrapper;
Has this class been removed from the support library?
Try:'compile com.android.support:support-v13:24.2.0'
Version 21 of support library is quite old and so may not contain the needed class.
I forgot to include this in Gradle -
compile 'com.android.support:recyclerview-v7:23.+'
But my project works fine without this record.
So, why do I need to write it in Gradle?
Can I use only appcompat?
compile 'com.android.support:appcompat-v7:23.2.0'
com.android.support:appcompat-v7 does not depend on com.android.support:recyclerview-v7, but com.android.support:design does.
There's no harm in including this dependency one more time in your build.gradle, but it's not necessary since design includes it.
While importing support library in app gradle settings, what is the optimal configuration. For example-
If I just import support library like this:
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
I find that the app works fine even if I just add appcompat code and do not add any recycler view import. I would like to know in what scenario will it be necessary?
I have searched the internet but i couldn't find my answer. How can I use Card view/Recycle view they are not in my layout palette or i can't use them manually and I am using eclipse
The CardView and RecycleView are not by default in the AppCompat library. You should include the CardView and RecycleView libraries manual to your project.
Reference: https://developer.android.com/training/material/lists-cards.html#Dependencies
Gradle (using Android Studio):
dependencies {
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
}
In the layout palette there is a section called "Custom" click on the "CustomView" and you shall see all the imported views from the dependencies added in the gradle file.
my problem when adding the library was the same as this guys problem
Unable to add library to android project
so I fixed it.