没有Android版的gradle工作室0.4.3 Eclipse项目 [英] Android Studio 0.4.3 Eclipse project without gradle

查看:208
本文介绍了没有Android版的gradle工作室0.4.3 Eclipse项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此之前的版本似乎容易打开Eclipse项目原样Android Studio中无需任何转换。我preFER了Android Studio环境,但我的工作对使用Eclipse作为主要IDE的项目。我宁愿没有下载Eclipse包只为这一个项目。

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.

有什么办法打开Eclipse项目原样,无需转换到gradle这个构建系统,Android Studio中0.4.3?

Is there any way to open an eclipse project as-is, without conversion to the gradle build system, in Android Studio 0.4.3?

编辑:
看来,如果你使用Android Studio的下载,从源头控制功能,它会让你打开该项目的方式。但是,如果我已经源下载的是什么?我不想删除它只是再次重新下载。看起来这选项从主进口精灵消失了。

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.

推荐答案

我们强烈正在鼓励用户向摇篮构建系统移动,我们在做的唯一的方式来创建进程缓慢 Android Studio中的项目 - 你现在对进口的基于Eclipse的项目看这一点。我们想取代所有其他的构建系统与摇篮,包括蚂蚁和Eclipse内部助洗剂,虽然后两者是更远的路线图。

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.

如果你的最终目标是将到Android工作室,那么你可能要重新考虑,只是设立了一个摇篮构建文件。您不必采用摇篮式的多模块项目结构(其中当前的Eclipse进口商通过项目的副本强加于你);你可以返工您的的build.gradle 的文件,使用就地Eclipse的结构工程。如果从Eclipse中使用该功能来导出项目到摇篮构建文件,你可以得到一个很好的开端。这将设置项目以那种方式,尽管在ADT该功能是最新的一点点出来,你需要在构建文件和摇篮的版本,它输出的包装更新的Andr​​oid摇篮插件的版本。

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.

我觉得这其实可以解决你的问题。的IntelliJ或Android工作室从未能够直接使用Eclipse项目 - 他们总是把进口Eclipse项目,并转换成的IntelliJ式的项目,如果你以后更改Eclipse项目,则需要重新导入进入IntellilJ土地。我猜你真正的愿望是使用Android Studio中的Eclipse项目,而无需使其副本,并转化成其preferred目录结构。 (顺便说一句,我们最终会提高的Eclipse到摇篮进口解除此限制)。

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).

一旦你的摇篮构建文件的地方,你可以用Android Studio中的项目工作时使用它,并且在Eclipse中使用它时,你就仍然有Eclipse项目文件。最大的缺点是,你必须保持同步,你改变依赖关系和项目结构,但希望这不会经常发生。即使你没有使用摇篮,你仍然需要保持同步两个项目,无论如何,所以摇篮不会花费你有什么事。

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.

一旦你有一个的IntelliJ建项目,你可以在Android Studio中打开它,并正常使用它,而迁移到摇篮(虽然我认为它确实表明您打开项目时弹出,建议你这样做,你可以忽略)。你需要做的是获得初始的IntelliJ的项目,一旦你拥有它,检查所有的 .iml 的文件到源代码控制 - 那些 .iml 的文件包含所有该项目的信息。要获得这些文件,你需要导入的Eclipse项目无论是在的IntelliJ CE或Android Studio中之前0.4.0。然后,你有你的 .iml 文件 - 挂在他们的

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.

我要指出的是,如果你使用的摇篮构建系统,我们建议您 检查这些.iml文件到源代码控制。还有,在的build.gradle 的文件是真理项目结构的来源;那Android的工作室在所有创建.iml文件其实是一个实现细节,反映在内部的Andr​​oid工作室还是把这个项目作为一个进口,而不是从摇篮派生结构文件直接(和我们重新同步状态,当我们知道我们需要) 。但是,这些节省的 .iml 的文件到源代码控制,或直接修改它们会导致你要在那里当它重新同步的任何更改混乱或损失。

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.

这篇关于没有Android版的gradle工作室0.4.3 Eclipse项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