Change libGDX game package id

I have an existing game in google play store. The existing version was fully developed using Android Studio using native codes. Now I'm going to release an extended version of the same game in the game store, but this time the application was developed using libGDX . The problem is that the original name of my application was com.myname.mygame (some privacy issues when revealing the real name). I gave the same package name to the base libGDX project. But when it compiles in android, it adds the .android extension to the package name. Thus, the package name now becomes com.myname.mygame.android , because of which I cannot release the application as an update. What can I do to change the package name?

EDIT

According to one of the answers posted here, I tried to change the package name of the main module fromcom.myname.mygame to com.myname.mygame.core , then changed the package in the manifest to package="com.myname.mygame" and moved AndroidLauncher from com.myname.mygame.android on com.myname.mygame . But now I get the following error when trying to start the application:

 Installing com.myname.mygame.android DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.myname.mygame.android" pkg: /data/local/tmp/com.myname.mygame.android Success Launching application: com.myname.mygame.android/com.myname.mygame.AndroidLauncher. DEVICE SHELL COMMAND: am start -n "com.myname.mygame.android/com.myname.mygame.AndroidLauncher" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.myname.mygame.android/com.myname.mygame.AndroidLauncher } Error type 3 Error: Activity class {com.myname.mygame.android/com.myname.mygame.AndroidLauncher} does not exist. 

I noticed that it is still written that there is com.myname.mygame.android , and the application does not start.

+6
source share
2 answers

Many thanks to Said for the answer, I was able to do this, but I had to do something else to get the application working after changing the package name. I explain the steps here:

  • Change the package name of the main module from com.myname.mygame to com.myname.mygame.core
  • Change the package in the manifest to package="com.myname.mygame"
  • Move AndroidLauncher from com.myname.mygame.android to com.myname.mygame

The above steps solved the problem of changing the package name, many thanks to Saeed. Now the application did not start. Then I saw that the installation command was wrong. To change this, just go to the Android build.gradle application and change the following line:

 commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.myname.mygame.android/com.myname.mygame.android.AndroidLauncher' 

in

 commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.myname.mygame/com.myname.mygame.AndroidLauncher' 

And you are ready to work !!!

+10
source

Libgdx has this architecture:

com.myname.mygame as the main module

com.myname.mygame.android as android module

com.myname.mygame.desktop as a desktop module, etc.

So, you need to reorganize them, for example, change the package name of the main module from com.myname.mygame to com.myname.mygame.core , then change the package in the manifest to package="com.myname.mygame" and move AndroidLauncher from com.myname.mygame.android on com.myname.mygame

+6
source

Source: https://habr.com/ru/post/987858/


All Articles