在哪里可以找到android.support.v7.mediarouter.R $ ATTR? [英] Where do I find android.support.v7.mediarouter.R$attr?

查看:294
本文介绍了在哪里可以找到android.support.v7.mediarouter.R $ ATTR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实例化一个android.support.v7.app.MediaRouteButton对象时得到一个未处理的异常。我得到:

I'm getting an unhandled exception when instantiating an android.support.v7.app.MediaRouteButton object. I get:

NoClassDefFoundError: android.support.v7.mediarouter.R$attr

这是哪里上课?或者如果它是自动生成的,我怎么得到它的自动生成?

Where is this class? Or if it's auto-generated, how do I get it to auto-generate?

我的教程Android应用开发的Chromecast这里找到沿着以下内容:<一href=\"https://developers.google.com/cast/cast_2nd-screen_app_tutorial\">https://developers.google.com/cast/cast_2nd-screen_app_tutorial

I am following along with the tutorial for Android app development for chromecast found here: https://developers.google.com/cast/cast_2nd-screen_app_tutorial

我使用的是ADT捆绑日食,在Ubuntu 13.04开发。

I am developing using the ADT bundled eclipse, on ubuntu 13.04.

我输入下面的jar文件到libs目录就在我的工作区,并通过包括他们在我的Java构建路径添加罐...按钮的Java构建路径面板的库标签我的项目的性质:

I imported the following jar files into a libs directory right in my workspace and have included them in my Java Build Path via "Add Jars..." button in the "Libraries" tab of the "Java Build Path" panel of my project's properties:


  • GoogleCastSdkAndroid-1.0.0.jar

  • Android的支持 - v4.jar

  • Android的支持-V7-appcompat.jar

  • Android的支持-V7-gridlayout.jar

  • Android的支持-V7-mediarouter.jar

我有一个单一的活动(默认的Hello World由Eclipse的创建),并没有修改的布局。只有code我需要添加到导致错误(粘贴以下),显示是这样的:

I have a single activity (the default "hello world" created by Eclipse), and have not modified the layout. The only code I need to add to cause the error (pasted below) to show is this:

import android.support.v7.app.MediaRouteButton;
...
MediaRouteButton mrb = new MediaRouteButton(this.getApplicationContext());

当我建立并运行应用程序我看到LogCat中粘贴下面的错误信息(我可以发布更多的它,如果有人觉得这是有关)。我注意到的关键事情是,我似乎缺少android.support.v7.mediarouter.R $ ATTR(NoClassDefFoundError的),而且它正在从android.support.v7.app.MediaRouteButton的构造函数叫做

When I build and run the app I see the error message pasted below in LogCat (I can post more of it if anyone feels it's relevant). The key things I notice are that I seem to be missing android.support.v7.mediarouter.R$attr (NoClassDefFoundError), and that it is being called from android.support.v7.app.MediaRouteButton's constructor

08-12 00:36:02.837: E/AndroidRuntime(29600): java.lang.NoClassDefFoundError: android.support.v7.mediarouter.R$attr
08-12 00:36:02.837: E/AndroidRuntime(29600):    at android.support.v7.app.MediaRouteButton.<init>(MediaRouteButton.java:117)
08-12 00:36:02.837: E/AndroidRuntime(29600):    at android.support.v7.app.MediaRouteButton.<init>(MediaRouteButton.java:113)
08-12 00:36:02.837: E/AndroidRuntime(29600):    at com.jeffbmartinez.helicast.MainActivity.onCreate(MainActivity.java:31)
...

这是运行MediaRouteButton的构造,这一事实让我相信的jar文件被正确地发现,所以我不认为我错误地配置相对于依赖关系(JAR文件)蚀。但是,我的理解是,这些'R'文件是自动生成的。如果这是正确的,哪里是我的android.support.v7.mediarouter.R文件?我没有看到它的根目录下,这哪里com.jeffbmartinez.helicast.R文件被放置。

The fact that it is running the MediaRouteButton's constructor leads me to believe the jar files are being properly found so I don't think I misconfigured eclipse in relation to the dependencies (jar files). However, my understanding is that these 'R' files are auto-generated. If this is correct, where is my android.support.v7.mediarouter.R file? I do not see it in the gen directory, which where com.jeffbmartinez.helicast.R file is being placed.

此外,我觉得很奇怪的是,MediaRouteButton指的是我不能在任何上面列出的5缸依赖找到包的名字。 Android的支持-V7-mediarouter.jar只包含 android.support.v7.app。* android.support.v7.media。*

Furthermore, I find it curious that the MediaRouteButton refers to a package name that I cannot find in any of the 5 jar dependencies listed above. android-support-v7-mediarouter.jar contains only android.support.v7.app.* and android.support.v7.media.*.

唯一的地方,我觉得参照 android.support.v7.mediarouter ,除了我的错误日志,在<一个href=\"https://developer.android.com/reference/android/support/v7/mediarouter/package-summary.html\">https://developer.android.com/reference/android/support/v7/mediarouter/package-summary.html但有一点信息没有。

The only place I find reference to android.support.v7.mediarouter, aside from my error logs, is at https://developer.android.com/reference/android/support/v7/mediarouter/package-summary.html but there is little information there.

我缺少的依赖?如果是这样,我在哪里可以得到它我怎么产生的呢?

Am I missing a dependency? If so, where do I get it or how do I generate it?

谢谢!

推荐答案

您不能只包含的罐子。您需要将 android.support.v7.mediarouter 项目中添加作为一款Android库的依赖。这样一来,从项目的资源将得到合并到自己的。

You can't just include the jars. You need to add the android.support.v7.mediarouter project as a Android Library dependency. That way, the resources from the project will get merged into your own.

mediarouter 文件夹运行 Android的更新的lib项目-p。,然后你可以将其添加为依赖。

Inside the mediarouter folder run android update lib-project -p . and then you can add it as a dependency.

这篇关于在哪里可以找到android.support.v7.mediarouter.R $ ATTR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