-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: appName has no effect (android, capacitor V5) #191
Comments
I don't agree that Trapeze should change strings.xml by default, because there is no guarantee those keys will remain there on any project. Instead, you can edit XML contents inside your trapeze config.yaml file like this: vars:
PACKAGE_NAME:
default: com.myawesomeapp.app
platforms:
android:
xml:
#strings.xml
- resFile: values/strings.xml
target: resources/string[@name="app_name"]
replace: |
<string name="app_name">$APP_NAME</string> |
@selcuk-sahin Well, according to the documentation Trapeze already changes the Source: https://trapeze.dev/docs/Operations/android#appname Thank you anyways, for this temporary workaround. |
Thanks for that, I didn't recognize the documentation has that info. |
All good then? Open to suggestions on tweaking this behavior |
@mlynch No. Trapeze does not work as expected. It should update the variables in the strings.xml (as described in the documentation), but currently it does not update them. That's why |
Hmm, tests for this are passing locally. I wonder if there's some difference in the structure of the app that causes it to not work. |
I'm having a hard time following the thread, are you saying that trapeze should also update |
No. In my case Feel free to try the provided reproduction repository. You could also try to remove the capacitor android platform and freshly re add it to your test environment. I assume, that something has changed in the project structure in the past few updates. |
@mlynch Have you been able to reproduce the error, or can I help you somehow? |
@mlynch Yes, but have you started this app in the emulator and inspected it's name in the programs menu? You will see, that I found out that trapeze should also change |
@mlynch P.S.: is it expected behavior, that |
I assume you mean when changing the package name? Right now it doesn't look like that string is actually being used anywhere so the tool wouldn't change it. Trapeze is agnostic of the mobile framework so it tries to not assume random strings mean anything in your res files. We can have a separate discussion about package name changes though in a different issue. |
@mlynch Thank you for your in-depth responses. Regarding In my opinion, developers should at least have a simple option to manipulate the app's displayed name. While keeping in mind what you said about Trapeze's agnosticism, I'd suggest to handle it similar to iOS (where we have a Regarding |
At some point this get's worse. when you try and change an app name after Android built it.
Surely the idea of this is that you can have one app source (javascript, css etc) and build different app store apps.. ie: Whitelabeling.. |
I ended up doing something like this in the config-app1.yaml file vars:
BUNDLE_ID:
default: com.amazing.appone
PACKAGE_NAME:
default: com.amazing.appone
APP_NAME:
default: App One
platforms:
android:
packageName: $PACKAGE_NAME
appName: $APP_NAME
versionName: 1.1.1
versionCode: 111
xml:
#strings.xml
- resFile: values/strings.xml
target: resources/string[@name="app_name"]
replace: |
<string name="app_name">$APP_NAME</string>
- resFile: values/strings.xml
target: resources/string[@name="title_activity_main"]
replace: |
<string name="title_activity_main">$APP_NAME</string>
- resFile: values/strings.xml
target: resources/string[@name="package_name"]
replace: |
<string name="package_name">$PACKAGE_NAME</string>
- resFile: values/strings.xml
target: resources/string[@name="custom_url_scheme"]
replace: |
<string name="custom_url_scheme">$PACKAGE_NAME</string> that produces this output: <?xml version='1.0' encoding='utf-8' ?>
<resources>
<string name="app_name">App One</string>
<string name="title_activity_main">App One</string>
<string name="package_name">com.amazing.appone</string>
<string name="custom_url_scheme">com.amazing.appone</string>
</resources> then there is an equivalent for config-app2.yaml BUT trapeze does not update the capacitor.config.json or capacitor.config.ts I'm surprised at how capacitor does not understand multi tenant apps from the same source base. Is it that unique? |
I just spent hours trying to figure out this exact issue. Then found this.. silly me 🤦♂️ I think @tobiasmuecksch is dead on and his proposal to set title_activity makes sense. @gerhardcit's solution doesn't work for me as I'm using the project API. @mlynch thanks for your thoughtful discussion on this thread and generally for your work on ionic and capacitor. |
I am building capacitor whitelabel apps using capacitor@4 for some time now. The trick is to update the string values after you build & sync the app so the appId and appName in capacitor config do not really matter (correct me if I'm wrong).
However with the capacitor@5 changes I encountered the same error as you regarding the manifest. The steps I used to solve it:
the major diff I noticed in the manifest is
now trapeze is working as intended and com.example.app is replaced with my 'com.amazing.appone' everywhere |
Is the strings.xml adjustment the preferred solution? If so, can the documentation be corrected to the appropriate icon and app naming. |
Hi, Whatever the decision is: The thread is already half a year old and it should either be pointed out in the documentation or the change should simply be applied. |
@tiga05 I'd advise you to create a new issue, since this issue already is too old and too long. I'll close it, as I'm not developing apps anymore. |
Description
This issue is explicitly about android.
I'm trying to manipulate the app name with trapeze. According to the docs
appName
is the way to go.Therefore I've set an appName like this:
But when I deploy the app, it still has the previous name, instead of expected
cap5 Test App
.Of course this time I tried clean project, rebuild project, and cache invalidation, before I opened this issue.
Versions
Trapeze: 7.0.10
Capacitor: 5.0.0
Reproduction
npm i
ionic cap sync
npx @trapezedev/configure run platform-config.yml
ionic cap open android
The text was updated successfully, but these errors were encountered: