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的10个开源项目
  2. android 视频通话 项目 源码
  3. android 在SD卡创建文件夹
  4. Android Studio导入项目时出现,弹框说SDK有问题
  5. android 开源项目集锦
  6. Android省市区三级联动滚轮选择(真实项目中提取出来的组件)
  7. Android之根据经纬度查询位置地址名称
  8. 谁说Android的动画不廉价(一)之项目分层
  9. Dagger2 在 Android 项目的正确使用方式【完整篇】

随机推荐

  1. Android(安卓)IOS 安全书籍
  2. Android之进程查看,关闭(可操作所有进程)
  3. android 中的MultipartEntity 类
  4. Android动态权限判断以及动态权限申请
  5. android 的单例模式
  6. Android官方文档翻译 一 Getting Started
  7. android tv 实现颜色条滚动效果
  8. Android硬件设备检测
  9. Android(安卓)使用des算法
  10. [Android]判断Context是不是Activity