导入 android.support.v7.app.MediaRouteActionProvider 无法解析

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21876435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:14:21  来源:igfitidea点击:

The import android.support.v7.app.MediaRouteActionProvider cannot be resolved

androidandroid-maps-v2

提问by Developer

I am trying to use GoogleMap V2 .But i am getting error on import these :

我正在尝试使用 GoogleMap V2 。但我在导入这些时遇到错误:

import android.support.v7.app.MediaRouteActionProvider;
import android.support.v7.media.MediaRouteSelector;
import android.support.v7.media.MediaRouter;
import android.support.v7.media.MediaRouter.RouteInfo;

And the error is

错误是

The import android.support.v7.app.MediaRouteActionProvider cannot be resolved

Here is the screen shot of the library that i have added

这是我添加的库的屏幕截图

enter image description here

在此处输入图片说明

What i have to do .I have tried to import android\support\v7By Build path .But it is not resolving my issue in there any way so that i can resolve these errors.

我必须做什么。我尝试通过构建路径导入android\support\v7。但是它并没有以任何方式解决我的问题,因此我可以解决这些错误。

采纳答案by Raghunandan

It looks like you have added gridlayout.jar to the projects lib folder.

看起来您已将 gridlayout.jar 添加到项目 lib 文件夹中。

Its a library project with resources. You need to reference the library project in your android projet

它是一个带有资源的图书馆项目。您需要在您的 android 项目中引用库项目

This library is located in the <sdk>/extras/android/support/v7/gridlayout/directory after you download the Android Support Libraries.

此库位于<sdk>/extras/android/support/v7/gridlayout/您下载 Android 支持库后的目录中。

Follow Adding libraries with resources

按照添加资源库

http://developer.android.com/tools/support-library/setup.html#libs-with-res

http://developer.android.com/tools/support-library/setup.html#libs-with-res

回答by SoliQuiD

had the same problem and found that the linkin my project to the appcomcat_v7 projectis broken (right-click project and choose properties, then head to the Android tab)...

遇到了同样的问题,发现我的项目中到appcomcat_v7 项目链接已损坏(右键单击项目并选择属性,然后转到 Android 选项卡)...

i removed and then added the correct project and i was good to go...

我删除然后添加了正确的项目,我很高兴去......

enter image description here

在此处输入图片说明

回答by Vivek Warde

These type of Errors generally occurs when we accidentally close these libraries(by close unrelated projects,etc) which are automatically generated In Project Explorer of Eclipse like:

当我们不小心关闭这些在 Eclipse 的项目资源管理器中自动生成的库(通过关闭不相关的项目等)时,通常会发生这些类型的错误,例如:

  • appcompat_v7
  • appcompat_v7_2
  • appcompat_v7_3
  • appcompat_v7_4
  • appcompat_v7_5
  • appcompat_v7_6
  • appcompat_v7_7
  • appcompat_v7_8
  • appcompat_v7_9
  • appcompat_v7_10
  • appcompat_v7_11
  • appcompat_v7_12
  • appcompat_v7_13
  • appcompat_v7_14
  • appcompat_v7
  • appcompat_v7_2
  • appcompat_v7_3
  • appcompat_v7_4
  • appcompat_v7_5
  • appcompat_v7_6
  • appcompat_v7_7
  • appcompat_v7_8
  • appcompat_v7_9
  • appcompat_v7_10
  • appcompat_v7_11
  • appcompat_v7_12
  • appcompat_v7_13
  • appcompat_v7_14

As soon as I open these files,all the errors in my app were vanished !

一旦我打开这些文件,我的应用程序中的所有错误都消失了!

If It till then didn't work then do Project -> Properties -> Android -> Is Library -> Add.. -> And add appcompat_v7_*

如果它在那之前不起作用,那么做 Project -> Properties -> Android -> Is Library -> Add.. -> And add appcompat_v7_*

回答by ban-geoengineering

I had a very similar problem to this after I had used force to close Eclipse.

在使用强制关闭 Eclipse 后,我遇到了与此非常相似的问题。

When I then restarted Eclipse, I noticed a number of "appcompat_v7..." folders in my workspace directory. I deleted these - and maybe that was the cause of this problem.

当我重新启动 Eclipse 时,我注意到我的工作区目录中有许多“appcompat_v7...”文件夹。我删除了这些 - 也许这就是这个问题的原因。

But I resolved it by creating a new Test project in Eclipse, then restarting Eclipse to find all my projects compiled again! :)

但是我通过在 Eclipse 中创建一个新的 Test 项目来解决它,然后重新启动 Eclipse 以找到我再次编译的所有项目!:)

I didn't need to change any project properties.

我不需要更改任何项目属性。

回答by Jorgesys

this solution worked for me:

这个解决方案对我有用:

The support library android-support-v4.jarcause this conflictand you see the error: The import android.support.v7.app.MediaRouteActionProvider cannot be resolved, just delete the library under /libs folder of your project, because the library is already contained in the library appcompat_v7, clean and build your project, and your project will work like a charm!

支持库android-support-v4.jar导致此冲突,您会看到错误:The import android.support.v7.app.MediaRouteActionProvider cannot be resolved,只需删除项目 /libs 文件夹下的库,因为该库已包含在库中appcompat_v7,清理并构建您的项目,您的项目将像魅力一样工作!

enter image description here

在此处输入图片说明