proton icon indicating copy to clipboard operation
proton copied to clipboard

Easier way to change a project's bundle name with the new android build system?

Open iProgramMC opened this issue 2 years ago • 9 comments

The current build system thing has a major flaw: all applications generated by it are called com.rtsoft.RTAndroidApp. This is OK-ish if you're only building one application using Proton SDK, but good luck building two or more with the same 'shared' files. Is this going to be changed?

iProgramMC avatar Jul 26 '22 19:07 iProgramMC

That's the beauty of the new system - just edit local.properties and change the app id there and the entire build will use it instead. Everything in shared can stay com.rtsoft.RTAndroidApp, it won't matter.

SethRobinson avatar Jul 28 '22 09:07 SethRobinson

I have tried this. The shared stuff stays as "Java_com_rtsoft_RTAndroidApp_XXX" and I get crashes due to missing functions unless I change the function name to "Java_com_iprogramincpp_myprojectnamehere" or whatever the new bundle name is.

That being said, I probably did something wrong. Not only did I change the local.properties file, I also changed the java files inside the local project AndroidGradle folder to have the package name the same as local.properties and there was the crash.

iProgramMC avatar Jul 28 '22 17:07 iProgramMC

Hmm - I suspect you might have changed one you shouldn't have maybe?

Make sure you DIDN'T change the ID in AndroidGradle\app\build.gradle, AndroidGradle\app\src\main\java\com\rtsoft\RTAndroidApp\Main.java or AndroidGradle\app\src\main\cpp\CMakeList.txt.

I was about to tell you to compile RTBareBones's android project as a test, but it looks like to me I might have made a mistake and it's not fully updated on github. (Sorry!)

Please try RTSimpleApp instead. If you search for where com.rtsoft.rtsimpleapp is you should see it's only in local.properties_removethispart_ (remove the _removethispart and edit in your keystore/password stuff, otherwise it can't produce a release bundle)

Dink, Mind Wall and Dungeon Scroll on the Play store are all using this build system, so in theory this should work. Let me know what happens, I'll update the docs to be better, this is my fault!

SethRobinson avatar Jul 28 '22 22:07 SethRobinson

Right, I use RTBareBones, and I have changed the folder structure from com/rtsoft/RTAndroidApp, but I will try both RTBareBones and RTSimpleApp just changing the package name in the local.properties.

iProgramMC avatar Jul 29 '22 06:07 iProgramMC

RTSimpleApp should compile and run without problems - but keep in mind if you DO change the package name, it HAS to match the package name in App.cpp as well. (AndroidUtils.cpp uses it when it does SetJavaPackageName(string(GetBundlePrefix())+string(GetBundleName())); )

look for:

const char * GetBundleName() { const char * bundleName = "rtsimpleapp"; return bundleName; }

and make sure that matches what you changed it to.

SethRobinson avatar Jul 29 '22 07:07 SethRobinson

I don't understand how I got a notification about a post here (the one with screenshots) that isn't actually in this thread, heh. Anyway, I've recently switched machines again so I'm going to go through the process of installing android studio etc and building these. If it's setup for FMOD in rtsimpleapp, yeah, that's a mistake, I'll switch it back to the default android audio system.

SethRobinson avatar Jul 30 '22 05:07 SethRobinson

Sorry. I deleted the comment because I messed up something

iProgramMC avatar Jul 30 '22 08:07 iProgramMC

I updated the gradle files for both sample projects. Removed fmod from rtsimpleapp, hopefully it works for ya now

SethRobinson avatar Aug 01 '22 06:08 SethRobinson

okey

ChristianIQ avatar Oct 05 '22 14:10 ChristianIQ