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.
Related
So my friends and I are making a game for Android and we are using Android studio. We are using libgdx. We are also learning how to use github. Anyways, using Android Studio, I uploaded the basic libgdx setup. The one that just displays the Bad Logic image. My friend downloads it from github using Android studio but there are errors everywhere. It says that it can't find the badlogic package and it gives the following error:
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
I know that libgdx uses gradle. So what is the problem? Why can't we simply upload and then download a simple project?
Thanks!
Try to remove the .gradle directory and re-import the project or use the Setup App Installer from here to create a new gradle project.
Thanks for the help! I finally figured it out.
Basically, when I imported the project, I was just importing with existing project files. These are the steps I took to get it fixed.
Check out from Version Control using Android Studio and the welcome screen.
When asked to open, say NO.
Go to the folder that is associated with the repo.
Create a local.properties file there and in that file it should have
sdk.dir = /YOUR/PATH/TO/SDK/HERE
Then go back to Android Studio.
Click Import Project and select the folder that has it in there.
From then on, it should work forever as the .gitignore file that is generated by libgdx will ignore the local.properties file when pushed. I hope this helps someone!
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.
I have an existing project in Android Studio that I originally imported from Eclipse.
I haven't been using any specific build system to build my project other than the one provided by default with the Android Studio IDE (though the project was originally created with Eclipse.
I haven't been able to find a good tutorial of the steps. What's the recommended approach to add Gradle to this project?
Any help would be greatly appreciated.
Thanks!
I would recommend creating a new project in android studio as the folder structure used by gradle is different than the one used by eclipse. Then copy the files into their matching folder.
Here is a detailed description about the folder structure: https://developer.android.com/tools/projects/index.html
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)
I'm just starting my long way to Android programming and building app where I would like to use this library https://github.com/cfgxy/DevsmartLib-Android/tree/
This is another Android project, how should I include this in my project using Eclipse?
The contents of that repo's devsmartlib/ directory appears to be an Android library project. You can use such projects from Eclipse or from the command line as you see fit.
Create a new Android project in Eclipse and select the contents of devsmartlib/ as the source folder.
You can then right click on your project, click Properties, Android and add the library project from there!