So,
as it seems that more and more people are using Android Studio i got curious and wanted to take a peek at it.
I have used Eclipse up until now and wanted to migrate a project to Android Studio. So i exported a gradle buildfile from within Eclipse, as android.developer.com suggested.
That worked fine, now i wanted to import that into Android Studio 0.3.2
When trying to import i got that Unable to import Eclipse project to Android Studio error. Now it is building.
But it got a new suprise, now before it is finished building, its asking specifically for an older Version of Gradle(1.6)... Ok, i can do that. Which leads me right back to the first error. So i tried this - Gradle version 1.6 is required. Current version is 1.8-20130730220035+0000
I can however create a New Project with Android Studio.
I've tried this for about an hour now and im getting sort of pissed, because it doesnt seem to know what it wants. Is it some sort of Bug or did i make some sort of mistake.
You're using a very old version of Android Studio. I'd recommend upgrading to 0.4.3. Versions later than 0.4.0 allow direct import of Eclipse projects instead of requiring you to do the cumbersome (and as you've seen problematic) export of projects from Eclipse; it's smarter about setting up the right plugin and Gradle versions. 0.4.3 has some important bugfixes over 0.4.0-0.4.2.
I've just migrated my projects. Here is two suggestions from my side.
Take the latest Android Studio.
Do not export / import projects from Eclipse. Most likely you are going to have errors in the project after this step. Starting from a clean project, which builds, will safe you a lot of time and avoid unnecessary frustration.
Create an empty Android Project in Android Studio. It must build without errors (⌘ F9). The start to enhance it using official Gradle Plugin user guide.
Create libraries folder and add all libraries in there one by one. Update build.gradle dependencies as mentioned in user guide. Make sure everything builds successfully.
After all libraries build you can copy-paste sources, resources and assets from Eclipse project to corresponding folders of Android Studio project. Make sure everything build as expected.
Now you can start with more advanced configuration like ProGuard configuration, release certificates etc.
I've done it in a couple of hours. Hope this helps you too.
Related
I am trying to solve this problem for a few days now. Whenever I import ARCore SDK, to Unity, I cannot compile my project.
The error I am facing now is:
Minimum supported Gradle version is 5.6.4. Current Version is 5.1.1. If using the gradle wrapper, try editing the distributionUrl.
I did so, I saw in my eyes a new version is imported but I am keep getting this error.
Here are some other things I tried:
Trying to import the SDK to multiple versions of Unity.
Using a different computer.
Not changing the minimum API Level to 24.
Building the app without scenes.
trying to use different Gradle versions besides 5.6.4. In particular, 6.7, 6.1.1
Creating a system variable under Path: C:\Gradle\gradle-6.7\bin
Removing 5.1.1 folder from the Temp folder of the project, whenever I compile it (Although it keeps appearing of course)
Following the guide found at:
https://developers.google.com/ar/develop/unity/quickstart-android
Ensuring JDK, JVM and all required components are installed.
All to no avail. The project is not compiling.
Any help would be greatly appreciated!
EDIT:
I believe the root of the problem is that I haven't changed the Gradle version somewhere, despite doing so at the wrapper. The reason I stuck at 5.1.1 has something to do with the default Gradle version of my Unity version.
https://docs.unity3d.com/Manual/android-gradle-overview.html
Question is, how to solve it.
I can think about two ways to solve it (but they are pretty similar):
First Option:
Download the gradle version you want, navigate to where Unity's gradle is located in:
C:/{UnityEditorsDirectory}/{UnityVersionDirectory}/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle
Then replace lib folder with your new gradle lib folder.
Second Option:
In case this doesn't work, you can also try to:
Open Unity Editor, go to the menu tab Edit->Preferences->External Tools
Scroll down and find this toggle:
If you uncheck the toggle, the editor will allow you to browse where your gradle is located, paste your new directory and try if it works.
TAKE CARE: Unity's gradle version is the one that Unity's people have tested so...something can explode unexpectedly!
I made an android application using Android Studio during lectures at university. Then I uploaded the project to drive and when I got home, after I installed the latest Android Studio, I opened my project and almost every line of code was marked as libraries were not found.
I found that when developing on a computer I use android.support.v7.app.AppCompatActivity but it's not recognized at home. So I tried creating an empty project at home and I found it uses androidx.appcompat.app.AppCompatActivity.
A solution I tried, was to delete all imported libraries and then I let Android Studio to import what he needs, but it's stupid. I have to do that every time I switch the working station.
Why can't it be just one library? Is there other solution, not to re-import all the libraries?
Your problem is "uploaded the project to drive", that also saved the .idea folder where everything regarding the IDE and computer is stored. So you are opening a project on another computer with routes to your old computer. Solutions:
Close Android Studio and then delete the .idea and .gradle folder from the project, re-open it
File/Invalidate Cache and Restart
Recommended Solution Use a version control system like git. Android Studio does a pretty good job integrating with VCS. In the menus look for VCS/Enable Version Control Integration you need to install git previously and know how to use git.
There is another thing, the new AS version has a sync gradle icon, is an elefant with and arrow, sometimes big changes on gradle can go unnoticed so click it. There is also the usual, clean project or rebuild project.
The other part of the problem is: the different libraries. Androidx was introduced to consolidate in 1 library the support libraries. It is recommended to use it. If the latest version of Android Studio dont support it then you will have to, and also update the IDE on the other desktop
You can't mix AndroidX library with support library in modern android application development. support is already deprecated and AndroidX is future. So, migrate your existing project to AndroidX
With Android Studio 3.2 and higher, you can migrate an existing
project to AndroidX by selecting Refactor > Migrate to AndroidX from
the menu bar.
Check official documents for more information
I have a workspace for Eclipse Luna, it contains 8 projects and it builds without any problem. I have tried exporting the primary project as a Gradle project and then opening that with Android Studio and I have also tried importing the primary project directly into Android Studio.
I've verified that I have the latest versions of everything, Eclipse and AS but it doesn't make any difference.
The resulting project will not build. I get almost 100 build errors trying to build in Android Studio. I've wasted days trying to use this product, I've reported multiple IDE errors that occur during import to Google and feel like I'm going in circles.
If I import the exported build.gradle file, it complains that version 1.1.0 is required. Current version is 2.2.1
What information do I need to supply to help resolve this?
First make sure that your gradle build passes.
gradle build
or with a little bit help in Eclipse using http://www.nodeclipse.org/projects/gradle/ Gradle for Eclipse plugin.
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 have been trying to export my eclipse project as a gradle build file to use it with Android Studio but I can't seem to make it work correctly.
When I click "Finish" nothing happens. If I repeatedly click it, I can see a progress bar that shows for a millisecond and then vanishes.
My ADT is version 22.3 (which is the latest) and I have tried all of the solutions I found on google as well.
Similar questions can be found here:
Eclipse Gradle export of Android project does nothing
Cannot generate gradle.build files from Eclipse
As you can see, there is not really a solid solution for this problem, but people wrote they created it manually. I don't know how to do so though.
Is there any solution for this problem that I haven't heard of? If not, how can I create the file manually?
Apparently, the current edition of the export-to-Gradle support in Eclipse cannot handle a project that is attached to an Android library project. In that case, you would need to (temporarily) detach the Android library project, export the main project, then modify build.gradle to use the library project (manually or via Android Studio).
Generating build.gradle files FIRST FOR ALL of the projects in my dependencies ONE AFTER ANOTHER worked for me.
I generated build.gradle (with export wizrd for facebook, play and whatever other projects I imported and used in my project).
For not trivial Android project you should do it manually.
For the latest build.gradle template for classic Android project check gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.
You can continue to develop in Eclipse with ADT and run Gradle build using Nodeclipse/Enide Gradle for Eclipse
(marketplace)
Some screenshots for Gradle for Eclipse: