umano / AndroidSlidingUpPanel

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
http://umano.me
Apache License 2.0
9.5k stars 2.27k forks source link

Potential conflict with SlidingUpPanelLayout and Robolectric #288

Closed marcthomas2013 closed 10 years ago

marcthomas2013 commented 10 years ago

Hi,

I am trying to write automated tests using the Robolectric framework to enable me to test both on the device and in the JVM. As soon as I introduce the SlidingUpPanelLayout to my project that uses Robolectric I get an IllegalAccessError. See below. To help with this issue I have created a sample project on GitHub https://github.com/marcthomas2013/SlideUpPanelLayoutAndRobolectric to reproduce the issue.

E/AndroidRuntime(21723): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.marcthomas.testrobolectric/com.marcthomas.testrobolectric.MyActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.sothree.slidinguppanel.SlidingUpPanelLayout E/AndroidRuntime(21723): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) E/AndroidRuntime(21723): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) E/AndroidRuntime(21723): at android.app.ActivityThread.access$800(ActivityThread.java:135) E/AndroidRuntime(21723): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) E/AndroidRuntime(21723): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(21723): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime(21723): at android.app.ActivityThread.main(ActivityThread.java:5001) E/AndroidRuntime(21723): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(21723): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(21723): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) E/AndroidRuntime(21723): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) E/AndroidRuntime(21723): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(21723): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.sothree.slidinguppanel.SlidingUpPanelLayout E/AndroidRuntime(21723): at android.view.LayoutInflater.createView(LayoutInflater.java:620) E/AndroidRuntime(21723): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) E/AndroidRuntime(21723): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) E/AndroidRuntime(21723): at android.view.LayoutInflater.inflate(LayoutInflater.java:492) E/AndroidRuntime(21723): at android.view.LayoutInflater.inflate(LayoutInflater.java:397) E/AndroidRuntime(21723): at android.view.LayoutInflater.inflate(LayoutInflater.java:353) E/AndroidRuntime(21723): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) E/AndroidRuntime(21723): at android.app.Activity.setContentView(Activity.java:1929) E/AndroidRuntime(21723): at com.marcthomas.testrobolectric.MyActivity.onCreate(MyActivity.java:14) E/AndroidRuntime(21723): at android.app.Activity.performCreate(Activity.java:5231) E/AndroidRuntime(21723): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) E/AndroidRuntime(21723): at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.callActivityOnCreate(GoogleInstrumentation.java:428) E/AndroidRuntime(21723): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) E/AndroidRuntime(21723): ... 11 more E/AndroidRuntime(21723): Caused by: java.lang.reflect.InvocationTargetException E/AndroidRuntime(21723): at java.lang.reflect.Constructor.constructNative(Native Method) E/AndroidRuntime(21723): at java.lang.reflect.Constructor.newInstance(Constructor.java:423) E/AndroidRuntime(21723): at android.view.LayoutInflater.createView(LayoutInflater.java:594) E/AndroidRuntime(21723): ... 23 more E/AndroidRuntime(21723): Caused by: java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation E/AndroidRuntime(21723): at com.sothree.slidinguppanel.ViewDragHelper.(ViewDragHelper.java:392) E/AndroidRuntime(21723): at com.sothree.slidinguppanel.ViewDragHelper.create(ViewDragHelper.java:348) E/AndroidRuntime(21723): at com.sothree.slidinguppanel.ViewDragHelper.create(ViewDragHelper.java:361) E/AndroidRuntime(21723): at com.sothree.slidinguppanel.SlidingUpPanelLayout.(SlidingUpPanelLayout.java:334) E/AndroidRuntime(21723): at com.sothree.slidinguppanel.SlidingUpPanelLayout.(SlidingUpPanelLayout.java:263) E/AndroidRuntime(21723): ... 26 more

tokudu commented 10 years ago

According to this, there might be something wrong with your test project: http://stackoverflow.com/questions/11155340/java-lang-illegalaccesserror-class-ref-in-pre-verified-class-resolved-to-unexpe

marcthomas2013 commented 10 years ago

I have found out what the issue is now, I needed to add exclude module: 'support-v4' to the list of excludes already in the Robolectric androidTestCompile declaration.