This question has already been answered:

Good afternoon, comrades developers! Today you need to give the application to the customer, and he said that he changed the domain and asked to change the name of the package in the project. So the question is: how to change the name of the main package from ru.rte.ret.app to com.rte.app?

Reported as a duplicate by pavlofff android Aug 8 '16 at 13:12 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    2 answers 2

    Use refactoring: right-click on the package name -> Refactor -> Rename ...

    Before that, you need to remove the “Compact Empty Middle Packages” checkbox:

    enter image description here

    And, if before that the package name looked like

    enter image description here

    then after this action the name view will be

    enter image description here

    And after that, it is already possible to change each of the names separately (you can change the necessary names, as described above, by choosing Refactor -> Rename from the context menu ...)

    • I tried, but from the whole package ru.rte.ret.app I can only change the last app - Pavel
    • one
      @Pavel, the answer is changed) - Ksenia
    • Yes it works! Thank! - Pavel

    If you want to fix only the package, then you need to edit it in Manifest:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ru.example"> 

    The path to your .java files is simply the path that was determined by the name of the package. In the gradle of the app module, the applicationId "ru.example" is defined by the package name

    You can make it easier to refactor as indicated Xenia.

    • Thank! I will consider in the following projects. - Paul