{"action":"created","issue":{"url":"https://api.github.com/repos/commonsguy/cwac-cam2/issues/237","repository_url":"https://api.github.com/repos/commonsguy/cwac-cam2","labels_url":"https://api.github.com/repos/commonsguy/cwac-cam2/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/commonsguy/cwac-cam2/issues/237/comments","events_url":"https://api.github.com/repos/commonsguy/cwac-cam2/issues/237/events","html_url":"https://github.com/commonsguy/cwac-cam2/issues/237","id":163987385,"number":237,"title":"NoClassDefFoundError for EventBus on 4.x devices","user":{"login":"vxhviet","id":17634476,"avatar_url":"https://avatars.githubusercontent.com/u/17634476?v=3","gravatar_id":"","url":"https://api.github.com/users/vxhviet","html_url":"https://github.com/vxhviet","followers_url":"https://api.github.com/users/vxhviet/followers","following_url":"https://api.github.com/users/vxhviet/following{/other_user}","gists_url":"https://api.github.com/users/vxhviet/gists{/gist_id}","starred_url":"https://api.github.com/users/vxhviet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vxhviet/subscriptions","organizations_url":"https://api.github.com/users/vxhviet/orgs","repos_url":"https://api.github.com/users/vxhviet/repos","events_url":"https://api.github.com/users/vxhviet/events{/privacy}","received_events_url":"https://api.github.com/users/vxhviet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-06T02:41:58Z","updated_at":"2016-07-06T11:18:06Z","closed_at":null,"body":"Hi, this is more like a bug report for someone running into similar problem.\r\n\r\nSo I've been using Fabric to investigate bug and for the past couple of weeks it seem like every Android 4.x device encounter this particular crash (I'm using cwac 0.5.11):\r\n\r\n```\r\nFatal Exception: java.lang.NoClassDefFoundError: android/os/PersistableBundle\r\n       at java.lang.Class.getDeclaredMethods(Class.java)\r\n       at java.lang.Class.getDeclaredMethods(Class.java:605)\r\n       at de.greenrobot.event.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:75)\r\n       at de.greenrobot.event.EventBus.register(EventBus.java:163)\r\n       at de.greenrobot.event.EventBus.register(EventBus.java:133)\r\n       at com.commonsware.cwac.cam2.AbstractCameraActivity.onStart(AbstractCameraActivity.java:256)\r\n       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188)\r\n       at android.app.Activity.performStart(Activity.java:5382)\r\n       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2279)\r\n       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362)\r\n       at android.app.ActivityThread.access$700(ActivityThread.java:168)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329)\r\n       at android.os.Handler.dispatchMessage(Handler.java:99)\r\n       at android.os.Looper.loop(Looper.java:176)\r\n       at android.app.ActivityThread.main(ActivityThread.java:5493)\r\n       at java.lang.reflect.Method.invokeNative(Method.java)\r\n       at java.lang.reflect.Method.invoke(Method.java:525)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)\r\n       at dalvik.system.NativeStart.main(NativeStart.java)\r\nCaused by java.lang.ClassNotFoundException: Didn't find class \"android.os.PersistableBundle\" on path: DexPathList[[zip file \"/data/app/co.example.myexample-2.apk\"],nativeLibraryDirectories=[/data/app-lib/co.example.myexample-2, /vendor/lib, /system/lib]]\r\n       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)\r\n       at java.lang.ClassLoader.loadClass(ClassLoader.java:501)\r\n       at java.lang.ClassLoader.loadClass(ClassLoader.java:461)\r\n       at java.lang.Class.getDeclaredMethods(Class.java)\r\n       at java.lang.Class.getDeclaredMethods(Class.java:605)\r\n       at de.greenrobot.event.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:75)\r\n       at de.greenrobot.event.EventBus.register(EventBus.java:163)\r\n       at de.greenrobot.event.EventBus.register(EventBus.java:133)\r\n       at com.commonsware.cwac.cam2.AbstractCameraActivity.onStart(AbstractCameraActivity.java:256)\r\n       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188)\r\n       at android.app.Activity.performStart(Activity.java:5382)\r\n       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2279)\r\n       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362)\r\n       at android.app.ActivityThread.access$700(ActivityThread.java:168)\r\n       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329)\r\n       at android.os.Handler.dispatchMessage(Handler.java:99)\r\n       at android.os.Looper.loop(Looper.java:176)\r\n       at android.app.ActivityThread.main(ActivityThread.java:5493)\r\n       at java.lang.reflect.Method.invokeNative(Method.java)\r\n       at java.lang.reflect.Method.invoke(Method.java:525)\r\n       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)\r\n       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)\r\n       at dalvik.system.NativeStart.main(NativeStart.java)\r\n```\r\nThose devices are:\r\n- Samsung Galaxy Grand 2 (SM-G710) running Android 4.3\r\n- Leotech C55 Negro (LESPH5504B) running Android 4.4.2\r\n- HUAWEI Ascend (Y330-U05) running Android 4.2.2\r\n- Samsung Galaxy Fame (GT-S6810) running Android 4.1.2\r\n- AG CHROME ULTRA running Android 4.4.2\r\n- ARBUTUS AR5 running Android 4.4.2\r\n- HUAWEI Honor 3C (H30-U10) running Android 4.2.2\r\n- OPPO N1 mini (N5111) running Android 4.3\r\n- Zopo ZP980+ running Android 4.2.2\r\n- Samsung Galaxy Tab 4 (SM-T231) running Android 4.4.2\r\n- Samsung Galaxy Tab 4 (SM-T331) running Android 4.4.2\r\n- Samsung Galaxy S4 mini (GT-I9190) running Android 4.4.2\r\n- Samsung Galaxy S III (SPH-L710T) running Android 4.4.2\r\n- Motorola Moto G 4G (XT1039) running Android 4.4.4\r\n- Motorola Droid Ultra (XT1080) running Android 4.4.4\r\n- Pantech Vega (IM-A880S) running Android 4.4.2\r\n- Samsung Galaxy Grand 2 (SM-G7105) running Android 4.4.2\r\n- Acer Iconia One 7 (B1-730) running Android 4.2.2\r\n- Samsung Galaxy Grand Neo (GT-I9060I) running Android 4.4.4\r\n- Samsung Galaxy Tab E (SM-T561Y) running Android 4.4.4\r\n- HUAWEI Ascend (G510-0251) running Android 4.1.1\r\n- MyPhone Agua Rio Lite running 4.2.2\r\n- Motorola Moto G (XT1032) running 4.4.4\r\n- Rivo Phantom PZ8 running  4.4.2\r\n\r\nI do follow the instruction to configure proguard but I think I also need to [configure proguard for `EventBus` ](http://greenrobot.org/eventbus/documentation/proguard/) like this:\r\n\r\n```\r\n-keepattributes *Annotation*\r\n-keepclassmembers class ** {\r\n    @org.greenrobot.eventbus.Subscribe <methods>;\r\n}\r\n-keep enum org.greenrobot.eventbus.ThreadMode { *; }\r\n\r\n# Only required if you use AsyncExecutor\r\n-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {\r\n    <init>(java.lang.Throwable);\r\n}\r\n```\r\n\r\nI don't think the last one is necessary as I don't see `AsyncExecutor` being used anywhere in the library.\r\n\r\nLet me investigate this in a couple of days to see if this solve the issue."},"comment":{"url":"https://api.github.com/repos/commonsguy/cwac-cam2/issues/comments/230744874","html_url":"https://github.com/commonsguy/cwac-cam2/issues/237#issuecomment-230744874","issue_url":"https://api.github.com/repos/commonsguy/cwac-cam2/issues/237","id":230744874,"user":{"login":"commonsguy","id":103772,"avatar_url":"https://avatars.githubusercontent.com/u/103772?v=3","gravatar_id":"","url":"https://api.github.com/users/commonsguy","html_url":"https://github.com/commonsguy","followers_url":"https://api.github.com/users/commonsguy/followers","following_url":"https://api.github.com/users/commonsguy/following{/other_user}","gists_url":"https://api.github.com/users/commonsguy/gists{/gist_id}","starred_url":"https://api.github.com/users/commonsguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commonsguy/subscriptions","organizations_url":"https://api.github.com/users/commonsguy/orgs","repos_url":"https://api.github.com/users/commonsguy/repos","events_url":"https://api.github.com/users/commonsguy/events{/privacy}","received_events_url":"https://api.github.com/users/commonsguy/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T11:18:05Z","updated_at":"2016-07-06T11:18:05Z","body":"@vxhviet I suspect that this will not help.\r\n\r\nDid you modify `AbstractCameraActivity` in your own copy of the library? Based on [the greenrobot EventBus FAQ](http://greenrobot.org/eventbus/documentation/faq/) (see second entry in \"Troubleshooting\"), this problem should only occur if you override a method referencing `PersistableBundle`, which I have not done. I test on a wide range of 4.x devices and have not run into this crash.\r\n"}}
{"actor":{"display_login":"commonsguy"}}