Android Chomecast Sender App:MediaRouteActionProvider

时间:2014-07-04 17:24:20

标签: android google-cast

我的Android Chromecast发件人应用有问题。这是我的第二个发件人应用程序,所以一般来说,我有基础知识。

什么是对的:

当我直接从Eclipse运行应用程序时,它适用于我的两个测试设备。 当我直接从Android Studio运行应用程序时,它可以在我的两个测试设备上运行。

问题:

当我通过BOTH Eclipse和Android Studio生成签名的APK时,应用程序在两个设备上达到“强制转换活动”时崩溃。

logcat错误如下:

07-04 12:39:54.887: W/SupportMenuInflater(31144): Cannot instantiate class: android.support.v7.app.MediaRouteActionProvider
07-04 12:39:54.887: W/SupportMenuInflater(31144): java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.MediaRouteActionProvider" on path: DexPathList[[zip file "/data/app/com.victuallist.shred-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.victuallist.shred-1, /vendor/lib, /system/lib]]
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.internal.view.f.a(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.internal.view.f.b(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.internal.view.d.a(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.internal.view.d.inflate(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at com.victuallist.castgame.CastGameActivity.onCreateOptionsMenu(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.app.Activity.onCreatePanelMenu(Activity.java:2538)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v4.app.k.onCreatePanelMenu(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.a.g.a(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.a.n.a(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.a.g.onCreatePanelMenu(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.support.v7.a.o.onCreatePanelMenu(Unknown Source)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:436)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:800)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:221)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.view.Choreographer.doFrame(Choreographer.java:543)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.os.Handler.handleCallback(Handler.java:733)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.os.Handler.dispatchMessage(Handler.java:95)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.os.Looper.loop(Looper.java:136)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at android.app.ActivityThread.main(ActivityThread.java:5001)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at java.lang.reflect.Method.invokeNative(Native Method)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at java.lang.reflect.Method.invoke(Method.java:515)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-04 12:39:54.887: W/SupportMenuInflater(31144):   at dalvik.system.NativeStart.main(Native Method)
07-04 12:39:54.897: D/AndroidRuntime(31144): Shutting down VM
07-04 12:39:54.897: W/dalvikvm(31144): threadid=1: thread exiting with uncaught exception (group=0x41611ba8)
07-04 12:39:54.897: E/AndroidRuntime(31144): FATAL EXCEPTION: main

更新:似乎我有它的工作。我禁用了proguard。尽管它已经运行,我仍然有兴趣知道为什么我遇到了这个问题。任何提示将不胜感激。感谢。

2 个答案:

答案 0 :(得分:6)

ProGuard不会检查菜单资源等内容,以尝试查找需要免于混淆的类。您从资源中引用的任何类都需要保持不变,通常是在ProGuard配置中使用某种-keep指令。

可能发生的事情是ProGuard对MediaRouteActionProvider进行了模糊处理,因此编译了代码,但是Android无法通过其未混淆的名称找到该类。

答案 1 :(得分:2)

在proguard文件中添加3行...

-keep        class android.support.v13.** { *; }
-keep        class android.support.v7.** { *; }
-keep        class android.support.v4.** { *; }

将解决所有支持库中未找到类的问题。