Convert existing project into Android project in Eclipse?

Convert existing project into Android project in Eclipse?



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.






Have you tried running the command line project update: android update project --path [projectpath]

– IgorGanapolsky
Dec 23 '13 at 21:30




7 Answers
7



What subsystem/plugin are you using for Eclipse Android development?



Generally speaking, the process is called "changing the project nature"
e.g.,



http://enarion.net/programming/tools/eclipse/changing-general-project-to-java-project/






Thanks Uri. That seems to be the first step of a (or the only) way to do this.

– hpique
Jun 2 '10 at 17:56






Thanks, worked for me! I created a new Android project and then copied parts of its .classpath and .project files over to my existing project.

– Pēteris Caune
Oct 3 '10 at 17:54






This answer could be made a lot more helpful if someone could supply the appropriate nature entry for Android projects.

– Torque
Oct 17 '13 at 17:57



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:


<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>



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






Works with just closing and reopening the project. No need to close Eclipse... at least it works in Indigo.

– WindRider
Jul 14 '13 at 19:47






And it did (and will) continue to do so in future releases of Eclipse because this is precisely what closing and reopening the project does: reading the .project-file

– avalancha
Nov 6 '14 at 13:39


.project



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


<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>



Add a simple "AndroidManifest.xml"


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.convertproject.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
</manifest>



Add a "project.properties" file


target=android-7
android.library=true



NOTE: when you add library to your main project, import using the Android / Libray tab (under project properties) instead of Java Build Path / Projects






after doing your suggestions, I still have to delete the project and reimported again for eclipse considering it as android project

– omega
Dec 13 '12 at 11:59






typing error "AndroidManifest.xml" missing letter 'i'

– Robert
Sep 5 '18 at 7:48






If you are using andmore eclipse plugin, you may add the nature <nature>org.eclipse.andmore.AndroidNature</nature> instead.

– Robert
Sep 5 '18 at 8:01



<nature>org.eclipse.andmore.AndroidNature</nature>






This should be the accepted answer. It is correct and fully comprehensive.

– Robert
Sep 5 '18 at 8:02



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.



My solution is:



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.






Yes, I'm aware of it, but it's more about converting an existing Android project into an Android Library project. Building a new project from scratch is not that hard, but I wanted to know if there was an easier way to do it.

– hpique
Jun 2 '10 at 17:58



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



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế