android app stopped unfortunately - android-geofence

When I run the app in emulator it says app stopped unfortunately.
Here is the logcat, can anyone find what is the error?
08-29 12:57:01.014: E/Trace(780): error opening trace file: No such
file or directory (2) 08-29 12:57:01.244: D/AndroidRuntime(780):
Shutting down VM 08-29 12:57:01.244: W/dalvikvm(780): threadid=1:
thread exiting with uncaught exception (group=0x40a71930) 08-29
12:57:01.334: E/AndroidRuntime(780): FATAL EXCEPTION: main 08-29
12:57:01.334: E/AndroidRuntime(780): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{com.example.android.geofence/com.example.android.geofence.MainActivity}:
java.lang.ClassNotFoundException: Didn't find class
"com.example.android.geofence.MainActivity" on path:
/data/app/com.example.android.geofence-2.apk 08-29 12:57:01.334:
E/AndroidRuntime(780): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
08-29 12:57:01.334: E/AndroidRuntime(780): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-29 12:57:01.334: E/AndroidRuntime(780): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 08-29
12:57:01.334: E/AndroidRuntime(780): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-29 12:57:01.334: E/AndroidRuntime(780): at
android.os.Handler.dispatchMessage(Handler.java:99) 08-29
12:57:01.334: E/AndroidRuntime(780): at
android.os.Looper.loop(Looper.java:137) 08-29 12:57:01.334:
E/AndroidRuntime(780): at
android.app.ActivityThread.main(ActivityThread.java:5041) 08-29
12:57:01.334: E/AndroidRuntime(780): at
java.lang.reflect.Method.invokeNative(Native Method) 08-29
12:57:01.334: E/AndroidRuntime(780): at
java.lang.reflect.Method.invoke(Method.java:511) 08-29 12:57:01.334:
E/AndroidRuntime(780): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-29 12:57:01.334: E/AndroidRuntime(780): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 08-29
12:57:01.334: E/AndroidRuntime(780): at
dalvik.system.NativeStart.main(Native Method) 08-29 12:57:01.334:
E/AndroidRuntime(780): Caused by: java.lang.ClassNotFoundException:
Didn't find class "com.example.android.geofence.MainActivity" on path:
/data/app/com.example.android.geofence-2.apk 08-29 12:57:01.334:
E/AndroidRuntime(780): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
08-29 12:57:01.334: E/AndroidRuntime(780): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501) 08-29
12:57:01.334: E/AndroidRuntime(780): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) 08-29
12:57:01.334: E/AndroidRuntime(780): at
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
08-29 12:57:01.334: E/AndroidRuntime(780): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
08-29 12:57:01.334: E/AndroidRuntime(780): ... 11 more

This is the exception:
java.lang.ClassNotFoundException: Didn't find class "com.example.android.geofence.MainActivity" on path: /data/app/com.example.android.geofence-2.apk
Try cleaning and building your project and run it again on emulator.

The interesting part is here
12:57:01.334: E/AndroidRuntime(780): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.geofence.MainActivity" on path: /data/app/com.example.android.geofence-2.apk
Please check if your main activity is really called com.example.android.geofence.MainActivity

Related

Android Studio app says it stopped over and over again

Last time I opened the project, it was working but now the app keeps stopping. I didn't even change any code as far as I remember. I can't even open the app now
2022-06-07 21:06:18.942 7244-7244/com.example.labactivity01layoutsandactivity E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.labactivity01layoutsandactivity, PID: 7244
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.labactivity01layoutsandactivity/com.example.labactivity01layoutsandactivity.MainActivity}: java.lang.IllegalStateException: Activity com.example.labactivity01layoutsandactivity.MainActivity#661d5fe does not have a NavController set on 2131231012
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.IllegalStateException: Activity com.example.labactivity01layoutsandactivity.MainActivity#661d5fe does not have a NavController set on 2131231012
at androidx.navigation.Navigation.findNavController(Navigation.java:61)
at androidx.navigation.ActivityKt.findNavController(Activity.kt:30)
at com.example.labactivity01layoutsandactivity.MainActivity.onCreate(MainActivity.kt:26)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)

When I run my project why this error occurs?

