How to add file to Eclipse project that already exists - android

The team is using Android Studio to develop Android projects. But researching Unit Tests, it looks like the support for JUnit Test Cases is in Eclipse. After exporting a test project from Eclipse and importing it into Android Studio I was under the mistaken impression that I could go back and forth. But when I added a java class to the project in Android Studio, the new java class does not show up in the Eclipse project.
I could import the new class if I wanted to move it to a different location first. So, is there any way to get the Eclipse project to recognize the file on disk should be included in the project?

Related

Import maven project from Eclipse to Android Studio

I have a very complex maven project in Eclipse with many modules and submodules and a lot of dependencies to each other and to third party files in pom.xml files. It works well in net browsers. But how can I try it in PC within an Android phone emulator? I have found this Android Studio program, but how can I import my very complex maven project from Eclipse without adding extra file(s) to it (like AndroidManifest.xml,etc) and not to destroy the original structure of the project?Anyway, I could use the File/Open option from menu and I can see the project in AS, but I can't run it. What should I do to run?
If you are trying to migrate an Android application from Eclipse IDE to Android Studio, then the hard truth is there is no easy way. I know because I already did this and it was worth the move.
And if you decide to take the hard route you will need to fully understand the directory structure of your Eclipse project compared to the directory structure of Android Studio projects and how the two IDEs build and deploy the project - because they are totally different and Android Studio uses gradle for its build.
Try reading through the Android Studio Guide and the Migrate to Android Studio from Eclipse.

Automatically Migrating projects to gradle in Android studio

I made some apps in the past with android studio, and there was no problems with them.
And I could open example projects from many sites, for example: developer.android.com/.
Now after an update of android studio, I can't open projects in android studio without migrating them manually, which was done before the update by android studio itself.
What could be the problem now?
First I get this warning, that android framework is detected.
Then after choosing the setup frameworks and clicking ok, I get this:
As you can see it is not gradle based project.
What can I do to make android studio automatically migrate projects again?
IMPORTING ANDROID STUDIO PROJECT IN ANDROID STUDIO:
If you want to import An Android Studio Project then do the following:
1.
Select Open an existing Android Studio Project
2. Browse your desired project derectory.
3. Now rather than selecting the folder that contains your project, you have to select the build.gradle file that is just inside of your parent folder of the project.
It will not create any problem and will not ask you to migrate into gradle and import any framework at all.
IMPORTING ECLIPSE PROJECT IN ANDROID STUDIO:
If you want to import Eclipse Project in Android Studio:
1. Select Import project (Eclipse ADT, Gradle, etc.)
2. Then nothing special just follow the instructions in the wizard.

Cant use the Android SDK Classes after Exporting Generated Gradle to Android Studio

I had generated gradle files for a project created using Eclipse ADT. After Importing into Android Studio using the Import Gradle option, I am not able to use any of the classes present in the Android SDK for example the Button Manager.
The icon for my java files changed
Secondly, how can I merge two projects inside a single app ?
Please suggest me any link from where I can begin using Gradle?

How does one migrate libGDX projects to another system?

I have libGDX projects on one laptop. I need to move to another laptop. I am using eclipse on both windows laptops. I have a git repo I can push to and pull from. I know that I can clone the https://github.com/libgdx/libgdx-demo-cuboc and import it into eclipse as a gradle project. But when I try this with my libGDX projects the "Build Model" fails.
I suspect I did not export the project correctly from my source laptop.
Can someone please point out what I am doing wrong?
Update:
OK. When I exported the projects from Eclipse I exported as plain old Android projects (Export Android Application), so I figured that I should export the project as Generate Gradle build files but I get this error when I attempt to do so ...
... and yes I did this too ...
... and I still get the same error.
UPDATE: After accepting JH's answer. Thank you for your answer BTW.
I was able to copy files in the project, but with gradle one copies the files into the directory libGDX generated the base project. I was coping the files into my Eclipse workspace, which is why the files were not showing up in my Eclipse project ... I know confusing huh. Well I was able to get my project to build but whenever I launched the app if crashed at runtime (see java.lang.UnsatisfiedLinkError: Native method not found: com.badlogic.gdx.backends.android.AndroidGL20.glGenTexture:()) I decided to give up on Eclipse and migrate my project to Android Studio. After taking a quick look at the Android Studio I was FINALLY able to build my app and execute it without runtime errors on my new laptop!
For clarity here is what I did to migrate my project from one laptop to another.
1) I got the my code out my git repo.
2) I downloaded the latest gdx-setup.jar, 1.5.3, from the libgdx project.
3) I generated a project, being careful to use the correct values for: Name, Package, Game class and Android SDK. For Destination I used c:\Users\Me\.
4) I copied the directories android, core, html, desktop and ios directories from my git repo into the corresponding directories in the project that gdx-setup.jar created.
5) Then I started Android Studio and follow the directions found here: Migrating to Android Studio
6) updated my build.gradle to include google play service and BANG! it worked
You shouldn't have to export anything, just clone the git repository on the new computer and then import gradle project and build model.
You could even generate a new libgdx project with their project wizard and then copy the source files.

Import Sibling Module in Android Studio

I have an Android project recently converted to Gradle from Maven/IntelliJ. The project has a traditional maven structure with the app and sdk projects being sibling projects referenced through the nexus. I can import either of the projects into Android Studio correct and build them, but when I try to import the SK as a module into the app project (which is what we did in IntelliJ) Android Studio basically refuses to import it. I'm using Android Studio 0.8.2. The actual error I get is either
Specify location of the Gradle or Android Eclipse project
if I select the SDK's .iml file or
Select modules to import
if I select the build.gradle file or the root directory.
I would like to avoid converting to the current Gradle super project mechanism because that would require new source control and would lose valuable history.
What I have tried:
Separate projects, works but doesn't allow SDK debugging and generally is a pain to manage due the multiple windows.
Using an empty super project. This gets both projects in the same windows, but Android Studio no longer detects the project's source controls. IntelliJ would correctly identify the sibling source controls in the previous configuration.
Is there any way to get Module Import to work in Android Studio like in IntelliJ?

Categories

Resources