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

I am trying to use GoogleMap V2 .But i am getting error on import these :
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
What i have to do .I have tried to import android\support\v7 By Build path .But it is not resolving my issue in there any way so that i can resolve these errors.

It looks like you have added gridlayout.jar to the projects lib folder.
Its a library project with resources. You need to reference the library project in your android projet
This library is located in the <sdk>/extras/android/support/v7/gridlayout/ directory after you download the Android Support Libraries.
Follow Adding libraries with resources
http://developer.android.com/tools/support-library/setup.html#libs-with-res

had the same problem and found that the link in my project to the appcomcat_v7 project is broken (right-click project and choose properties, then head to the Android tab)...
i removed and then added the correct project and i was good to go...

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:
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_*

I had a very similar problem to this after I had used force to close 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.
But I resolved it by creating a new Test project in Eclipse, then restarting Eclipse to find all my projects compiled again! :)
I didn't need to change any project properties.

this solution worked for me:
The support library android-support-v4.jar cause 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!

Related

Android Studio can not find R when importing module

I was trying to import an Eclipse "library project" as module to Android Studio.But I am consistantly getting "Cannot find R.java" error.The weird thing is the module has already R.java in /gen file.What am I supposed to do?
Thank you in advance!
EDIT:I have already an app in Android Studio.Now I am trying to import a library project to it.So what I am doing is open the project(my actual app),then File-Import Module in Android Studio.But getting the above error.
You need to import your library using gradle (assuming you are using gradle). After that you would have several R.java to choose from based on their package.
Try this File > Settings > Compiler > check use-in progress checkbox. then rebuild the project. I hope it helps.

Import Android project not select 'copy project into workspace' error

I have a problem with importing Android project to Eclipse in three scenario:
I have clone my Android project from Bitbucket and synchonized with Eclipse workspace successfully! But the project raise many error.
Then I remove my project and using import function in android (File>import project). I import the project from repo and also check to 'copy project into workspace', awesome! the project work perfectly.
Then I testing again. I also use import function and not check on 'copy project into workspace', oh no, the project keep the error like scenario 1.
We've always had this issue - however, we face it in P4 SCM.
I guess the problem would be the same, anyway - your project may not be detected as an Android project.
First create a new Android Project. Now, go to Navigator in Eclipse (Window -> Show View -> Navigator) and open .project file - copy it's contents and paste in your (imported) project's .project file. This should fix it.
Make sure to make the required changes (the project name is the only change we usually make) after copying.

Why i am getting invalid project description while importing project?

I am trying to import an existing project in eclipse. However i am getting this error in the snapshot below.
This problem only exists when i try to import from my workspace. However if the same project is somewhere else, then i am able to import it successfully.
I also faced the same problem. The trick bellow solved my problem:
check the box Copy project into workspace while importing the existing project.
you have two solutions and they works:
1- move your project package from workspace and place it in another root, then import to eclips.
or
2- rename your project package and then add it and it will fix the problem.
you have a project named X in your workspace still you are trying to import another project named X . you can fix it by deleting the existing project in eclipse and retry importing.
Fixes
You can change your workspace and import this project in to the new workspace
delete the project from eclipse and import without using copy project in to workspace
Android -> Existing Android Code Into Workspace, You must use General->Existing projects into workspace. It's probably a solution
You should change workspace path.
For to do Change The Workspace Path:
I have checked all the solution and finded that in most of cases "Changing the Project location" form Workspace worked in 80% cases. But for next 20%,i would recommend to do following:
Change the folder of Project and then Import it. (first do this)
If above does not worked, Rename the Project and then try importing it.
If still you are not getting success,check whether you are importing the project from 1 workspace folder to other or not.IF yes,then while importing the projects,check the option "Copy project into Workspace".
And even if you are not getting success, clik import --> General --> Existing Project into Workspace.
PS --> If this solution worked for you,please vote-up as i am newbie here and hence need that to participate in major questions and answers.

Importing google-play-service library showing a red X next to this reference android

Am trying to add google-play-service library in my project using import(For Google map). After adding the path am getting red X next to this reference and the reference is not adding . Know how to resolve this ?
The red X means its a broken link path.
http://developer.android.com/google/play-services/setup.html
Copy the google-play services_lib library project to your workspace (folder where your android map project is). The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Import the library project to your eclipse
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.
Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply
Eclipse does weird things when importing an existing project (google-play-services-lib), especially if you try to import and then allow the project to be automatically 'copied' to your workspace. I had the same issue and here is how I fixed it:
Close Eclipse
Erase all google-play-services projects from your workspace
Manually copy the google-play-services-lib folder (....sdk\extras\google\google_play_services\libproject\google-play-services_lib) into your workspace
Open Eclipse
Add a new project, choosing 'Existing Android Project', then navigate to your workspace and add the newly copied google-play-services-lib project
Finally, add the google-play-services-lib to your project as a library (just like you normally would)
Hope this helps! :)
Though it's over a year for this question but never the less thought of putting it down here. Might help some one facing a similar issue.
While doing a File -> Import one probably might have selected the folder,
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\
instead of
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\libproject\google-play-services_lib
Quite strange as Eclipse did not correctly copy the google-play-services_lib project in my workspace, but this caused a cross mark to appear in my Project Properties.
got a perfect solution for your question. this problem is due to improper referencing of library projects. You need follow these step.
create a new project
copy all the java files from src of your previous project in which you are getting error to the new project you have created just now.
Also copy layouts xml files.
now import play services you will not get this error.
I was also getting same problem.
I copied google library folder into work space and import now it's working fine.
Try to place the Google-play-service library with in your same working Directory by coping the files from Click File > Import, select Android > Existing Android Code into Work space, and browse the work space import the library project.
This is common issue Youur google-play-service-lib project and your android project should be inside the same folder For example
if your Android Appplication name is MyMap is in D:/workspace t hen your play service lib project should be in the same directory D:/workspace
Close Eclipse. Delete
.metadata
and
.recommaditions
folders from your workplace. Import your projects back.
You add Project in to your workspace.
Start Eclipse and import project one option is ther copy to workspace do it.
After that add google play services it also copy in to your work space
and add it your library hope so its working.

Cannot import google-play-services_lib because the project name is in use

I've done an application which displays a Google map referring this tutorial
http://www.vogella.com/articles/AndroidGoogleMaps/article.html
The application has worked fine and it displayed a Google Map as shown in the tutorial. But now, when I open the project, it shows several errors relating to the import of com.google packages. I've already added the google_play_services_lib. But now, that is not shown in the application. When I try to import the google_play_services_lib again, this error appears,
"Cannot import google-play-services_lib because the project name is in
use"
What is the problem? Please help me.
This generally occurs, if you have a project or folder by the same name existing in your workspace.
In general, You can solve it by changing the name of the existing folder using 'F2' shortcut key. But, since this is a library I recommend you to shift the existing folder "google_play_services_lib" from your workspace directory to somewhere else and then again try and import the "google_play_services_lib" .
this means that google-playservices.lib is using by another projects, you can solve it by.
remove the reference to it from the project which is using it.
OR close that project using eclipse->right click->close.
Remove this project from your workspace then import from your sdk place.
[http://developer.android.com/google/play-services/setup.html#Install]
It seems that when you import google-play-services_lib, Eclipse creates a project by the same name. Even though I deleted manually the google-play-services_lib folder from my workspace folder, I also had to delete the google-play-services_lib project in Eclipse as well. After doing it, I was able to import the lib, and then use it in my project.

Categories

Resources