Skip to content
This repository has been archived by the owner on Dec 1, 2017. It is now read-only.

Support Library 23.2.0, java.lang.IncompatibleClassChangeError: org.lucasr.twowayview.ClickItemTouchListener$ItemClickGestureDetector #266

Open
jmodrako opened this issue Feb 25, 2016 · 27 comments

Comments

@jmodrako
Copy link

After upgrading support library to 23.2 this issue occured:

java.lang.IncompatibleClassChangeError: org.lucasr.twowayview.ClickItemTouchListener$ItemClickGestureDetector
at org.lucasr.twowayview.ClickItemTouchListener.(ClickItemTouchListener.java:19)
at org.lucasr.twowayview.ItemClickSupport$TouchListener.(ItemClickSupport.java:115)
at org.lucasr.twowayview.ItemClickSupport.(ItemClickSupport.java:54)
at org.lucasr.twowayview.ItemClickSupport.addTo(ItemClickSupport.java:85)

@Spotik
Copy link

Spotik commented Feb 25, 2016

Same thing here.

@ekinguvencoglu
Copy link

I cannot find the solution of that problem, please help

@fondesa
Copy link

fondesa commented Feb 26, 2016

Same thing here.
That happens because with support-v4:23.2.0 GestureDetectorCompat became final

@hehuelet
Copy link

me too~

@ekinguvencoglu
Copy link

is there any solution about that?

@rajeevjaiswal
Copy link

Same issue but I am not using Support Library 23.2.0 even then I am getting those errors

@SeanGallahad
Copy link

Also getting this issue - is there a work-around? Thanks!

@lemoncola
Copy link

@rajeevjaiswal for my case, facebook SDK 'secretly' pulled the version to 23.2.0 even though I have the line:

compile 'com.android.support:support-v4:23.1.1' 

I need to explicitly exclude the dependency like this to get back 23.1.1:

    compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
        // Avoid pulling to latest 23.2.0
        // https://code.google.com/p/android/issues/detail?id=72430
        exclude group: 'com.android.support', module:'support-v4'
        exclude group: 'com.android.support', module:'cardview-v7'
    }

To make sure your dependencies are not force upgraded, run the following command in the terminal
./gradlew app:dependencies

And look for 23.2.0

@rajeevjaiswal
Copy link

Thanks I will look into it
On 04-Mar-2016 9:44 am, "LemonCola" [email protected] wrote:

@rajeevjaiswal https://github.com/rajeevjaiswal for my case, facebook
SDK 'secretly' pulled the version to 23.2.0 even though I have the line:

compile 'com.android.support:support-v4:23.1.1'

I need to explicitly exclude the dependency like this to get back 23.1.1:

compile ('com.facebook.android:facebook-android-sdk:4.10.0'){
    // Avoid pulling to latest 23.2.0
    // https://code.google.com/p/android/issues/detail?id=72430
    exclude group: 'com.android.support', module:'support-v4'
    exclude group: 'com.android.support', module:'cardview-v7'
}

To make sure your dependencies are not force upgraded, run the following
command in the terminal

./gradlew app:dependencies

And look for 23.2.0


Reply to this email directly or view it on GitHub
#266 (comment).

@rajeevjaiswal
Copy link

@lemoncola I modified the code but still it is crashing

@ekinguvencoglu
Copy link

@lemoncola thanks a lot, you save my day

@Spotik
Copy link

Spotik commented Mar 5, 2016

@lemoncola still with problem =/

@ekinguvencoglu
Copy link

@Spotik hi, I found many other 3rd party and some offical libraries still demand to use 23.2 support library, did you check that with ./gradlew app:dependencies command?

@Spotik
Copy link

Spotik commented Mar 5, 2016

@ekinguvencoglu which folder should I run the command?

@ekinguvencoglu
Copy link

@Spotik it can be run in terminal window at Android Studio

@Spotik
Copy link

Spotik commented Mar 6, 2016

@ekinguvencoglu i got the msg: "is not recognized as an internal or external command operable program or batch file"

