How do you convert an existing project into an Android project in Eclipse?
In particular, I want to convert a plain old Java project into an Android Library project.
Thanks.
How do you convert an existing project into an Android project in Eclipse?
In particular, I want to convert a plain old Java project into an Android Library project.
Thanks.
I met the same problem. Here are my steps:
In the last step, Eclipse will add "Android Resource Manager", "Android Pre Compiler" and "Android Package Builder" into "Builders" and soon compile the project, create the "gen" folder, BuildConfig.java and R.java.
done.
You need to change the nature of the project (this has already been answered, but nobody gave the actual string you need for that.)
Make the natures section look like:
Start eclipse again, have fun.
Note: If you are using maven you can configure the project's nature in your pom, see the maven eclipse plugin doc
I had an app that was built with Eclipse 3.5 and used java projects instead of properly built Android Library projects. I'm not sure how it originally worked (the app was published and worked fined), but I couldn't get it to run when I tried setting up a dev environment on a different machine. I keep getting ClassNotFoundExceptions for references to the Java project.
Since I had a couple years of check-in history, I really didn't want to move projects as some answers stated. For me, converting the Java project into a proper Android Library made more sense.
Here are the steps I had to take to get it working:
Add AndroidNature to ".project" file
Add a simple "AndroidManifest.xml"
Add a "project.properties" file
NOTE: when you add library to your main project, import using the Android / Libray tab (under project properties) instead of Java Build Path / Projects
Are you aware of this guide?
I don't know if there's a way to convert an existing Java project, but if not I'd suggest building a new library project as described and then moving your code to it.
If I have to convert I usually just create a new project and copy the files in there.
If I took the time to do it properly, it would've been a Mavenized project which I can just import. You can look at my app to help you get some ideas. https://github.com/trajano/GasPrices
My solution is: