我在调试时遇到问题。这是我的情景:
我正在使用android studio。我转而使用appcompat-v7库。不幸的是,我只能访问受this issue影响的运行4.2.2(运气不好)的三星设备。我使用proguard提供的临时解决方案,在我的proguard文件中应用以下行。
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
-dontwarn retrofit.appengine.*
-dontwarn retrofit.client.OkClient
-dontwarn rx.internal.util.unsafe.*
使用上述行是因为我收到了此类错误,而这是我提供的解决方法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
如果我运行一个简单的" Hello World"在我没有使用改造来获取数据的应用程序中,我能够使用此proguard解决方法在我的Samsung 4.2.2设备的屏幕上获取ActionBarActivity。但是,当我运行使用改造的应用程序时,我得到以下堆栈跟踪。
我正在使用retrofit-1.8.0.jar和com.android.support:appcompat-v7:21.0.3
对此的任何见解都将非常感激。在此之前,我将避免使用appcompat库进行测试。
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)