On android studio terminal, the patch is "C:\Users\myuser\Projetos Android\my-project>"

@ekinguvencoglu
Copy link

@Spotik do you set the gradle path to your os?

@Spotik
Copy link

Spotik commented Mar 7, 2016

@ekinguvencoglu hmmm i dont think so... how I do that?
And thks for helping!

@lemoncola
Copy link

Thanks @ekinguvencoglu for helping~
@Spotik let's try the GUI way~

  1. Open Gradle Panel (View > Tool Windows > Gradle)
    screen shot 2016-03-09 at 12 47 57 am

  2. Click the 'Execute Gradle Task' button in the toolbar of the Gradle Panel
    screen shot 2016-03-09 at 12 48 34 am

  3. In the dialog, fill in "Command Line" with "app:dependencies"
    screen shot 2016-03-09 at 12 49 09 am

  4. Then in the Gradle output, you should see a module dependency tree. Search or scroll down to make sure your support lib is not upgraded due to requirements by some 3rd-party library.
    screen shot 2016-03-09 at 12 49 36 am

@ekinguvencoglu
Copy link

@lemoncola it's also very helpful explanation for me, thanks

@anantshah93
Copy link

same error but ii will try above solution still wanted to ask is there any other solution we can use with latest version of support library with this library.Is it possible without changing to compile 'com.android.support:support-v4:23.1.1'

@MustafaAdil
Copy link

I'm also facing this issue... whats the proper solution to this?

@simonwzb
Copy link

I will have to remove this library, because the auther doesnt upgrade it anymore.

@pvllnspk
Copy link

pvllnspk commented Jul 29, 2016

what about adding a click listener to a cell view inside adapter?

@Override
    public void onBindViewHolder(SimpleViewHolder holder, final int position) {
        ....
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mOnClickListener.onClick(v, position);
            }
        });

and then

  mRecyclerView.setAdapter(new GridAdapter(getActivity(), items, new GridAdapter.GridAdapterListener() {
            @Override
            public void onClick(View v, int position) {
                Toast.makeText(getActivity(), String.valueOf(items.get(position).getId()), Toast.LENGTH_SHORT).show();
            }
        }));

@seerazz
Copy link

seerazz commented Aug 11, 2016

Hi i face the same problem too, just use this class to solve the issue https://gist.github.com/nesquena/231e356f372f214c4fe6

@jayakrishnan-pm
Copy link

jayakrishnan-pm commented Dec 3, 2016

I fixed this issue by adding a separate on item click listener to it like,

           mRecyclerView.addOnItemTouchListener(
            new RecyclerItemClickListener(getApplicationContext(), new  RecyclerItemClickListener.OnItemClickListener() {
                @Override
                public void onItemClick(View view, int position) {

                    Toast.makeText(getApplicationContext(), "selected " + textColorList.get(position), Toast.LENGTH_SHORT).show();

                }
            })
    );

`
RecyclerItemClickListener.java

 import android.content.Context;
 import android.support.v7.widget.RecyclerView;
 import android.view.GestureDetector;
 import android.view.MotionEvent;
 import android.view.View;

 public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
 private OnItemClickListener mListener;

 public interface OnItemClickListener {
    public void onItemClick(View view, int position);
 }



GestureDetector mGestureDetector;

public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
    mListener = listener;
    mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            return true;
        }


    });
}

@Override
public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) {
    View childView = view.findChildViewUnder(e.getX(), e.getY());
    if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) {
        mListener.onItemClick(childView, view.getChildAdapterPosition(childView));
    }
    return false;
}

@Override
public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) {
}

@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {

}

}`

@jiulian
Copy link

jiulian commented Oct 17, 2017

mGestureDetector = new ItemClickGestureDetector(hostView.getContext(),
new ItemClickGestureListener(hostView));

I solved the problem by change the ItemClickGestureDetector to GestureDetectorCompat

mGestureDetector = new GestureDetectorCompat(hostView.getContext(),
new ItemClickGestureListener(hostView));

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests