如何将现有的java项目导入android studio?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32197775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to import existing java project into android studio?
提问by Nageswara Rao.CH
In my android studio project want to use existing java project code
在我的android studio项目中想使用现有的java项目代码
I tried this way:
我试过这种方式:
Click File > New Module. Select Java Library and click Next.
Filled the required fields and clicked Finish.
单击文件 > 新建模块。选择 Java 库并单击下一步。
填写必填字段并单击完成。
A new empty Java project library was created in my Android project.
在我的 Android 项目中创建了一个新的空 Java 项目库。
I need to use existing(java project) code to my android studio project, how can I do that?
我需要在我的 android studio 项目中使用现有的(java 项目)代码,我该怎么做?
采纳答案by Nageswara Rao CH
It is not possible to access with out gradle file,
没有 gradle 文件就无法访问,
you can use these steps if your Java project in eclipse
如果您的 Java 项目在 Eclipse 中,则可以使用这些步骤
1.Right Click on project select export a new window appears
1.右键项目选择导出出现新窗口
2.Select generate gradle build file then the select project click finish
2.选择generate gradle build file然后选择项目点击finish
It will create your project with gradle file,then you can easily import
它将使用 gradle 文件创建您的项目,然后您可以轻松导入
File -> New -> Import module.....
文件 -> 新建 -> 导入模块.....
回答by IntelliJ Amiya
Select Import Project Instead Module
Select Import Project Instead Module
To import a project to Android Studio:
要将项目导入 Android Studio:
- Start Android Studio and close any open Android Studio projects.
- From the Android Studio menu select File > New > Import Project. .
- Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok.
- Select the destination folder and click Next.
- 启动 Android Studio 并关闭所有打开的 Android Studio 项目。
- 从 Android Studio 菜单中选择文件 > 新建 > 导入项目。.
- 选择包含 AndroidManifest.xml 文件的 Eclipse ADT 项目文件夹,然后单击 Ok。
- 选择目标文件夹,然后单击下一步。
For demo you may visit Getting Started with Android Studiofor step by step approach .
对于演示,您可以访问Android Studio 入门以了解分步方法。
Details
细节
回答by Nicolas Tyler
A simple google search gives you everything: https://www.google.co.za/search?q=import%20project%20to%20android%20studio
一个简单的谷歌搜索给你一切:https: //www.google.co.za/search?q=import%20project%20to%20android%20studio
To import a project to Android Studio:
- Start Android Studio and close any open Android Studio projects.
- From the Android Studio menu select File > New > Import Project. ...
- Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok.
- Select the destination folder and click Next.
要将项目导入 Android Studio:
- 启动 Android Studio 并关闭所有打开的 Android Studio 项目。
- 从 Android Studio 菜单中选择文件 > 新建 > 导入项目。...
- 选择包含 AndroidManifest.xml 文件的 Eclipse ADT 项目文件夹,然后单击 Ok。
- 选择目标文件夹,然后单击下一步。
Google has made this tutorial: https://developer.android.com/sdk/installing/migrate.html
谷歌做了这个教程:https: //developer.android.com/sdk/installing/migrate.html
I have had issues before with this so I normally just create a new project and just copy all the classes, drawables, etc from the old project into the new project.
我之前遇到过这个问题,所以我通常只是创建一个新项目,然后将旧项目中的所有类、可绘制对象等复制到新项目中。
回答by isurujay
You can import a java project if it is a Gradlebuild project. Otherwise android studio not allow to import other java projects.
如果是Gradle构建项目,则可以导入 java项目。否则 android studio 不允许导入其他 java 项目。
File >> New >> Import Project and select the Gradle build javaproject
文件>>新建>>导入项目并选择Gradle构建java项目
Thanks
谢谢
回答by rust
On Android Studio 2.3.3
在Android Studio 2.3.3 上
File-> New-> Import Project
文件->新建->导入项目
回答by PAdams
Easiest way to do this is to choose the 'open an existing project' option, find your project, and then find the 'app' folder. Click on this to highlight it and then click 'Ok'. This will then import your complete project
最简单的方法是选择“打开现有项目”选项,找到您的项目,然后找到“应用程序”文件夹。单击它以突出显示它,然后单击“确定”。这将导入您的完整项目
回答by Palak Jain
The following link can be referred to:
可以参考以下链接:
https://developer.android.com/studio/intro/migrate.html
https://developer.android.com/studio/intro/migrate.html
Import Eclipse Projects to Android Studio
将 Eclipse 项目导入 Android Studio
Import as a Project:
作为项目导入:
Start Android Studio and close any open Android Studio projects.
From the Android Studio menu click File > New > Import Project. Alternatively, from the Welcome screen, click Import project (Eclipse ADT, Gradle, etc) Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok. Select the destination folder and click Next Select the import options and click Finish.
启动 Android Studio 并关闭所有打开的 Android Studio 项目。
From the Android Studio menu click File > New > Import Project. Alternatively, from the Welcome screen, click Import project (Eclipse ADT, Gradle, etc) Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok. Select the destination folder and click Next Select the import options and click Finish.
Importing a Gradle-based IntelliJ project
导入基于 Gradle 的 IntelliJ 项目
If you are already using Gradle with your IntelliJ project, you can open it in Android Studio using the following steps:
Click File > New > Import Project. Select your IntelliJ project directory, and click OK. Your project will open in Android Studio.
如果您已经在 IntelliJ 项目中使用 Gradle,则可以使用以下步骤在 Android Studio 中打开它:
Click File > New > Import Project. Select your IntelliJ project directory, and click OK. Your project will open in Android Studio.