I have an Android project created in Eclipse. I want to modify the package name and application of the project. How do I do that in Eclipse?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
Goto the Src folder of your Android project, and open the Java file.
Change the package
OldName.android.widget
tonewName.android.widget
.It gives you an error like this
To fix this problem, select Move filename.Java to Newname.android.widget and delete the old package folder.
Next step: Go to
AndroidManifest.xml
and changepackage="OldName.android.widget"
topackage="newName.android.widget"
.Renaming an Application- The Complete Guide
I had big trouble with this too.
I renamed the project and the package via refactoring, but it rendered the app useless. I renamed it back to the original and used the Android tools to rename the package and this worked, but my package folder and classes had the old name.
I then refactored the package folder. Now the app wouldn't run. My manifest was a mess. It doubled up my launcher name for example,
com.ronguilmet.app/com.ronguilmet.com.class
. I fixed that, and I had to manually edit all activities.None of this worked for me until I combined the two answers mentioned in this post.
Step 1: Right click on the project -> Select Android Tools -> Rename application Package. (This will change all the files in the gen folder and in AndroidManifest but will not change the package name in the src folder so I followed Step 2)
Step 2: Inside src folder Right Click your package name -> Refactor -> Rename -> Enter the new name that you entered in Step 1.
Just to make sure Check AndroidManifest if there is still the old package name and replace with the new one (in my case inside the "uses-permission" tag).
Then close the Eclipse and Reopen it. Uninstall the app from your device and install it again and everything should be working fine.
Hope this helps and saves your time.