Reputation: 85
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!
Upvotes: 4
Views: 10549
Reputation: 133
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 :)
Upvotes: 0
Reputation: 40
Please check this out and change com to org and then you can publish your app
Upvotes: 1
Reputation: 508
please do the following to change your package name to the new one
Upvotes: 1
Reputation: 2530
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"
Upvotes: 2