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.
Related
I have an android project that I can import to android studio. It opens but refuses to run. The file contains 4 folders (.idea, gen, java, res) and 2 files (AndroidManifest.xml and project.apk). I can't seem to run the app. When I import it, Android studio tells me "This project does not use the Gradle and migrate project to gradle.
Yes, Gradle is required for apps developed in or migrated to Android studio.
Android Studio’s build system is based on Gradle and uses build
configuration files written in Groovy syntax for ease of extensibility
and customization.
Since the whole build system is based on Gradle, you're stuck using it! Not a bad thing, Gradle is pretty great.
I have migrated quite a few projects to Android studio, for the most part it has been quick and painless.
There's a nice guide to help you migrate to Android Studio over at the Android development site: https://developer.android.com/studio/intro/migrate.html
For example this project. I see it has Gradle files, but a quick search says Eclipse has a Gradle plugin as well.
https://github.com/sephiroth74/HorizontalVariableListView
The Android build system is built on top of gradle:
https://developer.android.com/tools/building/plugin-for-gradle.html
So that means that just plain gradle is not enough to build an Android project.
As ADT never used gradle and Google has ended Eclipse support, you can be reasonably confident that an Android gradle project was made using Android Studio.
Gradle is a building tool. It has plugins for Eclipse, IntelliJ, Android Studio and Netbeans. So you won't be able to tell which IDE an Android project is made with from just a gradle file. Some project structures vary, for Eclipse projects and IntelliJ ones, you can find easily differences between them if you are familiar with both. But some are not explicitly, for IntelliJ projects and Android Studio ones.
BTW, do IDEs matter? The App you are building does, I am afraid.
Android Studio, which is developed based on IntelliJ. It uses gradle to build the project.
If a project contains .classpath or .project, it should be made by Eclipse. Or it should be made by android studio. A project made by android studio can not be imported into eclipse.
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.
Prior to this version it seemed easy to open an eclipse project as-is in Android Studio without any conversion. I prefer the Android Studio environment, but am working on a project that uses eclipse as the main IDE. I'd rather not have to download the eclipse bundle just for this one project.
Is there any way to open an eclipse project as-is, without conversion to the gradle build system, in Android Studio 0.4.3?
EDIT:
It appears that if you use Android Studio's download from source control feature, it'll let you open the project that way. But what if I already have the source downloaded? I don't want to remove it just to redownload it again. It seems like this option has disappeared from the main 'import' wizard.
We're strongly encouraging users to move toward the Gradle build system, and we're in the slow process of making that the only way to create new projects in Android Studio -- you're seeing this now on importing Eclipse-based projects. We'd like to replace all other build systems in use with Gradle, including Ant and the Eclipse internal builder, though the latter two are farther out on the roadmap.
If your ultimate goal is to move to Android Studio, then you might want to reconsider and just set up a Gradle build file. You don't have to adopt the Gradle-style multimodule project structure (which the current Eclipse importer imposes upon you by making a copy of your project); you can rework your build.gradle file to use the Eclipse-structured project in-place. You can get a good start on this if from Eclipse you use the feature to export your project to Gradle build files. It will set up the project in that fashion, though that feature in ADT is a little out of date and you'll need to update the version of the Android Gradle plugin in the build file and the Gradle version in the wrapper that it outputs.
I think this may actually solve your problem. IntelliJ or Android Studio have never been able to use the Eclipse project directly -- they've always imported the Eclipse project and converted to an IntelliJ-style project, and if you later change the Eclipse project, you'll need to re-import into IntellilJ-land. I'm guessing your real desire is to use the Eclipse project in Android Studio without having it make a copy and converting into its preferred directory structure. (By the way, we'll eventually improve Eclipse-to-Gradle import to lift this restriction).
Once you have the Gradle build file in place, you can use it when working with the project in Android Studio, and you'll still have the Eclipse project files when working with it in Eclipse. The big drawback is that you'll have to keep them in sync as you change dependencies and project structure, but hopefully that doesn't happen too often. Even if you weren't using Gradle, you'd still need to keep both projects in sync anyway, so Gradle isn't costing you anything there.
Having said all that, it doesn't directly answer your question, which is how to use the your project without Gradle.
Once you have an IntelliJ-built project, you can open it in Android Studio and use it normally without migrating to Gradle (though I think it does show you a popup when opening the project recommending you do so; you can ignore that). What you need to do is to get that initial IntelliJ project, and once you have it, check all the .iml files into source control -- those .iml files contain all the project information. To get those files, you'll need to import the Eclipse project either in IntelliJ CE, or in Android Studio prior to 0.4.0. Then you'll have your .iml files -- hang on to them.
I'll point out that if you're using Gradle as your build system, we recommend that you don't check those .iml files into source control. There, the build.gradle files are the source of truth for project structure; the fact that Android Studio creates .iml files at all is an implementation detail that reflects that internally Android Studio is still treating this project as an import instead of deriving structure from the Gradle files directly (and we resynchronize state when we know we need to). But saving those .iml files into source control or modifying them directly will lead to confusion or loss of any changes you make there when it resynchronizes.
I think you should give a try to Intellij Idea with ADT Plugin instead of Android Studio, if such requirements are there. Intellij IDEA will support both type of Android projects.
What If I want to move to Android Studio completely sometime?
There is nothing new in Android Studio it is just an IDE based on Intellij IDEA. You can easily switch between Intellij IDE and AS anytime. The only thing is to learn in AS is the new gradle build system. IDE related most of the features are there in Intellij IDE as well.
If you want to move Android Studio start using gradle Build System. That is only the main power of new Tools.
As per your question you don't wanna move your project in gradle then you can have both IDE together like Intellij IDEA at place of Eclipse and Android Studio as well. Msot of the Developer including me having Eclipse along with Android Studio.
EDIT :
I found a workaround to import Eclipse project in Android Studio but I will not recommend you to do this
Look at my answer here
Not Use Gradle In Android Studio
I am a fan of Maven and love the freedom it gives me and my fellow programmers when collaborating on a project. I consider myself to have a fairly good understanding of Maven and its pom as well as the command line goals.
Now we are starting to create an android test project to test our Android software in an automatic way. We have no problems doing this from within the eclipse environment and the test suite is now up and running.
However, its time to include more programmers into this project and therefore we want to be able to clone this project from our git repository, run mvn eclipse:eclipse, import it into a fresh eclipse (of course with android-sdk and what not) and run the tests as is expected.
We stumble over the hurdle that the project doesn't become an Android Test Project within eclipse thus it is not possible to run Android JUnit on any of its classes.
The main question: How do we make the project become an Android Test Project from the terminal window after it has been cloned from Git?
You can manually add android nature to the project by adding it in the .project file and then opening eclipse again.
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
You can create an empty android test project, and then compare it's .project file with your project's.