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 这个标签,使编译器认为你是新建了一个工程,从而不会覆盖原来的文件目录


更多相关文章

  1. android之ID
  2. 代码实现Layout android:layout_alignParentRight
  3. android 在SD卡创建文件夹
  4. android 用VideoView播放本地视频文件
  5. android 读取,写入图片到sd卡源码
  6. android灵活布局
  7. Android应用开发相关下载资源(2016/07/24更新)
  8. eclipse 启动 Android(安卓)SDK Content Loader 异常
  9. Android(安卓)手机存储文件各种路径

随机推荐

  1. MySQL Router的安装部署
  2. MySQLShell的介绍以及安装
  3. MySQL InnoDB ReplicaSet(副本集)简单介
  4. MySQL 角色(role)功能介绍
  5. 浅谈Mysql多表连接查询的执行细节
  6. Mysql基础之常见函数
  7. MySQL分库分表与分区的入门指南
  8. MySQL8.0.24版本Release Note的一些改进
  9. 详解MySQL的半同步
  10. 详解MySQL事务的隔离级别与MVCC