Android Studio - 如何复制项目? [英] Android Studio - How to copy a project?

查看:110
本文介绍了Android Studio - 如何复制项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我已经进行了一些搜索,似乎接近我正在寻找的答案.但是因为害怕弄乱我当前的项目(我是第一次开发应用程序,到目前为止我很高兴......我想保持这种状态),我正在寻找一个漂亮而清晰的一步一步教你如何复制一个项目.我知道某些地方的某些内容需要导入/重命名,但我不确定具体是什么/在哪里.

Alright, I've done some searching and seem to be coming close to the answer I'm looking for. But for fear of messing something up with my current project (I'm a first time app developer and I'm quite pleased so far... I'd like to stay that way), I'm looking for a nice and clear step by step on how to copy a project. I know some things in certain places need to be imported/renamed but I'm not sure exactly what/where.

那么,有没有关于如何做到这一点的好步骤,还是我错过了它?如果没有,谁能给我详细解释一下?

So, is there a good step by step on how to do this or am I missing it? If not, can someone explain it to me in detail?

我想复制一个应用程序项目来制作另一个非常相似的应用程序项目.我正在为我的应用程序使用 Android Studio.我希望能够使用一个应用程序来制作另一个与之相似的应用程序(当然有差异).因此,与其创建一个新项目并创建所有 xml/java 文件并添加所有图像等,我希望能够使用我已有的内容并复制它来制作另一个与原始应用程序完全分开的应用程序.我根本没有使用 Eclipse,我的应用程序使用的是 Android Studio.

I want to copy one app project to make another app project that's very similar. I'm using Android Studio for my apps. I want to be able to use one app to make another that's just like it (with differences of course). So instead of making a new project and making all the xml/java files and adding all the images, etc. I want to be able to use what I already have and duplicate it to make another app that's totally separate from the original. I'm not using Eclipse at all, I'm using Android Studio for my apps.

推荐答案

我是 Android 和 AndroidStudio (AS) 的新手,我已经花了很多时间试图使用 AS 来克隆"一个项目.非常感谢上面给出的现有答案,这些答案让我走上了正确的道路.对于像我这样的新手,以下详细的分步说明应该很有用:

I'm a newcomer to Android and AndroidStudio (AS) and I've laboured for many hours trying to use AS to 'clone' a project. Many thanks for the existing answers given above that set me on the right path. For any total newbie's, like myself, the following detailed step-by-step instructions should prove useful:

  1. 使用 Windows 资源管理器,导航到 Android Studio 项目directory 选择要克隆的项目文件夹;

  1. Using Windows Explorer, navigate to the Android Studio projects directory select the project folder to be cloned;

复制选中的文件夹;

将文件夹粘贴到 Android Studio (AS) 项目目录中;

Paste the folder into the Android Studio (AS) projects directory;

将粘贴的文件夹重命名为克隆项目的新名称,说ViewPager_Shell";

Rename the pasted folder to be the new name of the cloned project, say 'ViewPager_Shell';

启动 Android Studio;

Launch Android Studio;

选择打开现有的 Android Studio 项目";

Select 'Open an existing Android Studio project';

导航到 AS 项目目录;

Navigate to the AS projects directory;

选择文件夹ViewPager_Shell";

Select the folder 'ViewPager_Shell';

确保 AS 的资源管理器窗格在左侧AS主机;

Ensure that AS's explorer pane is visible on the left-hand-side of the AS main frame;

为资源管理器窗格选择Android"视图;

Select the 'Android' view for the explorer pane;

打开应用程序 -> java;旧的包名现在应该是可见的,例如'com.hulme.owm';

Open app -> java; the old package name should now be visible, e.g. 'com.hulme.owm';

右键单击旧包名称并选择重构"->重命名';

Right-click on the old package name and select 'Refactor -> Rename';

现在应该会出现一个对话框;左键单击重命名包";

A dialog should now appear; left-click 'Rename Package';

在弹出对话框中,将旧包(例如owm")替换为新的包名(例如 viewpager_shell);

In the pop-up dialog, replace the old package (e.g. 'owm') with the new package name (e.g. viewpager_shell);

左键单击重构"按钮;谨防!!......一个新的'查找Factoring Preview' 窗格应在 AS 的左下角打开主框架窗口;

Left-click on the 'Refactor' button; BEWARE!! ... A new 'Find Factoring Preview' pane should open in the lower-left of the AS main frame window;

选择进行重构";

使用 AS 资源管理器窗格,导航到Gradle Scripts ->build.gradle(Module:app);

Using the AS explorer pane, navigate to 'Gradle Scripts -> build.gradle(Module:app);

双击 build.gradle(Module:app) 在AS 编辑器窗格;

Double-click build.gradle(Module:app) to view its contents in the AS editor pane;

将 defaultConfig 'applicationID' 字符串更改为新的完整字符串包路径(例如com.hulme.viewpager_shell");

Change the defaultConfig 'applicationID' string to your new full package path (e.g. "com.hulme.viewpager_shell");

使用 AS 资源管理器窗格,导航到应用程序 -> 清单 ->AndroidManifest.xml';

Using the AS explorer pane, navigate to 'app -> manifests -> AndroidManifest.xml';

双击AndroidManifest.xml"在AS编辑器中查看窗格;

Double-click on 'AndroidManifest.xml' to view it in the AS editor pane;

ma​​nifest 标签下,您应该观察到新包结果现在显示名称(例如com.hulme.viewpager_shell")之前的重构步骤;

Under the manifest tag, you should observe that the new package name (e.g. 'com.hulme.viewpager_shell') now appears, as a result of the previous refactoring step;

application 标签下,将 android:label 更改为新名称(例如"ViewPager Shell Demo") - 这是出现在列表中的名称由 Android 的设置 -> 应用程序"提供的已安装应用程序经理;

Under application tag, change android:label to a new name (e.g. "ViewPager Shell Demo") - this is the name that appears in the list of installed apps provided by Android's 'Settings -> Application manager;

activity 标签下,将 android:label 更改为新名称(例如VPShell") - 这是出现在应用程序图标下的名称,它也是 Activity 的默认 ActionBar 标题;

Under activity tag, change android:label to a new name (e.g. "VP Shell") - this is the name that appears under the app's icon and it is also the activity's default ActionBar title;

您现在应该能够构建和运行新克隆的项目.

You should now be able to build and run the newly cloned project.

这篇关于Android Studio - 如何复制项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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