Skip to content

Is it possible to add specific properties to gradle.properties file from config.xml? #482

Closed Answered by breautek
PeterHdd asked this question in Q&A
Discussion options

You must be logged in to vote

There's nothing like <edit-config> or <config-file> (which only operates on XML files) for the gradle properties file.

But you can configure an after_prepare hook to run a NodeJS script to manipulate the gradle.properties

The config would look something like:

<widget ...>
    ...
    <platform name="android">
        ...
        <hook type="after_prepare" src="scripts/configureJetifierIgnore.js" />
    </platform>
</widget>

And inside scripts/configureJetifierIgnore.js:

const FS = require('fs');
const Path = require('path');

module.exports = function(context) {
    const propertiesPath = Path.resolve(process.cwd(), 'platforms/android/gradle.properties');
    
    let properties = FS.read…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PeterHdd
Comment options

Answer selected by PeterHdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #481 on June 20, 2024 11:55.