How to change package name of an Android Application

后端 未结 18 1154
攒了一身酷
攒了一身酷 2020-11-28 02:07

My keystore is corrupt, therefore the Android Market is requiring me to rename the app and resubmit it. However, whenever I go to edit the package names in Manifest and thro

相关标签:
18条回答
  • 2020-11-28 02:34

    Bernstein has the method, use the Eclipse tool, "Rename Application Package", you may have to do some clean-up even after the fact. Also, Eclipse sometimes loses track of things when you make changes to a project. You may have to use the "Clean Project" tool (under the "Project" menu.) If that doesn't work, you may have to close and restart Eclipse. Voo-doo solutions, but Eclipse can be that way.

    0 讨论(0)
  • 2020-11-28 02:35
    1. In your Android studio , at project panel , there is gear icon "Click on it".
    2. Uncheck the Compact Empty Middle Packages
    3. Now the package directory has been broken up i.e individual directories.
    4. Select the directory you want to rename.
    5. Right click on that particular directory.
    6. Select refactor and then rename option.
    7. The dialog box has been open up,rename it.
    8. After putting new name, click on Refactor.
    9. Then click on Do Refactor at bottom.
    10. Then android studio will update all changes.
    11. Now open build.gradle file and update the applicationId & sync it.
    12. Now go to manifest file and rename the package.
    13. Rebuild your Project.
    14. You are done :)
    0 讨论(0)
  • 2020-11-28 02:37
    1. Fist change the package name in the manifest file
    2. Re-factor > Rename the name of the package in src folder and put a tick for rename subpackages
    3. That is all you are done.
    0 讨论(0)
  • 2020-11-28 02:38

    Here's how you could do this in Eclipse:

    1. Right-click on the package name (src/com.android.gesture.builder).
    2. Select Refactor > Rename and change the name, for example to com.android.gestureNEW.builder.
    3. Open the manifest file. Inside the <manifest> tag, change the package name to com.android.gestureNEW.builder.
    4. Open each of the two Activity files and do Ctrl+Shift+O to add missing import packages, then save each file.
    5. Run the GestureBuilder application on the emulator.

    Link to post

    Update super easy way right click on your project... enter image description here

    0 讨论(0)
  • 2020-11-28 02:40

    So, using IntelliJ with Android (Studio) plugin was: I went to AndroidManifest.xml on top and changed package name by right-clicking -> Refactor -> rename. Our then package name had four parts a.b.c.d, the new one only a.b.c. So I renamed the first three. Then I went to the directory of generated sources (app\build\generated\source\r\development\debug\a\b\c\d), right-clicked R class and Refactor->Move[d] it to one package higher. Same with BuildConfig in app\build\generated\source\buildConfig\development\debug\a\b\c\d.

    By using Refactor->Move, IntelliJ updates all references to BuildConfig and R.

    Finally I updated all applicationId[s] I found in gradle.build I found. I hit Clean Project, Make and Rebuild Project. Deleted the app from my phone and hit "Play". It all worked out so refactoring was easy and quite fast.

    0 讨论(0)
  • 2020-11-28 02:41

    I just lost few hours trying all solutions. I was sure, problem is in my code - apk starting but some errors when working with different classes and activities.

    Only way working with my project:

    1. rename it - file/rename and check all checkboxes
    2. check for non renamed places, I had in one of layout old name still in tools:context="..
    3. create new workspace
    4. import project into new workspace

    For me it works, only solution.

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