CardView and RecyclerView (Android 5.0) - android

I have Updated SDK 5.0 (API 21)
But I am not able to find CardView and RecyclerView!
Help me. or send Link to find Both Library
Thanks in Advance.

Just add dependencies in build.gradle to add recylerview and cardview as below:
dependencies {
...
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
}
It is also present in extras/android/support/v7/ of your sdk installation path. Just import it in eclipse or in android studio.
How to import in eclipse

see the below image. from your sdk manager you will have to download the'Android Support Library'
and then in your dependencies of project you have to add
dependencies {
...
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
}

Related

cannot resolve floatinbuttonAction and snackbar

I'm very new to the android development. I imported my friend's project in my android studio and I'm having this trouble right now that I'm unable to sort out on my own. Please help me fix it.
You have to add the design support library in your build.gradle :
implementation 'com.android.support:design:25.3.1'
Package android.support.design.widget.FloatingActionButton and android.support.design.widget.Snackbar lies under design-support library. You have to add design-support library into your project.
Add below dependencies into your app modules build.gradle file and Sync .
dependencies {
............
................
compile 'com.android.support:design:25.3.1'
}
Hope this will help
FloatingActionButton and snackbar are components of design LIB
Add this in your app gradle file
compile 'com.android.support:design:23.1.1'

Android Spinner: Cannot find Symbol R.styleable.Spinner_android_dropDownSelector

I am using a custom spinner view. There were no issues while running with compile sdk 22. If I change compile sdk as 23 then run the app I am getting the following error. Below variables are removed from api 23. How can I resolve this?
error: cannot find symbol
R.styleable.Spinner_android_dropDownVerticalOffset
R.styleable.Spinner_android_dropDownSelector
R.styleable.Spinner_android_dropDownHorizontalOffset
You should update the "gradle version" and dependencies.
When we updates the SDK tools we should manually check the dependencies regarding to that SDK.
Select Project--> Righ Click-->Go To Open Module Settings-->Select dependencies--> select Library dependencies-->then check what is the current library versions are available for the your SDK--> select latest one.
if it is not working then update the gradle version also.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
}

Trouble upgrading to new com.android.support:support-v4:24.2.0 library

I have an an android app that is working correctly on 24.0.0 -- below are my gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:palette-v7:24.0.0'
compile files('libs/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
But I downloaded the most recent SDK, and am interested in upgrading to 24.2.0. Since I need the support libraries, I added com.android.support:support-v4 to the dependencies as follows:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:palette-v7:24.2.0'
compile files('libs/ksoap2-android-assembly-3.6.1-jar-with-dependencies.jar')
}
This causes the following exception:
java.lang.NullPointerException: Attempt to invoke virtual method
'android.graphics.drawable.Drawable[] android.widget.TextView.getCompoundDrawables()'
on a null object reference
at android.support.v4.widget.TextViewCompat.getCompoundDrawablesRelative(TextViewCompat.java:285)
Did I miss something in the documentation that I should do outside of including support-v4 when upgrading? This is my reference:
https://developer.android.com/topic/libraries/support-library/features.html#v4
Note: Prior to Support Library revision 24.2.0, there was a single v4 support library. That library was divided into multiple modules to improve efficiency. For backwards compatibility, if you list support-v4 in your Gradle script, your APK will include all of the v4 modules.
Thanks for your help!
I get the exact same exception after upgrading to support library revision 24.2.0 and build tools 24.0.2 when trying to inflate a layout that includes a TextInputLayout that does NOT have an EditText inside of it.
If I comment out the TextInputLayout without the EditText inside it, the exception goes away. If this is not possible, I would recommend rolling back to the previous version of the support library until this is resolved.
update your Android Sdk Build-tools to
24.0.2
and add them as buildtools in module app build.gradle
Try to clean & rebuild your project
it helps to clear previous applied dependencies from cache.
update
Try to run this app in Api24 with 7.0 emulator since your target sdk is 24
may be it will help you
but as your min sdk is 21 so this also works on that emulators too.
also follow this
Android Studio-> File -> Invalidate cache and Restart android studio
Invalidate Restart
It can be that you are wrapping something other than a
android.support.design.widget.TextInputEditText
with a
android.support.design.widget.TextInputLayout
I recently hit this problem and found the issue to be the following in the layout file
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="100dp">
</android.support.design.widget.TextInputEditText>
This was from the default google login example.
Removing this fixed the nullpointer error.

Why can't I add Facebook SDK on Android Studio?