01-07 14:19:21.816 9861-9861/? I/art: Late-enabling -Xcheck:jni
I am unable to rectify this error,
01-07 14:19:22.168 9861-9861/com.example.krishna.androideatit W/System: ClassLoader referenced unknown path: /data/app/com.example.krishna.androideatit-1/lib/arm64
01-07 14:19:22.202 9861-9861/com.example.krishna.androideatit I/art: Starting a blocking GC HeapTrim
01-07 14:19:22.211 9861-9861/com.example.krishna.androideatit I/InstantRun: starting instant run server: is main process
01-07 14:19:22.463 9861-9861/com.example.krishna.androideatit W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
01-07 14:19:22.615 9861-9861/com.example.krishna.androideatit D/skia: SkJpegCodec::onGetPixels +
01-07 14:19:22.620 9861-9861/com.example.krishna.androideatit D/skia: SkJpegCodec::onGetPixels -
01-07 14:19:22.665 9861-9872/com.example.krishna.androideatit I/art: Enter while loop.
01-07 14:19:22.741 9861-9861/com.example.krishna.androideatit D/AndroidRuntime: Shutting down VM
01-07 14:19:22.747 9861-9861/com.example.krishna.androideatit E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.krishna.androideatit, PID: 9861
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.krishna.androideatit/com.example.krishna.androideatit.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.krishna.androideatit.MainActivity.onCreate(MainActivity.java:18)
at android.app.Activity.performCreate(Activity.java:6666)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
at android.content.res.TypedArray.getColor(TypedArray.java:466)
at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
at info.hoang8f.widget.FButton.<init>(FButton.java:52)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at com.example.krishna.androideatit.MainActivity.onCreate(MainActivity.java:18) 
at android.app.Activity.performCreate(Activity.java:6666) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:203) 
at android.app.ActivityThread.main(ActivityThread.java:6251) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) 
It is clearly written here that exception is due to
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.krishna.androideatit/com.example.krishna.androideatit.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
please provide your code fro more help

java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.LifecycleRuntimeTrojanProvider

My app keeps crashing and this error keeps popping up when my app is run on a API level 19 device after I updated Android Studio to 3.0. This app worked fine with previous Android Studio. Also the app works fine with API level 24 device now.
P.S. - I know this question was asked some times before and its a duplicate. But none of the solutions worked for me.
java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.LifecycleRuntimeTrojanProvider: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleRuntimeTrojanProvider" on path: DexPathList[[zip file "/data/app/com.bayasys.bayatrade.mobile-76.apk"],nativeLibraryDirectories=[/data/app-lib/com.bayasys.bayatrade.mobile-76, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5236)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4828)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4711)
at android.app.ActivityThread.access$1600(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleRuntimeTrojanProvider" on path: DexPathList[[zip file "/data/app/com.bayasys.bayatrade.mobile-76.apk"],nativeLibraryDirectories=[/data/app-lib/com.bayasys.bayatrade.mobile-76, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:5221)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4828) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4711) 
at android.app.ActivityThread.access$1600(ActivityThread.java:175) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5602) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
at dalvik.system.NativeStart.main(Native Method) 
I faced the similar issue. I solved it by extending my Application class to MultidexApplication.

Cardboard SDK Crash

Just download Cardboard demo. Build to Android device. Launch it and get a crash log. Anyone know the issue?
Thanks.
01-24 15:24:12.468 7271-7271/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 4.6.0b20
Device model : Xiaomi HM 1SW
Device fingerprint: Xiaomi/armani/armani:4.3/JLS36C/JHCMIBH45.0:user/release-keys
Caused by: java.lang.VerifyError: com/google/vrtoolkit/cardboard/CardboardDeviceParams
at com.google.vrtoolkit.cardboard.HeadMountedDisplayManager.createCardboardDeviceParams(HeadMountedDisplayManager.java:214)
at com.google.vrtoolkit.cardboard.HeadMountedDisplayManager.<init>(HeadMountedDisplayManager.java:54)
at com.google.vrtoolkit.cardboard.CardboardView.init(CardboardView.java:768)
at com.google.vrtoolkit.cardboard.CardboardView.<init>(CardboardView.java:263)
at com.google.vrtoolkit.cardboard.plugins.unity.UnityCardboardActivity.onCreate(UnityCardboardActivity.java:184)
at android.app.Activity.performCreate(Activity.java:5135)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2182)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2268)
at android.app.ActivityThread.access$600(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1263)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5162)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:756)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:572)
at miui.dexspy.DexspyInstaller.main(DexspyInstaller.java:171)
at dalvik.system.NativeStart.main(Native Method)
You need to add libprotobuf-java-2.3-nano.jar. Its in the
\cardboard-java-master\CardboardSample\libs with cardboard.jar
Fixed it for me.

Getting the error android.view.InflateException for the Android Cropper

