Fully change package name including company domain

后端 未结 16 2433
礼貌的吻别
礼貌的吻别 2020-12-13 01:11

Let\'s suppose this is the package name: package com.company.name. How do I change company?

P.S. I saw how to change name but

相关标签:
16条回答
  • 2020-12-13 01:50

    This worked for me, from https://stackoverflow.com/a/18637004/127434

    Another good method is: First create a new package with the desired name by right clicking on the java folder -> new -> package.

    Then, select and drag all your classes to the new package. AndroidStudio will refactor the package name everywhere.

    Finally, delete the old package.

    0 讨论(0)
  • 2020-12-13 01:51

    Four steps are given below:

    1. Click on app folder below:

    com.new25.impro. press Shift + F6 {Refactor->Rename...} to rename the package and press refactor.

    1. After that one, see the android monitor. That show change everywhere that packagename. Click refactor.

    2. Go to module app:change the application id for you like that name put it. and click sync now.

    3. Now you can change the package name to what you like.

    0 讨论(0)
  • 2020-12-13 01:52

    1) Open the project folder in Android Studio.
    2) Select app folder -> Right click, and select refactor.
    3) Click on move. It will ask to which package name type you own full package name and it will ask to create a new package yes create new automatically it ask for gradle to sync.

    0 讨论(0)
  • 2020-12-13 01:52

    I have read almost all the answers. But I think one is missing. Sometimes I may be wrong. I have used the below method and it's working.

    3 Methods to change package name in Android Studio

    1. Select your package and Right-click, Refactor -> Move.
    2. Choose Move package from "your package" to another package and click Ok.
    3. A new dialog appears, says Multiple directories correspond to package "your package" and click Yes.
    4. Enter the new package name except for the last level or last name. Means If you want to rename package name to "info.xyz.yourapplication". Then type down "info.xyz" only leave "yourapplication".
    5. Click Refactor.
    6. A new dialog, Package info.xyz does not exist. Do you want to create it?. Click on Yes.
    7. Click Do refactor.
    8. Right-click on the new package to change the last name. Refactor-> Rename.
    9. Rename package
    10. type new name and click Do refactor.
    11. Delete all old package directories.
    12. Change ApplicationId in build.gradle file and click on sync now
    0 讨论(0)
  • 2020-12-13 01:55

    The simplest way of doing this would be to rename the root app folder from com.example.MyApp to com.newcompanyname.MyNewAppName and then replace all occurrences of the old path to the new path in whatever IDE you're using.

    0 讨论(0)
  • 2020-12-13 02:01

    You can do this:

    Change the package name manually in the manifest file. Click on your R.java class and the press F6 (Refactor->Move...). It will allow you to move the class to other package, and all references to that class will be updated.

    reference: How do I rename the android package name?

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