I am following the Getting Started, Facebook Android SDK.
But when I am adding the repositories and the dependencies, I get the following error:
Error: Module version com.facebook.android:facebook-android-sdk:4.1.0 depends on libraries but is not a library itself.
I tried with several versions of the SDK but I can't make it work.
This is how my gradle looks:
dependencies{
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
repositories{
mavenCentral()
}
I am using the BuildTools 22.0.1
I hope someone can orient my with this issue.
Regards
compile 'com.facebool.android:facebook-android-sdk:4.1.0' Is the facebool correct or is that an error? If that's an error then that could be your issue. Also if you can't get it to compile from a maven source try downloading a jar and putting it in your local library. Then go into the project structure and go to the module you want to add this library to and click on the dependencies tab and there is a plus icon to add a library from file.
In you build.gradle(Project:Your-Project-Name) replace jCentral() with mavenCentral() in both (allproject/repos and buildscript/repos) then sync your gradle.
Hope this helps.

failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2

I installed ALL Extra and SDK API 21-22 including changed
compileSdkVersion 22 to 21 and buildToolsVersion '22.0.1' to 21.1.2.
I'm having Rendering Problems for API 22.
I have tried changing the version to <= 21 but I'm still getting an error.
These are the correct version that you can add in your build.gradle according to the API needs.
API 24:
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:recyclerview-v7:24.2.1'
API 25:
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
API 26:
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
API 27:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
In order to make that working I had to set:
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
compile ("com.android.support:design:22.2.0")
Documentation states something different (docs):
com.android.support:support-design:22.0.0
Real path for Support Repository Libraries:
You should download Support Repository Libraries.
If the problem still exists:
Go to the real path of your Support Repository Libraries and check that the following folder exists:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support"
In that folder there are support libraries that can't be found.
for example:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7"
Open folder appcompat-v7 and you see folders with all available version. You should use only one of these versions in the build.gradle file dependencies or use +, for ex. 18.0.+
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
That is the path taken from grade.build dependencies file:
com.android.support:appcompat-v7:18.0.0
Refer to the real path on your HDD -->
ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7\18.0.0
If there is no such folder, you will receive the error:
"failed to resolve com.android.support:appcompat-v7:18.0.0"
p.s. If you have Windows x64, when installing sdk and jdk, make sure that the installation path does not have Program Files(86). Brackets that add Windows may cause additional problems with resolving paths for your project. Use simple paths for your installation folder.
For example:
c:\androidSDK\
Failed to find: com.android.support:appcompat-v7:22.0.0
The "I literally tried everything else" answer:
This problem will also occur if you don't have an upto date Android Support Library and Android Support Repository. Just install using the SDK manager.
Along with other provided solutions, make sure to have the following within project/build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
in support libraries you always need to add three numbers as version number
Suppose for 22 -> you need to write it as 22.0.0, not just 22
for 22.1 -> 22.1.0
So your dependencies should look like this
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
I Programmers language you need to pad extra zeros.
Hope this solves your problem
i solve it
change 22.0.0 to 21.0.3
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:21.0.3' }
maybe i have download the com.android.support:appcompat-v7:21.0.3 but have not got the compile 'com.android.support:appcompat-v7:22.0.0'
when i use SDK Manager update my support library and support repository , the problem dismissed.
NOTE1: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
NOTE2: Support library should not use a different version than the compileSdkVersion
For API 28 you can use:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0-alpha1
https://mvnrepository.com/artifact/com.android.support/recyclerview-v7/28.0.0-alpha1
All support libraries: https://mvnrepository.com/artifact/com.android.support
It is easier to use "+" sign in the version number. For example
compile 'com.android.support:support-v4:22.0.+'
compile "com.android.support:appcompat-v7:22.0.+"
In this case you won't have to change versions for the same API number
Go to Messages Gradle Sync, and Click on Install Repository and sync project. This is will install needed file in Android SDK and after syncing you will be able to create gradle or run your project.
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Are you import them? Like this:
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
paste the above code in your app gradle.
and while setting up the project select empty activity instead of blank activity.
Fixed my issue by changing these
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
to
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
that means your target SDK version should be same as version of cardView and recyclerView and other google libraries.
targetSdkVersion 23
Tools > Android > SDK Manager
Select all of the packages that are not up to date and update them.
I had such dependancy in build.gradle -
compile 'com.android.support:recyclerview-v7:+'
But it causes unstable builds. Ensure it works ok for you, and look in your android sdk manager for current version of support lib available, and replace this dependency with
def final RECYCLER_VIEW_VER = '23.1.1'
compile "com.android.support:recyclerview-v7:${RECYCLER_VIEW_VER}"
I solved the problem updating all packages from Android SDK Manager and also, I had to install Extras -> Android Support Repository.

Categories

Resources