2

I'm trying to post this as a question... but I when I try to submit it I get an error saying that code snippets are not blocked off.... help please!


I'm having trouble debugging this. Here's my scenario:

I'm using android studio. I'm switching to use the appcompat-v7 library. Unfortunately I only have access to Samsung devices running 4.2.2 (bad luck) which are affected by this issue. I'm using the temporary solution provided with proguard, applying the following lines in my proguard file.

-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
-dontwarn retrofit.appengine.*
-dontwarn retrofit.client.OkClient
-dontwarn rx.internal.util.unsafe.*

The above lines are used because I'm getting error of this sort, and this was the workaround provided here

Warning: retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
Warning: retrofit.client.OkClient: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning: rx.internal.util.unsafe.ConcurrentCircularArrayQueue: can't find referenced class sun.misc.Unsafe

If I run a simple "Hello World" application where I'm not using retrofit to fetch data, I'm able to get the ActionBarActivity on a screen of my Samsung 4.2.2 device using this proguard workaround. However, when I run my application that uses retrofit I get the following stack trace.

I'm using retrofit-1.8.0.jar and com.android.support:appcompat-v7:21.0.3

Any insight into this would be much appreciated. Until then, I'll just avoid using the appcompat libraries for testing purposes.

2-18 13:14:24.494    8430-8430/? E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tommcfarlin.occupantsurvey/com.tommcfarlin.occupantsurvey.SplashScreenActivity}: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2250)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
        at android.app.ActivityThread.access$700(ActivityThread.java:152)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5299)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
        at retrofit.RestMethodInfo.<init>(Unknown Source)
        at retrofit.RestAdapter.create(Unknown Source)
                                getMethodInfo
                                logAndReplaceRequest
                                logException
                                access$000
                                access$002
                                access$400
                                access$500
        at retrofit.RestAdapter$RestHandler.invoke(Unknown Source)
        at $Proxy0.b(Native Method)
        at com.tommcfarlin.occupantsurvey.model.RetrofitManager.fetchBuilding(Unknown Source)
                                                                fetchBuildings
                                                                access$000
        at com.tommcfarlin.occupantsurvey.SplashScreenActivity.onStart(Unknown Source)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1181)
        at android.app.Activity.performStart(Activity.java:5355)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
        at android.app.ActivityThread.access$700(ActivityThread.java:152)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:5299)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
        at dalvik.system.NativeStart.main(Native Method)
9
  • Also I don't know where this issue should be posted... please redirect if this is incorrect Dec 18, 2014 at 17:56
  • 1
    I assume the question is, why isn't the content after the second line allowed to be posted by the system? Dec 18, 2014 at 17:57
  • 11
    You should probably not use backticks for large blocks of code; just indent over four spaces.
    – Makoto
    Dec 18, 2014 at 18:00
  • Yes please. That exception looks horrible using code snippet highlights.
    – Compass
    Dec 18, 2014 at 18:01
  • 2
    An exception is usually block-quoted anyways, its not code Dec 18, 2014 at 18:03
  • 1
    @Bradley, a code block with syntax highlighting disabled may be a better choice, depending on the backtrace format. Dec 18, 2014 at 19:26
  • meta suggestion: where 'edit' button is grayed out (as it is on this question for me) a 'show formatting' button should appear alongside it.
    – greggo
    Dec 19, 2014 at 0:40
  • Thanks for the feedback.. I swear I tried making it look pretty the first time and something was bugging out making it not submittable nor easy to read. It's all tidied up and posted here: stackoverflow.com/questions/27558433/… Also, did I block-quote that correctly? It looks nice but is what I did follow Stackoverflow semantics? Dec 19, 2014 at 1:17
  • I removed the bug tag because this is not a bug. It's a mistake in the way you formatted the code, but the markup and site here are working correctly.
    – Ken White
    Dec 19, 2014 at 1:27

0

You must log in to answer this question.

Browse other questions tagged .