Support Library 23.2.0, java.lang.IncompatibleClassChangeError: org.lucasr.twowayview.ClickItemTouchListener$ItemClickGestureDetector
jmodrako opened this issue ยท 27 comments
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)
Same thing here.
I cannot find the solution of that problem, please help
Same thing here.
That happens because with support-v4:23.2.0 GestureDetectorCompat became final
me too~
is there any solution about that?
Same issue but I am not using Support Library 23.2.0 even then I am getting those errors
Also getting this issue - is there a work-around? Thanks!
@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
Thanks I will look into it
On 04-Mar-2016 9:44 am, "LemonCola" notifications@github.com 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).
@lemoncola I modified the code but still it is crashing
@lemoncola thanks a lot, you save my day
@lemoncola still with problem =/
@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?
@ekinguvencoglu which folder should I run the command?
@Spotik it can be run in terminal window at Android Studio
@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>"
@Spotik do you set the gradle path to your os?
@ekinguvencoglu hmmm i dont think so... how I do that?
And thks for helping!
Thanks @ekinguvencoglu for helping~
@Spotik let's try the GUI way~
-
Click the 'Execute Gradle Task' button in the toolbar of the Gradle Panel
-
In the dialog, fill in "Command Line" with "app:dependencies"
-
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.
@lemoncola it's also very helpful explanation for me, thanks
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'
I'm also facing this issue... whats the proper solution to this?
I will have to remove this library, because the auther doesnt upgrade it anymore.
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();
}
}));
Hi i face the same problem too, just use this class to solve the issue https://gist.github.com/nesquena/231e356f372f214c4fe6
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) {
}
}`
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));