Convert existing project to Android project in Eclipse?

How to convert an existing project to an Android project in Eclipse?

In particular, I want to convert a plain old Java project into an Android library project.

Thank.

+50
android eclipse
Jun 02 '10 at
source share
7 answers

What subsystem / plugin are you using to develop Eclipse Android?

Generally speaking, the process is called “changing the nature of the project", for example.

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

+14
Jun 02 2018-10-02T00:
source share

You need to change the nature of the project (this has already been answered, but no one gave the line you need).

  • Close eclipse
  • Open the .project file in your project
  • Make the natures section look like this:

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

Launch eclipse again, have fun.

Note. If you use maven , you can customize the nature of the project in your folder, see maven eclipse plugin doc

+74
Jul 25 '12 at 16:15
source share

I had an application that was created using Eclipse 3.5 and used java projects instead of correctly created Android library projects. I'm not sure how it worked (the application was published and fined), but I could not get it to work when I tried to set up the development environment on another machine. I keep getting ClassNotFoundExceptions for references to a Java project.

Since I had a couple of years of registration history, I really did not want to translate the projects, as some of the answers claim. For me, converting a Java project to 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 "AndroidManfest.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 file "project.properties"

 target=android-7 android.library=true 
  • Create an empty folder from the project root for the called: "res"
  • Update in Eclipse
  • Right-click on the project, select "Android Tools", "Fix Project Properties" Rebuild

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

+21
Aug 24 2018-12-12T00:
source share

I met the same problem. Here are my steps:

  • create a new project for Android.
  • copy .project .classpath files to a plain old java project
  • update the plain old Java project in eclipse and then “Android Tools” will appear in the context menu when you right-click on the plain old Java project.
  • "Tools for Android" | "Fix project properties"

In the final step, Eclipse will add the “Android Resource Manager”, “Android Pre Compiler” and “Android Package Builder” to the “Builders” and will soon compile the project, create the “gen” folder, BuildConfig.java and R.java.

done.

+1
Aug 03 '13 at 8:29
source share

My decision:

  • Copy the AndroidManifest.xml and project.properties file to the root directory of this project.
  • Click File → Import, select Android → Existing Android Code in Workspace.
  • Configure the correct source code path and version of Android Lib.
+1
Aug 22 '14 at 5:42
source share

Do you know this guide ?

I don’t know if there is a way to convert an existing Java project, but if I didn’t offer to create a new library project, as described, and then move its code.

0
Jun 02 '10 at 17:19
source share

If I need to convert, I usually just create a new project and copy the files there.

If I took the time to do it right, it would be 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

0
Feb 19 '12 at 21:08
source share



All Articles