问题描述
我的应用程序一直工作正常,但现在在新版本的Android M preVIEW崩溃我认为问题出在ActionBarSherlock。有人有同样的问题或知道我该如何解决?
这是错误:
10月7日至31日:41:59.435:E / AndroidRuntime(4239):致命异常:主要
10月7日至31日:41:59.435:E / AndroidRuntime(4239):了java.lang.RuntimeException:无法启动活动ComponentInfo{com.myapp.messaging.android/com.myapp.messaging.android.holo.messagelist.MainActivity}:了java.lang.RuntimeException:java.lang.IllegalAccessException:java.lang.Class中的< org.holoeverywhere.addon.AddonSherlock $ HoloActionBarSherlockNative>是不是从java.lang.Class中的&LT访问; com.actionbarsherlock.ActionBarSherlock>
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.ActivityThread.-wrap11(ActivityThread.java)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1345)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.os.Handler.dispatchMessage(Handler.java:102)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.os.Looper.loop(Looper.java:148)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.ActivityThread.main(ActivityThread.java:5415)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在java.lang.reflect.Method.invoke(本机方法)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:725)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):了java.lang.RuntimeException:产生的原因java.lang.IllegalAccessException:java.lang.Class中的< org.holoeverywhere.addon.AddonSherlock $ HoloActionBarSherlockNative>是不是从java.lang.Class中的&LT访问; com.actionbarsherlock.ActionBarSherlock>
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在com.actionbarsherlock.ActionBarSherlock.wrap(ActionBarSherlock.java:240)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在org.holoeverywhere.addon.AddonSherlock $ AddonSherlockA.getSherlock(AddonSherlock.java:53)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在org.holoeverywhere.addon.AddonSherlock $ AddonSherlockA.installDecorView(AddonSherlock.java:60)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.support.v4.app._HoloActivity $ 1.action(_HoloActivity.java:587)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.support.v4.app._HoloActivity $ 1.action(_HoloActivity.java:1)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在org.holoeverywhere.addon.IAddonBasicAttacher.performAddonAction(IAddonBasicAttacher.java:167)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在org.holoeverywhere.app.Activity.performAddonAction(Activity.java:497)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.support.v4.app._HoloActivity.requestDecorView(_HoloActivity.java:584)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.support.v4.app._HoloActivity.setContentView(_HoloActivity.java:604)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在com.myapp.messaging.android.holo.messagelist.MainActivity.onCreate(MainActivity.java:120)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.Activity.performCreate(Activity.java:6162)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):... 9点多
10月7日至31日:41:59.435:E / AndroidRuntime(4239):java.lang.IllegalAccessException:由造成的java.lang.Class< org.holoeverywhere.addon.AddonSherlock $ HoloActionBarSherlockNative>是不是从java.lang.Class中的&LT访问; com.actionbarsherlock.ActionBarSherlock>
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在java.lang.reflect.Constructor.newInstance(本机方法)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):在com.actionbarsherlock.ActionBarSherlock.wrap(ActionBarSherlock.java:232)
10月7日至31日:41:59.435:E / AndroidRuntime(4239):21 ...更多
您好我面对完全相同的问题,今天,幸运的是我能解决它。
此修复程序在动作条福尔摩斯库code工作要做。所以,你需要actionbarsherlock添加为库项目。
请在ActionBarSherlock.java以下更改
ctor.setAccessible(真);
添加上面一行略高于回报ctor.newInstance(活动,旗); (行公共静态ActionBarSherlock包(活动活动,INT标志没有230){}方法。
同样做以下的LayoutInflater.java变化
constructor.setAccessible(真);
添加此略高于最终查看视图= constructor.newInstance(参数); (行352号)在公众视野_createView(字符串名称,字符串preFIX,AttributeSet中的ATTRS){}
请注意:我使用ActionBarSherlock 4.3.0
My app always work fine, but now is crashing in the new Android M preview I think that the problem is with the ActionBarSherlock. Someone have the same problem or know how can I fix it?
This is the error:
07-31 10:41:59.435: E/AndroidRuntime(4239): FATAL EXCEPTION: main
07-31 10:41:59.435: E/AndroidRuntime(4239): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.messaging.android/com.myapp.messaging.android.holo.messagelist.MainActivity}: java.lang.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<org.holoeverywhere.addon.AddonSherlock$HoloActionBarSherlockNative> is not accessible from java.lang.Class<com.actionbarsherlock.ActionBarSherlock>
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2477)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.ActivityThread.-wrap11(ActivityThread.java)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1345)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.os.Handler.dispatchMessage(Handler.java:102)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.os.Looper.loop(Looper.java:148)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.ActivityThread.main(ActivityThread.java:5415)
07-31 10:41:59.435: E/AndroidRuntime(4239): at java.lang.reflect.Method.invoke(Native Method)
07-31 10:41:59.435: E/AndroidRuntime(4239): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
07-31 10:41:59.435: E/AndroidRuntime(4239): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
07-31 10:41:59.435: E/AndroidRuntime(4239): Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<org.holoeverywhere.addon.AddonSherlock$HoloActionBarSherlockNative> is not accessible from java.lang.Class<com.actionbarsherlock.ActionBarSherlock>
07-31 10:41:59.435: E/AndroidRuntime(4239): at com.actionbarsherlock.ActionBarSherlock.wrap(ActionBarSherlock.java:240)
07-31 10:41:59.435: E/AndroidRuntime(4239): at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.getSherlock(AddonSherlock.java:53)
07-31 10:41:59.435: E/AndroidRuntime(4239): at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.installDecorView(AddonSherlock.java:60)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.support.v4.app._HoloActivity$1.action(_HoloActivity.java:587)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.support.v4.app._HoloActivity$1.action(_HoloActivity.java:1)
07-31 10:41:59.435: E/AndroidRuntime(4239): at org.holoeverywhere.addon.IAddonBasicAttacher.performAddonAction(IAddonBasicAttacher.java:167)
07-31 10:41:59.435: E/AndroidRuntime(4239): at org.holoeverywhere.app.Activity.performAddonAction(Activity.java:497)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.support.v4.app._HoloActivity.requestDecorView(_HoloActivity.java:584)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.support.v4.app._HoloActivity.setContentView(_HoloActivity.java:604)
07-31 10:41:59.435: E/AndroidRuntime(4239): at com.myapp.messaging.android.holo.messagelist.MainActivity.onCreate(MainActivity.java:120)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.Activity.performCreate(Activity.java:6162)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
07-31 10:41:59.435: E/AndroidRuntime(4239): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2370)
07-31 10:41:59.435: E/AndroidRuntime(4239): ... 9 more
07-31 10:41:59.435: E/AndroidRuntime(4239): Caused by: java.lang.IllegalAccessException: java.lang.Class<org.holoeverywhere.addon.AddonSherlock$HoloActionBarSherlockNative> is not accessible from java.lang.Class<com.actionbarsherlock.ActionBarSherlock>
07-31 10:41:59.435: E/AndroidRuntime(4239): at java.lang.reflect.Constructor.newInstance(Native Method)
07-31 10:41:59.435: E/AndroidRuntime(4239): at com.actionbarsherlock.ActionBarSherlock.wrap(ActionBarSherlock.java:232)
07-31 10:41:59.435: E/AndroidRuntime(4239): ... 21 more
Hi I faced the exactly same issue today and fortunately I was able to fix it.This fix has to be done in actionbar sherlock library code. So you need to add actionbarsherlock as library project.
Make the following change in ActionBarSherlock.java
ctor.setAccessible(true);
add above line just above return ctor.newInstance(activity, flag); (line no 230 in public static ActionBarSherlock wrap(Activity activity, int flags){} method.
Similarly do following change in LayoutInflater.java
constructor.setAccessible(true);
add this just above final View view = constructor.newInstance(args); (line no.352) in public View _createView(String name, String prefix, AttributeSet attrs){}
Note: I am using ActionBarSherlock 4.3.0
这篇关于应用程序崩溃版本的Android M的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!