1

I was trying to do a Magnifier for TextView using this document

I have updated the AppCompat Library to 28.+ and the SDK to Android 8 in my Android Studio. Since I could not able to run my app. I appreciate if you can help a bit with this issues. I was exploring and tried all solution like Rebuild/clean project and updated latest support library

Error Log:

Java.lang.NoClassDefFoundError: Failed resolution of: Landroid/widget/Magnifier; at com.oreafeatures.oreafeatures.MainActivity$1.onTouch(MainActivity.java:21)

My Dependencies:

compileSdkVersion 28
minSdkVersion 15
targetSdkVersion 28

implementation 'com.android.support:appcompat-v7:28+'

My Java Code:

        findViewById(R.id.textView).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                Magnifier magnifier = new Magnifier(v);
                switch (event.getActionMasked())
                {
                    case MotionEvent.ACTION_DOWN:
                        break;
                    case MotionEvent.ACTION_MOVE:
                        final int[] viewPosition = new int[2];
                        v.getLocationOnScreen(viewPosition);
                       magnifier.show(event.getRawX() - viewPosition[0],
                                event.getRawY() - viewPosition[1]);
                        break;
                    case MotionEvent.ACTION_CANCEL:
                        break;
                    case MotionEvent.ACTION_UP:
                        magnifier.dismiss();
                        break;
                }
                return false;
            }
        });
Pritam
  • 339
  • 3
  • 23
Manikandan K
  • 1,081
  • 1
  • 9
  • 17

0 Answers0