Recyclerview issue in Android Nougat upgrade - android

My app is compilesdkversion is 23 i have to upgrade to 24 and all support libraries to 24 while upgrading the recyclerview in the app is not displaying views in a module. is there a particular change log for the issue, Suggest a solution Thanks in advance
Due to security reason i cant give my entire gradle file
/* android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "xxxxxxx"
minSdkVersion 16
targetSdkVersion 23
......
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'*/

You need to set the layout_height to "wrap_content" for the recyclerview items.I got the same problem,the mentioned solution resolved the issue.

Related

Please explain gradle dependancies vs min build sdk

Android beginner here...
I'm getting all sort of rendering errors, and eventually concluded it's got something to do with my gradle dependencies.
Now I found a nice tutorial which I've been following, http://www.android4devs.com/2015/06/navigation-view-material-design-support.html but I'm running to a problem extending it further, and there is something I don't think I understand.
Should I not be using the latest stable version of any library I can? Surely these libraries are backwards compatible?
If I am supposed to use the older version of library, to match the compile sdk (which I understand to mean I'm compiling for backwards compatibility, and supporting, say, lollipop API 21-22) then:
I would need a place to see a complete list of all versions of all libraries (which I cannot find), and
I would not be able to use new features like RecyclerView which only came in at Marshmallow API 23.
Am I missing something?
build.gradle (module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.example.myFirstApp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
...
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
Error message
The support library should not use a different version (26) than the compile sdk version (22).
You are using
compileSdkVersion 22
and
compile 'com.android.support:appcompat-v7:26.1.0'
error you are getting is because you are using compat version 26 while compileSdkversion is 22
You should update to compileSdkVersion to 26 and android studio will download required files so that your error will be removed. If you cannot update your compilesdk version to 26. Then change support library version to 22.2.1
compile 'com.android.support:appcompat-v7:22.2.1'
Got list of support libraries from link
https://developer.android.com/topic/libraries/support-library/rev-archive.html
and
https://developer.android.com/topic/libraries/support-library/revisions.html

Error retrieving parent for item: No resource found that matches the given name Borderless.Colored

I have update android support library yesterday, and now I am getting this error while building my project. I have searched for solutions and found nothing useful.
Here is what I have in my build.gradle file
compileSdkVersion 23
buildToolsVersion '23.0.0'
minSdkVersion 15
targetSdkVersion 23
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:support-v4:23.0.0'
change compilesdk and build tool version to 25.
compileSdkVersion 25
buildToolsVersion "25.0.2"

Changing minsdk version in android studio to enable use of RecyclerView

I am new to android development, and just learning. I am trying to create something with a RecyclerView, and the tutorial tells me I have to add these Gradle dependencies to my app's module:
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
When adding them to the build.gradle file, I get an error saying I have an incompatible compileSdkVersion. I changed compileSdkVersion 24 to compileSdkVersion 21 but the error doesn't go, and I get an error on these:
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
These are the rest of the settings that seem applicable to the sdk version in that file. Do I need to change any of those also in order to it to be compatible?
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "uk.ac.ncl.legacymakingv4"
minSdkVersion 18
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
You should always use the same version of everything in the com.android.support group. Therefore change your cardview and recyclerview to use the same 24.0.0 version.

Gradle not picking right appcompat-v7:22.2.1

I am facing a strange issue, i installed latest appcompat-v7:23.0.0
Where as i got to know i must not need it but i need to go with appcompat-v7:22.2.1 or appcompat-v7:22.0.0
I updated my gradle as per my needs but it always pickup appcompat-v7:23.0.0 which is not required, any one guide me how can i resolve this issue?
Since you are using
compile 'com.google.android.gms:play-services:+'
you are using the latest version compile 'com.google.android.gms:play-services:8.4.0' which has a dependency with support libraries v23.
You have to compile with API 23.
Change this line:
compileSdkVersion 23
If you don't want to use the api23 you can use a specific version like as
compile 'com.google.android.gms:play-services:7.8.0'
In general is not a good practice the use of + in your dependencies because you can't replicate the build in the future with the same libraries and you don't know which version you are using.
Also you can use api23 with Httpclient.
Just use:
android {
useLibrary 'org.apache.http.legacy'
}
More info here.
The useLibrary requires the gradle plugin 1.3.0 (classpath 'com.android.tools.build:gradle:1.3.0') or higher.
AppCompat (aka ActionBarCompat) started out as a backport of the
Android 4.0 ActionBar API for devices running on Gingerbread,
providing a common API layer on top of the backported implementation
and the framework implementation. AppCompat v21 delivers an API and
feature-set that is up-to-date with Android 5.0
You can use
compile 'com.android.support:appcompat-v7:22.0.1'
Finally
android {
compileSdkVersion 22
buildToolsVersion '22.0.1' // You can set buildToolsVersion '23.0.1'
Advice
You should use
compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
Good Approach : Use latest Version .
you need to download the latest support repository from internal SDK
manager of Android Studio or from the stand alone SDK manager. Then
you can add compile 'com.android.support:appcompat-v7:23.0.1'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId ""
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
}
Edit
You can use this classpath
classpath 'com.android.tools.build:gradle:1.3.0'
Then Clean-Rebuild-Restart-Sync your project . Hope this helps .

RecyclerView cannot resove for appcompat-v7:23.0.0 and 22

I'm trying to create a new list using RecyclerView to convert my existing ListView but problem is I can't find why my app cannot import the RecyclerView. I've just updated my SDK and other tools so I can work with Marshmallow in the future so everything is updated.
What I have in my app build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23"
defaultConfig {
applicationId "com.test.recyclerview"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:percent:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
}
and after adding this line on my layout xml I got the error saying The following classes could not be found: -android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
Downgrading my buildtools and targetSDK version is quite not a good option for me since I only have version 22 and 23 but in case I tried to downgrade my app compat version into 21 it result into this error:
This support library should not use a lower version (21) than the targetSdkVersion (23)
Does it mean that the RecyclerView is removed from app compat 23? or I missed something here?
It appears that something was messed out with my configuration which cause is still unknown. It may be on the IML file or other part but it appears that the libraries are not being imported from the source which is why even after I sync and clean the gradle project the libraries from external source remains the same and still builds successfully.
This may be a stupid question but it's the only thing I can imagine is happening
You said that you had downloaded Marshmallow API but have you downloaded the Android Support Library?
The RecyclerView is part of the support library, not the "normal" SDK

Categories

Resources