ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
11.24k stars 955 forks source link

Allow to set minSdkVersion outside of android folder[Feature]: #7408

Closed a-poliusov closed 1 month ago

a-poliusov commented 1 month ago

Description

Allow to set minSdkVersion outside of android folder

Platforms

Request or proposed solution

My android folder is generated each time I deploy my app, I don't have the access to the android folder. I need to change minSdkVersion somehow.

Alternatives

No response

Additional Information

No response

jcesarmobile commented 1 month ago

In Capacitor projects you are supposed to commit the android folder, not recreate it every time.

You can use trapeze to edit the gradle file https://trapeze.dev/docs/Operations/android#gradle

Or use a capacitor hook to edit the /android/variables.gradle file.

a-poliusov commented 1 month ago

@jcesarmobile it would be great if you provide more info on that. What are the hooks and how to use em? Does it solve my problem of editing sdkVersion without android folder? I don't even have the folder inside my git repo.

Why do ionic generate the android folder if we have to edit it? If something is generated, there should be methods to adjust it

jcesarmobile commented 1 month ago

It's not "generated", it's added to your project when you run npx cap add, which you should run only once and you should commit the source code, and make any manual changes you want, capacitor will not make any changes into your project once you have added the platform to it.

hooks are just a way of executing code on certain capacitor commands https://capacitorjs.com/docs/cli/hooks but they don't do anything by themselves, you have to create your scripts (node.js or bash or whatever) to be executed when the hook fires.

If you have questions you can ask on the discussions section https://github.com/ionic-team/capacitor/discussions Or on ionic forum https://forum.ionicframework.com/c/capacitor/26