Android Studio can not find R when importing module - android

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.

Related

No Resource found - Google Play Services version - Old Android Project

I am actually trying to open an old android project, which I have to edit. The project was coded back in Oct 14.
Now I downloaded the project from Github, and opened it in Android Studio via Import. When I try to build or debug, I get the error:
Error:(113, 28) No resource found that matches the given name (at
'value' with value '#integer/google_play_services_version').
After hours of searching in similar topics I did not find a solution that helped me.
Has anyone an idea how to solve the problem?
Try this below Methods,I hope this will help you.
Edit 1:
Import Eclipse Project to Android Studio:
1.Start Android Studio and close any open Android Studio projects.
2.From the Android Studio menu click File > New > Import Project. Alternatively, from the Welcome screen, click Import project (Eclipse ADT, Gradle, etc.).
3.Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok.
4.Select the destination folder and click Next.
5.Select the import options and click Finish.
6.The import process prompts you to migrate any library and project dependencies to Android Studio, and add the dependency declarations to the build.gradle file.
For detail description try this link
https://developer.android.com/studio/intro/migrate.html#migrating_from_eclipse
Edit2:
Remove the line in the project.properties file that was making reference to the google_play_services_version.
All the Best.

project structure file is missing in existing project in android studio

I opened existing project in Android Studio.There are some missing files and I am not able to run existing project. Any help is appreciated. There is no project structure file.
It depends on how you opened the project. Typically, I would open it by selecting the build gradle project.
Check out: Android Studio: import project from Gradle
If this does not help it may be helpful to let us know what files are missing exactly. A copy/paste or screenshot of the your logs may be useful.

Can't import library project into Android Studio project

I'm writing a library project to create a component that's going to be used in some, if not all, of our projects. I wanted to test how it's going so far, but I can't import the library project into my other project.
So, I created my library project called SplashScreen with Android Studio. Now I've created the project SplashScreenDemo with an Activity that should use the component I wrote in the library project. But the import wizard doesn't let me choose the project and all the info I find online is to import into Android Studio your old Eclipse library project, but in my problem Eclipse isn't involved at all.
So far I've tried:
Right click on project root > New > Module > Import Existing Project
File > Import Project
File > Import Module
This is the window (and that's the path to my library project):
I've tried several paths, none of them working:
/Users/dgc/AndroidStudioProjects/SplashScreen
/Users/dgc/AndroidStudioProjects/SplashScreen/SplashScreen.iml
/Users/dgc/AndroidStudioProjects/SplashScreen/build.gradle
/Users/dgc/AndroidStudioProjects/SplashScreen/app
/Users/dgc/AndroidStudioProjects/SplashScreen/app/app.iml
/Users/dgc/AndroidStudioProjects/SplashScreen/app/build.gradle
Any ideas? Am I missing something?
P.S.: Versions:
Android Studio 0.6.1
gradle 1.10
Android plugin 0.11.+
I think what's happening is that you're trying to import a module that has the same name as an existing module and it's not giving you any indication of what's wrong. Actually, if you enter just the path to the parent project so it will show you a list of modules you can import, and those modules can't be selected if you hover over one, it will show you the error message in a tooltip:
Obviously that's not very helpful, and I've filed a bug asking for improvements:
https://code.google.com/p/android/issues/detail?id=71942
To work around it, you'll have to rename either the module you're trying to import or the module in your project. To do that you can right-click on it in project view, choose Refactor > Rename > Rename directory.

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

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!

Android : can't import library in eclipse project

I'm really annoyed by eclipse ! I'm trying to use external project as a library (Sliding menu from J. Feinstein). The import of the library in eclipse is ok, but when I open the properties of my project and add it as a library, It doesn't work.
Eclipse tell me that it's ok, but when I build the project, I have an error telling me that eclipse can't find library.apk.
If I check the properties again, there is a red cross id front of my library.
Here is a little screenshot from the the properties window in eclipse.
http://snag.gy/4jnKk.jpg
Try to remove this row, and using "Add" connect your library project to current project.
If you have .jar file, copy it to libs folder and use "Properties - > Java Build Path - > Add jars".
I solved the problem by myself... I was using Egit plugin as CVS and it mess up something !
Now I'm using a console to handle git, and I've no problems anymore.. Thanks anyway :)

Categories

Resources