Tommy
Tommy

Reputation: 759

change project name and package name

Is it possible to change the project name and package name in Android.

Upvotes: 22

Views: 71850

Answers (17)

MYJ World
MYJ World

Reputation: 950

In this Sample I want to change My Application Title to Surah Al Baqrah with Translation.

Change your view to Android. Go to App --> Res --> Values --> Strings.xml You can update the code below:

<string name="app_name">My Application</string>

which will look like:

Image

to:

    <resources>
        <string name="app_name">Surah Al Baqrah with Translation</string>
    </resources>

which will look like:

Image

Upvotes: 0

yehyatt
yehyatt

Reputation: 2414

If You're trying to change the root module name and getting "Can't rename root module" error , open the gradle.settings file and change the rootProject.name to whatever you want then sync .enter image description here

Upvotes: 2

Razor
Razor

Reputation: 457

Change the name of Project in file -> (settings.gradle)

Upvotes: 1

Bilal Jamal
Bilal Jamal

Reputation: 1

1) Close Android Studio

2) Copy Old Project and rename it to the new one

3) Reopen android studio and import the new project

4) Go to the old package name and rename it according to your new project

5) Them, Click on Edit ==> Find ==> Replace in Path and replace old occurrences of your old project name to the new one

6) Clean the project and rebuild again

Thats it

Upvotes: 0

Hafizullah Samim
Hafizullah Samim

Reputation: 51

  1. Right click on package name in one of your java class or activity, then reactor it and write your own package name then click ok.
  2. Open the manifest and change your package name according to your package name in java class

Upvotes: 1

PeerNet
PeerNet

Reputation: 855

1. Right click on project in project pane.
2. Click "Open module settings"
3. In the project structure frame, click app below the Modules
4. Click "Flavors" and change "Application Id".
5. Edit Manifest.xml in your project and rebuild it.

Upvotes: 6

ritesh4326
ritesh4326

Reputation: 627

Change Package Name :

  1. Right Click on Project >Android Tools >Rename Application Package

  2. Go to src right click on your main package >Refactor >Rename

  3. Go to manifest file and change your package name .

    Change Project Name :

  4. Right click on Project Refactor >Rename

Upvotes: 18

Maksim Dmitriev
Maksim Dmitriev

Reputation: 6209

Let me add a little to Robert Massaioli's answer.

If you have custom attributes used in your XML files (Creating a View Class), you'll also have to rename your XML namespaces.

xmlns:custom="http://schemas.android.com/apk/res/com.myold"

must be renamed to

xmlns:custom="http://schemas.android.com/apk/res/com.mynew"

Upvotes: 0

userAndroid
userAndroid

Reputation: 586

For change your package name of any application.

Try this

1 . Right Click on project name go to android tools then rename application package enter new package name then click ok and update according to it.

2.Go to your main package name then right click then refactor and rename enter new package name.

3.Go to manifest and change old package with the new package name.

Now you can run your project.

Upvotes: 0

Abhijit
Abhijit

Reputation: 394

enter image description here

for edit name of app follow steps....

Upvotes: 1

Eddie Martinez
Eddie Martinez

Reputation: 13910

If you want to change the name of your application as it shows on the phone just change the value in the app_name variable. The Path is res -> values -> strings.xml -> app_name

enter image description here

Upvotes: 5

Awais Usmani
Awais Usmani

Reputation: 188

Try this

  1. Right click on your project.
  2. Click "Refactor"
  3. Click "Rename..."
  4. List item

Enter name!

Or did that not work for you?

Upvotes: 11

eeadev
eeadev

Reputation: 3852

The project name is defined in the file .project as below. It is at the same level of your AndroidManifest.xml. I experienced it when I wanted to add to my workspace a project with the same projectName of an existing one and could find where it was defined. The Manifest file does not help in such case.

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>YourProjectName</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>com.android.ide.eclipse.adt.ApkBuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
</natures>

Upvotes: 0

Ryan sams
Ryan sams

Reputation: 359

Project Name:

res -> values -> strings.xml -> app_name -> (change the name)

Package name:

Right click on the project -> Android tools -> Rename application package -> (change the name)

Upvotes: 26

JLTChiu
JLTChiu

Reputation: 1023

I just finish modifying the package name and I hope this will help. I am using eclipse.

First you should have a backup of your AndroidManifest.xml, then you can select Refactor -> Rename to the package you want to change the name.

My eclipse Refactor will change the AndroidManifest.xml and make it not even able to compile, so I just paste the AndroidManifest.xml I backup, and change the package name by myself to the new one.

By the way, you should clean your project first, so the file auto generated in the gen folder will be cleaned.

When you build again with your new AndroidManifest.xml, you will get the correct gen folder.

Hope it helps.

Upvotes: 3

user634618
user634618

Reputation: 3593

Are you referring to the android:label attribute of the application tag in the manifest? If so, you could set it directly like so:

    <application
        ...
        android:label="My title"
        ... >

Or configure the string resource this points to by default, I think it was called app_name. Open the file strings.xml in the project subfolder res/values/ and edit it there.

Upvotes: 0

Robert Massaioli
Robert Massaioli

Reputation: 13477

You change it in the manifest file. That is where you can change a whole bunch of settings about the android project itself.

Upvotes: 11

Related Questions