android studio 复制项目

  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.

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

    2. 复制所选文件夹;

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

    4. 将粘贴的文件夹重命名为克隆项目的新名称,例如“ViewPager_Shell”;

    5. 启动Android Studio;

    6. 选择“打开现有的Android Studio项目”;

    7. 导航到AS项目目录;

    8. 选择文件夹“ViewPager_Shell”;

    9. 确保AS的资源管理器窗格在AS主框架的左侧可见;

    10. 为浏览器窗格选择“Android”视图;

    11. 打开应用程序 - > java; 现在可以看到旧的包名,例如'com.hulme.owm';

    12. 右键单击旧的包名称,然后选择“Refactor - > Rename”;

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

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

    15. 左键单击“Refactor”按钮; 谨防!!...在AS主框架窗口的左下方打开一个新的“查找因子预览”窗格;

    16. 选择'Do Refactor';

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

    18. 双击build.gradle(模块:app)在AS编辑器窗格中查看其内容;

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

    20. 使用AS浏览器窗格,导航到“app - >清单 - > AndroidManifest.xml”;

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

    22. 清单标签下,您应该观察到,由于以前的重构步骤,新的包名称(例如“com.hulme.viewpager_shell”)现在出现;

    23. 应用程序标签下,将android:label更改为新名称(例如“ViewPager Shell Demo”) - 这是Android的“设置” - >应用程序管理器提供的已安装应用程序列表中的名称。

    24. 活动标签下,将android:label更改为新名称(例如“VP Shell”) - 这是应用程序图标下方的名称,也是活动默认的ActionBar标题;

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

    1:修改包名,定义成你觉得与功能相对应的 
    2:在工程中找到GradleScripts文件夹下的build.gradle(Module:app)文件中修改

    android {
        compileSdkVersion 19
        buildToolsVersion "23.0.3"
    
        defaultConfig {
            applicationId "********"
            。。。
        }
       
       
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    applicationId 这个标签,使编译器认为你是新建了一个工程,从而不会覆盖原来的文件目录


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值