I followed the instructions by the facebook, everything is good before adding reference to the facebook library. As mentioned in the title, the R.java just disappeared, making the whole project unable to run.
I tried to delete the gen folder, cleaned the project, rebuilt it, but it did no good.
The project runs without facebook, but I have to implement the facebook function to get the project done. Anyone could help?
it is probably that there are now two R.java, one in your project and the other one in facebook. Try to manually put the import back, like, com.yourpackage.R and see if that fixes the problem.
Related
OK, I have been wanting to try the new ActionBarCompat, however, I am not able to run my programs in the emulator.
I have been trying to implement the following: http://antonioleiva.com/actionbarcompat-how-to-use.
and have been stuck on basically the first part. However, working with the author of that content, I was able to get further as I was not adding the project under sdk\extras\android\support\v7\appcompat folder like stated. However, I still think that might be the reason I cannot do this...
More detail can be found here: http://antonioleiva.com/actionbarcompat-how-to-use/#comment-43
Basically, on my first attempt, I just created an Android project, and changed the source code as indicated. Code would not run on the emulator. So I went back to the original code, and that ran on the emulator.
Checked online, found out I might need to add the \extras\android\support\v7\appcompat folder as a library to the project I am building. So I added that and a new android project was created. There were build errors from the start, but I failed at trying to add it as a library to my project, and deleted it....thinking this was way overboard.
After back and forth chats with author of linked website, I found out I had to do that overboard thing.
So I tried the following link to the T: (I cannot post more than 2 links due to low repuation...I will add this link as a comment below)
However, Eclipse would not allow me to add the appcompat Existing Android Project...but it did allow me to add the appcompat Existing (General) Project. I think this may be some of the problems??
Right now, I cannot run the project at all. Eclipse is showing a red exclamation mark on the project folder, but all the code seems to be fine. So I don't know what to do now...I recreated this project several times over, and this one was the one where I knew what to do...and I am still getting problems
So...
I decided to move to Android Studio...updated the IDE, updated the SDK manager to include the new support library, and other things. Created a new project, added to the build.gradle file as shown in the link provided below in the comment. I ran the ant build, and then built the project...tried to import the right things to allow ActionBarActivity, but I could not get that far.
I can import
"android.support.v7.*"
"android.support.vy.R" // and all folders within
but nothing allows me to add ActionBarActivity, and I don't know why.
FYI, I guess I would prefer a solution to Ecplise, as it seems like I actually got somewhere with it.
The best example to use is from here, and I would follow it closely. I had similiar issues when I first came across this. Problem was I misunderstood what I needed to do
http://developer.android.com/tools/support-library/setup.html#libs-with-res
I know that there are two post like this one in Stackoverflow (this and this) but I already tried what is described there without any result and I have the feeling that I'm running out of options.
This screenshot is from one of these two posts, but is exactly what I also see.
In my case, I was never able to make the googlemaps work and I tried to import and copy the stuff in so many different ways that I guess is what lead to the actual situation. In my last attempt, I was going to try to follow the steps described in this post, which seems to be the most accurate one, but as I said, now I just can't import the google-play-services_lib because keeps telling me that is in use.
I made sure that I deleted the project from my workspace and any other place where it could be stored by searching for it.
Does anyone have an idea that is not described in the other two posts? Creating a new workspace and importing my project and then the google-play-services_lib could be a solution or the problem is of another nature? Is there a way of obtaining more information about the error shown by Eclipse in order to fix it?
project name already exist on workspace most of time may be named as mainactivity (or other name) try to rename change existing project name and after try to import it!
e.g following steps
first screen shot shows your same error
after click select all button shows actual error explains below screen shot:
note this screenshot error message is Cannot import MainActivity because the project name is in use after shows project name rename on existing workspace on your eclipse after try again import it will work perfectly!
google-playservices.lib is in use by another Project.
Check following
close the project who is using it with right click close
remove the reference from the project who is using it.
I you don't have the library project in your eclipse works space and you still receive this message, you can just close eclipse, go to you workspace folder and manually delete the google-play-service library from there. then open eclipse and try to add the project again.
I'm sure there are better ways to do it, but I ended up creating a new workspace, importing my project and then importing the google-play-services_lib.
I downloaded a an android project folder from a friend (the app works). In eclipse, I created a new Android project from existing code. However, there are errors at the lines calling the layouts/ids from R.java. Example: R.layout.my_layout
I tried cleaning the project, and deleting the project and creating it again. The code should be working. I checked R.java to make the sure the name matches. Note that I am an advanced-beginner at Android, so I know the basics. Please help, thanks.
if you downloaded the project from a friend, you shouldn't be creating a completely new project, but choose "new project from existing source".
try looking in the project properties under Android, many times, the import screws up the properties and moves the target SDK to the lowest possible and you'll need to change that"
it sounds stupid- but try clearing you project, make a simple change in code, save and rebuild.
i hope that'll fix your problem,
another thing- make sure u didnt imported any android.R.### class - if u did erase those lines.
Wops.
What errors are you getting in console from eclipse? Error messages are usually need to help. My only suggestion without seeing the build errors is to check your import statements. Sometimes eclipse inserts bogus import to the R classes.
I have been trying to use FBConnect in my app but whenever I try to reference the SDK, it doesn't quite do it.
This is the screenshot
Please help. I am stuck for past 4 hours. Nothing found on google or here on SO
Refer to this page: http://www.mobisoftinfotech.com/blog/android/845/. Seems like you should add the JAR file. What you did here is add a library - an open project in Eclipse that serves as a library for another project.
Clarification: when you click add, you see "FacebookSDK". It shows as valid until you close the properties dialog. Then when you open the dialog again, it has a red X next to it.
If that is what is happening to you... I ran into the same thing a long time ago. The facebook sdk needs to be in the same parent folder as your project.
For example, if you are running out of c:\users\me\workspace\my cool project,
the facebook sdk needs to be in c:\users\me\workspace\facebook-android-skd-2.0.2.b
No idea why, but after beating my head against the wall over this for a couple of days I figured it out.
I'm trying to add the facebook SDK to my project but it won't work at all.
I've followed the official steps; opened the fb sdk, made sure it's set to "is library", in m yown project go to properties->android->add library and it lets me select com_facebook_android and it shows up with a green tick next to it. HOWEVER, when i go back to that screen straight away it now has a red cross next to it, and if i try to launch the app in the emulator it has " com_facebook_android] Could not find com_facebook_android.apk!"
(This is just me testing without referencing the library in my app)
if i DO reference the library, then any calls to the facebook library give an error within eclipse and the tooltip suggests to add it to build path, so if i click that it launches fine, but still does the above apk error and the app force closes on any activity which references facebook.
As far as I can tell I'm following the official instructions fine but it just keeps coming back to that red cross in my app's properties
Does anyone know what this could be?
Not sure why you have the issue, i've setup a empty project with facebook library in it, if you have no luck then try downloading that, unzipping it and importing exsiting project into workspace.
link : Download here
you know what i have done one trick to use the official facebook SDK in my application, i have created com.facebook.android and add all the library classes into it. Then i can easily reach to access any class whenever i want it. This can be a way to use the classes inside your application instead of using Library.
Its running fine in my case.