4

I know this question has been asked many times, but I didn't find exact solutions which I would understand.

I have made a little game with android studio and I would like to publish it. But then I find out that I can't use package name "com.example". How do I change this to "com.MYNAME"?

Here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.MYNAME.APPNAME" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:label="@string/achievements"
            android:name=".Achievements"
            android:parentActivityName=".MainActivity" />
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.MYNAME.APPNAME.MainActivity" />
    </application>

</manifest>

If I change package="com.example.MYNAME.APPNAME"topackage="com.MYNAME.APPNAME", there will be errors in android:name=".MainActivity", android:name=".Achievements", android:parentActivityName=".MainActivity" and android:value="com.MYNAME.APPNAME.MainActivity".

Thank you for help!

Someguy
  • 85
  • 1
  • 10
  • This answer will help you, please have a look:- http://stackoverflow.com/a/29092698/1384010 , if you are using eclipse the please refer to this answer http://stackoverflow.com/a/16630130/1384010 – Adarsh Yadav Aug 02 '15 at 08:06

4 Answers4

2

You need to change .java file package name also. Then clean the project and build again. Because .MainActivity is still in package name "com.example.MYNAME.APPNAME"

Danial Hussain
  • 2,488
  • 18
  • 38
1

please do the following to change your package name to the new one

  1. Right click on your project
  2. Choose Android Tools
  3. Choose Rename Application Package
  4. Enter your new package name then click ok
Salah Nour ElDin
  • 510
  • 2
  • 13
1

Please check this out and change com to org and then you can publish your app

https://youtu.be/A-rITYZQj0A

0

You don't have to do anything manually, Just right click on the package name > refactor > rename. Everywhere in your project the project name will be changed :)

Subhasish Nath
  • 124
  • 1
  • 14