Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In android studio : How to change packages file path

Tags:

android

So I know how to rename a package, however that just changes the end

package com.example.android.navigationdrawerexample;

In this example what I want to do is get rid of the .example

How would you go about this without breaking things?

like image 866
bungleofsketches Avatar asked Nov 17 '13 17:11

bungleofsketches


2 Answers

1- Go to androidmanifest.xml

2- Search for:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp"
    android:versionCode="1"
    android:versionName="1.0" >

3- Use Refactor over the content of "package" to change your package name

4- Reload project

I hope this can help somebody!

like image 119
Daniel S. Avatar answered Oct 02 '22 00:10

Daniel S.


what i'm doing is to open some class file, go to the top and choose the part of the package you want to rename, right click on it and go to Refactor > Rename. I guess Studio should ask you then whether you want to rename either directory or whole package - choose the latter.

E.g when you have package pl.warsjawa.android2; and want to change warsjawa into dzwoniec right click on warsjawa -> Refactor -> Rename.

like image 40
Dale Cooper Avatar answered Oct 01 '22 22:10

Dale Cooper