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

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

问题描述

好吧,我已经做了一些搜索和似乎已经接近于我在寻找答案。要不是怕搞乱的东西与我的当前项目的(我是第一次应用程序开发人员,我很满意为止......我想保持这种方式),我正在寻找一个很好的和明确的逐步研究如何将项目复制的步骤。我知道,在某些地方有些东西需要进口/改名,但我不知道到底是什么/哪里。

那么,有没有一个很好的一步就如何做到这一点还是我失去了这一步?如果没有,可有人就详细解释一下吗?

编辑:我想复制一个应用项目,使另一个应用程序项目非常相似。我使用Android的工作室为我的应用程序。我希望能够使用一个应用程序来再拍那只是喜欢它(当然是有差异)。因此,而不是做一个新的项目,使所有的XML / java文件,并添加所有我希望能够用我已经和重复它使另一个应用程序这是从原来的完全独立的图像等。我不使用Eclipse可言,我使用Android的工作室为我的应用程序。


解决方案

我是一个新人,Android和AndroidStudio(AS)和我辛劳为几个小时试图用AS来克隆的项目。以上,鉴于现有的答案非常感谢把我在正确的道路上。对于任何新手总的,像我这样的,下面详细的一步一步的指示应该是有用的:


  1. 使用Windows资源管理器,浏览到Android Studio项目
        目录中选择项目文件夹被克隆;


  2. 复制选定的文件夹;


  3. 文件夹变成了Android工作室(AS)粘贴项目目录;


  4. 重命名文件夹粘贴要克隆项目的新名称,
    说ViewPager_Shell';


  5. 推出Android工作室;


  6. 选择打开一个现有的Andr​​oid Studio项目';


  7. 导航到随着项目目录;


  8. 选择文件夹ViewPager_Shell';


  9. 确保AS的浏览器面板是可见的左手侧
    在AS主框架;


  10. 选择了Android的的探险家窗格视图;


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


  12. 右键单击旧的包名称,然后选择重构 - >
     重命名;


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


  14. 在弹出的对话框中,更换旧包(例如'OWM')与
     新包的名字(例如viewpager_shell);


  15. 左键点击重构按钮;谨防!! ......新的查找
     保preVIEW窗格应该在AS的左下角打开
     主框架窗口;


  16. 选择做重构';


  17. 使用AS资源管理器窗格中,导航到摇篮脚本 - >
     的build.gradle(模块:APP);


  18. 的build.gradle双击(模块:应用程序)中查看其内容
     作为编辑窗格;


  19. 在defaultConfig'的applicationID字符串更改为新的全
     包路径(例如,com.hulme.viewpager_shell);


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


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


  22. 清单标签,你应该看到,新包装
     名称(例如com.hulme.viewpager_shell')现在看来,作为结果
     在previous重构步骤;


  23. 应用标签,更改机器人:标签到一个新的名称(例如,
     ViewPager壳牌演示) - 这是出现在列表中的名称
     通过Android的提供安装的应用程序设置 - >应用程序
     经理;


  24. 活动标签,更改机器人:标签到一个新的名称(例如,VP
     壳牌) - 这是应用程序的图标,下方显示的名称
     也是该活动的默认动作条的标题; <​​/ p>


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


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?

EDIT: 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.

解决方案

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. Using Windows Explorer, navigate to the Android Studio projects directory select the project folder to be cloned;

  2. Copy the selected folder;

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

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

  5. Launch Android Studio;

  6. Select 'Open an existing Android Studio project';

  7. Navigate to the AS projects directory;

  8. Select the folder 'ViewPager_Shell';

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

  10. Select the 'Android' view for the explorer pane;

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

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

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

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

  15. 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;

  16. Select 'Do Refactor';

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

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

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

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

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

  22. 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;

  23. 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;

  24. 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;

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

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

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