Eclipse, or Android is changing my project.properties file when I import a project from existing source.
When I "export" an existing project from SVN, the project.properties file is referencing the correct SDK for that project:
# Project target.
target=Google Inc.:Google APIs:7
I can see this by opening the file in a text editor. I have not yet imported this as a project into Eclipse.
Then I choose to import it into Eclipse using File...New...Android Project from Existing Source.
Eclipse imports the project, and immediately shows the correct SDK in the project explorer window. Perfect so far.
After a second or so, I can see the SDK change to Android 2.1. Eclipse automatically made the change!
My project.properties file has been updated:
# Project target.
target=android-8
To summarise:
export project from SVN - project.properties points to Google API 7.
import this into Eclipse - project.properties automatically changes to Android API 8.
I have checked this on a different developer's machine - same behaviour. (i.e. Android SDK Tools 21.0.0 and 21.0.1)
Any ideas?
This is the Bug of Eclipse, currently nobody can do anything for it until eclipse developer resolve this bug.
See Bug Reported Here - Issue 40153: ADT import of project renames project, changes compatibility level
(Also this bug is very well written and mentioned there as compaired to asked here...LOL..BTW sorry for your unsolvable problem right now)
Thanks,
Happy to help.
Related
I am trying to import the latest version (4.0.1) of the Facebook Android SDK into eclipse but I am facing issues in having the project being properly built and imported as a Library.
I followed the steps (for android studio, ported to Eclipse) provided in the official guide and looked through Google for other developers having the same problems as I am having but I am still not able to have it properly working.
Here are the steps I do:
Download the Facebook SDK for android from here: https://developers.facebook.com/resources/facebook-android-sdk-current.zip
Extract the projects
In Eclipse, import existing Android code into workspace
Select the folder "facebook" and choose the only project that is shown (the project is properly imported)
Right click on "facebook" project, properties, android and check "isLibrary"
clean project
At this point I still have issues for annotations and classes not found from "android.support" package.
Project's setting for Java compiler is "1.6", minSDK is 9 and target is 17.
I tried also to add the facebook library to my main project but it is still not working.
I tried to put java 1.7 in the compiler but it is not resolving the missing classes plus it is saying that to compile with java 1.7 I need to have min API set to kitkat (which I don't want because I will not be able to compile for 4.2 and 4.3).
I added manually the androd support jar from the SDK Manager folder of android and this resolved partially the missing classes but some did remain.
I am using Eclipse Version: Luna Service Release 1 (4.4.1) with JDK 1.7.0_51 and the latest ADT Plugin (all android components updated with SDK Manager).
Any help is appreciated.
I did some more tests and find out that by downloading the two libraries:
android-support-v4.jar
bolts-android-1.1.2.jar
from the github project (https://github.com/facebook/facebook-android-sdk) did the trick.
So the steps are the following:
Download, unpack and import as android existing code into workspace the latest v.4 version of the Facebook SDK for Android.
Download the two jars from GitHub
Set the Facebook Project as "isLibrary"
Add the two jars as "external jars" in the classpath
Set the java compiler to 1.7
clean and rebuild the project
Now errors are gone.
Download the facebook sdk from here.
Extract the zip file.
Import only facebook sdk project into eclipse as "Existing Android code into
workspace".
Now, this project will show many errors, do not open any java file or
resource file and do not try to do any imports or clean project until I
mention it to do so.
First add the v7 library to this project by doing right click on facebook
sdk project >> properties>>android>>Add Library.(If you don't have latest
v7 support library download it from sdk manager), also set the project build
target to the maximum android version available and select "is library".
Now, right click on facebook project and select >Build path>Configure build
path>Libraries tab>Add external jars> browse to place where you extracted
facebook sdk in step 2 and find two jar files in libs folder(android-
support-v4.jar and bolts-android-1.1.2.jar) and add both files. Switch to
"order and export" tab and select both the jar files and click on ok.
Now right click on facebook sdk >>properties>>Java Complier>>set the
"compiler compliance level to 1.7 or more and use default compliance settings.
Now select the project and click on Project > Clean.
This should remove all errors now. This is how it worked for me.
Android Facebook SDK import occurs with errors - Eclipse
Check this out. May be this will help you.
I faced same problem while working in Android Studio.
But you are facing in Eclipse.
This is a bit weird and i am not sure how to put it. I am trying to integrate GoogleAnalytics SDK v4 from official site.
Here is what i have done till now..
Copied the google-play-services_lib folder from android-sdks/extras/google/google_play_services/libproject/google-play-services_lib and placed in my root folder of the application.
In Eclipse -> Imported the google-play-services_lib project into my workspace using File->Import->Android->Existing code into workspace, browsed to the root folder of application and imported it.
When i add google-play-services_lib to my project as library, using properties->Android->Library and selecting google-play-services_lib folder, my existing project gets corrupted.
The gen folder and bin folder becoming empty, hinting me that there is some problem with building the project. But, I am not sure what it is. What am i doing wrong?
May be useful for future readers...
The problem is with google-play-services_lib project. There are couple of things that you should do to overcome this. The problem occurs because google-play-sevices_lib project uses a minimum SDK version of 9 which is obsolete. So here is what you have to do.
Launch Android SDK Manager. At the bottom left, check the box that says "obsolete". Now you will find a folder for Android 2.3.1(9). Install all the contents of that.
Copy google-play-services_lib project from the android-sdks/extras/google/google_play_services/libproject/google-play-services_lib to your application folder and import it into the workspace.
Modify the AndroidManifest.xml of google-play-services_lib project. Change the minimum SDK version to >=10 or less than 9 (I had minimum of 8 in my app, so i changed it to 8).
Modify the project.properties file of google-play-services_lib project. Change target-9 to target-21(Lollipop is the latest version at present).
Add google-play-services_lib project as library to your project.
This should solve it.
I imported the Facebook SDK as library project into eclipse. I did it by checking Copy projects into Workspace and by leaving it unchecked as well (for some reason the description says that I must uncheck it).
I tried importing Existing Projects into Workspace and Existing Android Code Into Workspace as well.
The library checkbox is checked in the properties.
A Facebook sdk has never been imported into this workspace yet.
I created a new project that runs smoothly without Facebook. In the properties, Android tab, I added the library project. It showed a green tick, but when I open that tab again, it shows a red x.
The target of the project is API level 19, the target of the facebook library is API level 8. I also tried it with API level 10
I am using Java compiler 1.6 in both the project and the library.
What I don't understand is that the sample projects that came with the SDK seem to have successfully imported the SDK (green tick), however they all point to the same problem "The import android.support cannot be resolved" on import android.support.v4.app.FragmentActivity; I had to hover over the line and click Fix Project setup to make them work. Then I went to Properties -> Java Build Path -> Order and Export -> clicked v4 support library checkbox. So at least they work. Why do they successfully load the Facebook SDK and why is my app unable to do it?
The Facebook SDK has no libs folder so I guess an interference between different v4 support libraries is out of the question.
I have tried this on two different computers as well.
I decided to install Android from step to step instead of the ADT Bundle. I downloaded Eclipse Juno for Java Developers, installed the newest Java version (1.8) and installed the Android packages. Created a new project and imported the facebook sdk 3.5 (tried 3.0.2 and 3.8 as well). I still get the red X.
I appreciate any help.
I ran into this issue half a year later and my earlier answer was of no help. The trick is that you need to have the library on the same drive as your project, which is usually the C: drive. That's all. Thank you Facebook for not notifying us about this..
Solved. Here is what I did to solve this strange error.
Copy the contents of project.properties file.
Delete project.properties file.
Create a new file and name it project.properties
Paste the contents of the previous file into this new file.
I was working on an android tutorial and it wanted me to import the library from another project. All well and good. The import worked and the project works correctly. But I noticed that doing that messed up several of my other projects (the ones that use Android 2.2) by apparently messing with the build path. Now instead of seeing "Google APIs [Android 2.2]" under the gen folder I see "Unable to get system library for project". When I right-click the project and go to Properties I see that the correct Project Build Target is checked(Google APIs [Android 2.2]), but "Unable to get system library for project" is still shown above the assets folder and below gen and Android Dependencies. Cleaning all projects doesn't help. How can I fix this problem, and is there a way to fix this issue globally or do I have to do it one by one?
In the project root folder you should have file named project.properties
---- file content -----
target=android-16 ## <--- make sure that it is there and that you have proper sdk installed
For me, the problem was that in the Project settings - Android tab, I had no Android version selected.
For me I had SDK version 8 selcted, but if I selected the next highest version, applied, then selected version 8 again and apply, fixed the problem.
For me, what worked was to restart Eclipse. Hope this helps.
I seem to have botched up something in Eclipse. It isn't recognizing any of the libraries that I am trying to import.
Here are some of the things not being recognized:
import java.util.ArrayList;
import android.content.Intent;
import com.google.android.maps.MapView;
This is a open source project that I downloaded and then imported into Eclipse. I think I also downloaded the google apis the wrong way because things like MapView don't work in my other projects as well. Can someone please help me out?
Best,
Aneem
EDIT:
Fixed, most of the issues. Did it by hovering mouse to import line and clicking "Fix project setup..."
Now the only thing I have to do is get the google map related API to work.
To check if you have properly installed ADT
goto -> Window -> Preferences.
If you see Android (in the preferences), it means you have ADT installed.
To point to the valid SDK directory, click on Android. Specify the location in the SDK location.
Even if you have correctly installed ADT and SDK, there is a chance that eclipse may not recognize as the Android project if you import it(depends on the project & files).
Best thing is, to create a new Android project and copy the files from the imported project to the newly created Android project. This will definitely work.
Two things to consider:
Open project properties -> Android section, see if Android SDK is selected or not. if no SDK is selected just check it.
In project properties -> Java Compiler section, change "Compiler compliance level" to "1.6". This is because you have installed JDK 1.7 that has some problems with some packages!
Most likely your ADT plugin is not pointing to the Android SDK. Follow the instructions for installing and configuring the plugin:
http://developer.android.com/sdk/eclipse-adt.html
I right clicked on the project and selected properties and added Google APIs 2.3.3 as the target and did a project->clean and was able to launch the application. Many thanks.