开发者

change project name and package name

开发者 https://www.devze.com 2023-02-13 15:10 出处:网络
Is it possible to change the project name and package n开发者_运维技巧ame in Android. Project Name:

Is it possible to change the project name and package n开发者_运维技巧ame in Android.


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)


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


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


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?


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.


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

change project name and package name


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.


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 .

change project name and package name


change project name and package name

for edit name of app follow steps....


  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


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


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.


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>


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.


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"


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


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:

change project name and package name

to:

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

which will look like:

change project name and package name

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号