2

I have implemented RecyclerView in my android project, Which was working fine when I was using Android Support Library version 23.0.1.then I had to update my support Library for some other functionality so I updated my Support Library to 23.1.1. Then as libraries were updated I have deleted previous libraries from eclipse and re-import them and added them to project and cleaned workspace. after that I am getting following compile time error "The type android.support.v4.view.ScrollingView cannot be resolved. It is indirectly referenced from required .class files" whereas there is no compile time error in any of the methods which I override from RecyclerView Library.

package com.palasha.tccnetmanager.views;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;

public class CustomRecyclerView extends RecyclerView {

    public CustomRecyclerView(Context context) {
        super(context);
    }

    public CustomRecyclerView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomRecyclerView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean fling(int velocityX, int velocityY) {
        LinearLayoutManager linearLayoutManager = (LinearLayoutManager) getLayoutManager();
        int firstVisibleView = linearLayoutManager
                .findFirstVisibleItemPosition();
        if (firstVisibleView != -1)
            if (velocityX > 0)
                smoothScrollToPosition(firstVisibleView + 1);
            else if (firstVisibleView != 0)
                smoothScrollToPosition(firstVisibleView - 1);
            else
                smoothScrollToPosition(0);
        return true;
    }
}

3 Answers3

2

The version of android-support-v4.jar you are using may be old,replace it with the one in

sdk\extras\android\support\v7\appcompat\libs\android-support-v4.jar
Collins Abitekaniza
  • 4,496
  • 2
  • 28
  • 43
0
Try this for recylerview in android studio

    compile 'com.android.support:recyclerview-v7:21.0.0'

or find here

    \sdk\extras\android\m

2repository\com\android\support\recyclerview-v7

Rohit Heera
  • 2,709
  • 2
  • 21
  • 31
0

After wasting some time on this i just fixed it, following this steps:

Remove all support library from your workspace.

Import the support library again(android-support-v7-appcompat) to your workspace.

Go to libs directory of your library v7 which you have imported and delete the "android-support-v4.jar" file.

Left click the project library imported Select "Android Tools" and then click to "Add support library..."

Wait until process gets finish.

Go to your project properties-> Android-> click add-> select android-support-v7-appcompat, click Apply.

Clean the project.

Left click to your project-> properties-> Java Build Path-> libraries

Click "Add JARs.."

Go to android-support-v7-appcompat project's libs directory and select android-support-v4.jar file. Click OK.

Again clean project.

Now import RecyclerView Library and add to project. Again clean it.

This is how I come out of this problem.