I am trying to use the android cropper library at https://github.com/edmodo/cropper . I have imported the 'cropper.jar' file properly in the libs folder as well.
But, when I'm trying to use the custom view CropImageView (this is defined in the cropper library in the package com.edmondo.cropper.CropImageView) in my XML layout:
<com.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="#+id/CropImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
I am getting the error:
02-04 19:14:16.239: W/dalvikvm(28620): VFY: unable to resolve static field 1378 (CropImageView) in Lcom/edmodo/cropper/R$styleable;
02-04 19:14:16.239: D/dalvikvm(28620): VFY: replacing opcode 0x62 at 0x0011
02-04 19:14:16.239: W/dalvikvm(28620): VFY: unable to resolve static field 1377 (crop_image_view) in Lcom/edmodo/cropper/R$layout;
02-04 19:14:16.239: D/dalvikvm(28620): VFY: replacing opcode 0x60 at 0x0004
02-04 19:14:16.239: I/dalvikvm(28620): DexOpt: unable to optimize static field ref 0x0560 at 0x0b in Lcom/edmodo/cropper/CropImageView;.init
02-04 19:14:16.239: I/dalvikvm(28620): DexOpt: unable to optimize static field ref 0x055f at 0x1a in Lcom/edmodo/cropper/CropImageView;.init
02-04 19:14:16.239: D/AndroidRuntime(28620): Shutting down VM
02-04 19:14:16.239: W/dalvikvm(28620): threadid=1: thread exiting with uncaught exception (group=0x41527ba8)
02-04 19:14:16.249: E/AndroidRuntime(28620): FATAL EXCEPTION: main
02-04 19:14:16.249: E/AndroidRuntime(28620): Process: com.vishal.cameragallerypics, PID: 28620
02-04 19:14:16.249: E/AndroidRuntime(28620): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vishal.cameragallerypics/com.vishal.cameragallerypics.MainActivity}: android.view.InflateException: Binary XML file line #86: Error inflating class com.edmodo.cropper.CropImageView
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.ActivityThread.access$800(ActivityThread.java:135)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.os.Handler.dispatchMessage(Handler.java:102)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.os.Looper.loop(Looper.java:136)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.ActivityThread.main(ActivityThread.java:5017)
02-04 19:14:16.249: E/AndroidRuntime(28620): at java.lang.reflect.Method.invokeNative(Native Method)
02-04 19:14:16.249: E/AndroidRuntime(28620): at java.lang.reflect.Method.invoke(Method.java:515)
02-04 19:14:16.249: E/AndroidRuntime(28620): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-04 19:14:16.249: E/AndroidRuntime(28620): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-04 19:14:16.249: E/AndroidRuntime(28620): at dalvik.system.NativeStart.main(Native Method)
02-04 19:14:16.249: E/AndroidRuntime(28620): Caused by: android.view.InflateException: Binary XML file line #86: Error inflating class com.edmodo.cropper.CropImageView
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
02-04 19:14:16.249: E/AndroidRuntime(28620): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.Activity.setContentView(Activity.java:1929)
02-04 19:14:16.249: E/AndroidRuntime(28620): at com.vishal.cameragallerypics.MainActivity.onCreate(MainActivity.java:120)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.Activity.performCreate(Activity.java:5231)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
02-04 19:14:16.249: E/AndroidRuntime(28620): ... 11 more
02-04 19:14:16.249: E/AndroidRuntime(28620): Caused by: java.lang.reflect.InvocationTargetException
02-04 19:14:16.249: E/AndroidRuntime(28620): at java.lang.reflect.Constructor.constructNative(Native Method)
02-04 19:14:16.249: E/AndroidRuntime(28620): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
02-04 19:14:16.249: E/AndroidRuntime(28620): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
02-04 19:14:16.249: E/AndroidRuntime(28620): ... 25 more
02-04 19:14:16.249: E/AndroidRuntime(28620): Caused by: java.lang.NoClassDefFoundError: com.edmodo.cropper.R$styleable
02-04 19:14:16.249: E/AndroidRuntime(28620): at com.edmodo.cropper.CropImageView.<init>(CropImageView.java:84)
02-04 19:14:16.249: E/AndroidRuntime(28620): ... 28 more
I have gone through many questions regarding the same issue, but none of the answers could help me solve the problem. It would be great if somebody can help me out with the issue.
i get the same error today (java.lang.NoClassDefFoundError: com.edmodo.cropper.R$styleable) but i build the 'cropper.jar' from source using Android Gradle Plugin. Although we maybe in different troubles, hope my finding can give you a hint:
go to the output folder: {your-module-dir}/build/generated/source/r/release/com/edmodo/cropper/R.java and see whether the missing class is present.
check the build system config and find out why the class is missing (e.g. check other work libs' output folder and find out the differences).
finally i find out i use the wrong applicationId in gradle build file, so the generated R.java is placed in the wrong package (com.edmonod.R.java not com.edmonod.cropper.R.java).
I was getting the same issue and in my case,It was the old cropper library I was using before adding "com.edmodo.cropper" library.What actually happening is when we add this library to gradle,It picks up some files from the Old cropper with same name.Resulting the issue was faced.As soon as i removed the old cropper library,Everything works fine.
At the example the definition at XML file is as follows:
com.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="#+id/CropImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
custom:imageResource="#drawable/butterfly"
I had the same error when I add custom:imageResource="#drawable/butterfly". I solved it when I removed it, but adding on code:
// Initialize components
cropImageView = (CropImageView) findViewById(R.id.CropImageView);
cropImageView.setImageResource(R.drawable.butterfly);

Resources