Convert Android project to 'regular' Java project inside Eclipse? - java

Ive inherited some code which started out as an Android project but really is just an API to be used by other applications. Hence, the 'build' process usually just produces a JAR file. The problem Im having is that I get errors from the Android build tools in my console which seem to fire everytime I make a change to some files. How do I fix that?
Im using Eclipse 3.5 (Galileo).

Check run configuration and remove any reference to the Android Sdk.
Create a new Java project and copy project files from the older Android project to the new Java one.

You should copy files: .classpath and .project from other working java project. Next you should edit .project with text editor and change SampleProject to YourProjectName

Related

Include existing source from Eclipse into Android Studio

I am trying to setup a project in Android Studio which includes several source files from an Eclipse project.
The Eclipse project has the following structure:
Library Project
It has a reference to several folders with java classes in them (included by link source)
Now I'd like to have these resources in my project/module in Android Studio too, but I can't find any possibility to achieve this other than copying them directly.
I'd like to avoid this because these files are part of a self written Java framework which is used in combination with GWT too. So copying these files instead of linking them means all changes have to be done twice.
Is it possible to include these sources similar to link source from Eclipse or is there another solution?
You could build your Eclipse project and reference it as a library in Android studio project. Then you would be able to access/use the required classes in the Android studio project.

How to add exisiting java source project to Android Studio

I have an existing git repository of pure Java code that I would like to add to my Android project.
I don't want to change any of the existing files. I want to keep my existing package names to simplify the maintenance of my legacy code.
In Eclipse, you can simply add the root of the existing project to your Java Build Path.
How to do the same in Android Studio?
I'm not sure this will help or not. But you may check these.
https://developer.android.com/sdk/installing/migrate.html
Unable to import Eclipse project to Android Studio
How to import eclipse project from git to Android Studio?
My solution to this was to Export my Java project to a JAR.
And then, I added the JAR to the Android Studio project.
File > Project Structure leads to this window:
That way, I could use my files untouched as such.
I am not so happy with this solution because it breaks my revision control system.

How do I add this Change Log library to my current Android project in Eclipse?

Okay, so I'm having difficulties implementing this Change log library into my android app in eclipse: https://github.com/gabrielemariotti/changeloglib
I tried using the clone url and importing the library into eclipse and then going into the properties of my android project and adding it as a library but that didn't work. I do not have Maven installed nor do I know anything about it. Is there a way I can just get a jar of this library somewhere? Can someone please help me? Thank you!
Its most likely not setup as an Android Library project and that is why it can't be accessed that way.
You can create the jar yourself though by using: https://stackoverflow.com/a/11289115/1784299 eclipse itself or running the jar command in a terminal. (Eclipse might be a little more user friendly if you don't use the terminal.
I would however highly recommend learning how to incorporate Maven in your projects because it is a huge time saver. If you migrate to Android Studio then Maven will become your best friend.
I answer here to help other devs with the same issue.
The library is built with the Android Studio folder structure.
I highly recommend to use the gradle build system to work.
Hovewer, you can build it locally with Eclipse.
All required steps are described here:
https://github.com/gabrielemariotti/changeloglib/blob/master/doc/BUILD.md#reference-this-project-as-a-library-in-eclipse.
It can be valid for a lot of libraries.
Eclipse uses src and res as source folders. Android Studio instead uses src/main/java and src/main/res as source folders.
So you have to mark the java folder as source (right click on folder -> Build-Path -> use as source folder)

Missing file R.java when creating ZXing library for my app

I'm trying to add the QR scan to my android app. I already know that it's advised to use the Intent method, but the app it's a university project and, therefore, we need to integrate it.
So, I downloaded the pre builded core.jar and the Zxing sources (version 3.0.1), then I created a new Android project with the files in zxing-zxing-3.0.1/android, and then added the core.java in the libs folder and in the build path.
Basically I'm at step 5 of this guide.
The problem is this: my errors do not disappears because the file R.java do not shows up.
I'm using the Android Developing Tools with Eclipse.
R.java is generated by the Android SDK build tools. You didn't build the project yet.
Try these:
look for errors in your layout XML-files
clean your project

R. Java file is not created in Android Application

R.java files are not being created in my project.
I have tried solutions like clean the project,removing .jar file from java build code.
Even though it is not working properly, how can I fix this?
Sounds like you're either not using Eclipse, and/or not using the Android eclipse plugin.
Take a look here: http://developer.android.com/sdk/installing.html
If you have not set android SDK then download and set sdk target
Try to clean your project and try to get error which type of error you are getting and solve it
Try to create a new project from existing java, xml, menifest and drawables
I think you are developing in Eclipse (java).
But you need to install the ADT Plugin (see here: http://developer.android.com/sdk/eclipse-adt.html)
After that you must download the Android SDK (Link)
In Eclipse you have to add the SDK.
Window->Preferences under Android -> SDK Location
Now create a new Android project or open an existing project like the API Demo.
The R.java file is generated automatically

Categories