Renaming Android package name using Android Studio

后端 未结 4 933
孤街浪徒
孤街浪徒 2020-12-17 21:30

I Was Created an android application with package name of com.example.******.sample . I need to refactor the package name into org.newOrg.*******.sa

相关标签:
4条回答
  • 2020-12-17 22:08

    This modification needs three steps :

    1. Change the package name in the manifest
    2. Refactor the name of your package with right click -> refactor -> rename in the tree view, then Android studio will display a window, select "rename package"
    3. Change manually the application Id in the build.gradle file : android / defaultconfig / application ID Then clean / rebuild the project
    0 讨论(0)
  • 2020-12-17 22:09

    In Android Studio, you can do this by following these 4 steps:

    1) Click on the little gear icon on Project Pane

    2) Uncheck the Compact Empty Middle Packages option

    3) Now you can rename each package by right-click & then refactor it, remember to select Rename Package on popup rather Rename Directory

    4) Update the package in build.gradle

    5) And update google-services.json is you are using it (i.e. FireBase).

    0 讨论(0)
  • 2020-12-17 22:29

    click on Settings in the project window uncheck the Compact Empty Middle Packages

    It will separate the app package and you can rename it one after another.Also change the App Id inside build.gradle under defaultConfig section

    defaultConfig {
            applicationId "com.foocomp.android"
    
        }
    

    0 讨论(0)
  • 2020-12-17 22:31

    You can use replace function like click right on project main folder and click replace with choose. Then you can replace package name. I used it more times and it works.

    0 讨论(0)
提交回复
热议问题