Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions www/docs/en/latest/guide/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,28 @@ You can optionally limit the scope of each build to specific platforms - 'ios' i
cordova build ios
```

### Passing Platform-Specific Arguments

When using `cordova build` or `cordova run`, you can pass platform-specific options (such as signing flags or Gradle parameters) by prefixing them with the `--` pass-through separator:

```bash
# Example passing Gradle flags on Android
cordova build android -- --gradleArg=-PcdvMinSdkVersion=20

# Example passing signing flags on Android
cordova build android --release -- --packageType=apk
```

> **Note for Windows users:** On Windows (Command Prompt and PowerShell), the `--` separator must be enclosed in quotation marks (`"--"`) so that the shell forwards the arguments to platform build scripts correctly, for example:
> ```bash
> cordova build android --release "--" --packageType=apk
> ```

**See Also:**

- [Cordova build command reference documentation][cdv_build]
- [Android Platform Guide](../../guide/platforms/android/index.html)
- [iOS Platform Guide](../../guide/platforms/ios/index.html)

## Test the App

Expand Down
32 changes: 27 additions & 5 deletions www/docs/en/latest/guide/platforms/android/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ You can set these properties in one of four ways:

- Using an Environment Variables:

**Example:**
**Example (Unix/macOS):**

```bash
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=20
Expand All @@ -479,12 +479,18 @@ You can set these properties in one of four ways:

- Using the `--gradleArg` flag with the Cordova `build` or `run` command:

**Example:**
**Example (Unix/macOS):**

```bash
cordova run android -- --gradleArg=-PcdvMinSdkVersion=20
```

**Example (Windows):**

```bash
cordova run android "--" --gradleArg=-PcdvMinSdkVersion=20
```

- Creating a `gradle.properties` in the project's Android platform directory

Create a file named `gradle.properties` in the directory `<project-root>/platforms/android` with the contents such as:
Expand Down Expand Up @@ -559,10 +565,18 @@ To change the Gradle JVM args, the `--jvmargs` flag can be used with both Cordov

By default, JVM args has a value of `-Xmx2048m`. To increase the maximum allowed memory, use the `-Xmx` JVM arg. Example given below:

```
**Example (Unix/macOS):**

```bash
Comment thread
GitToTheHub marked this conversation as resolved.
cordova build android -- --jvmargs='-Xmx4g'
```

**Example (Windows):**

```bash
cordova build android "--" --jvmargs="-Xmx4g"
```

The following units are supported:

| unit | value | example
Expand Down Expand Up @@ -609,9 +623,17 @@ The parameters above can be specified as an argument when using the [Cordova CLI

_**Note**: You should use double `--` to indicate that these are platform-specific arguments._

Example:
**Example (Unix/macOS):**

```bash
cordova run android --release -- --keystore=../my-release-key.keystore --storePassword=password --alias=alias_name --password=password --packageType=bundle
```

**Example (Windows):**

`cordova run android --release -- --keystore=../my-release-key.keystore --storePassword=password --alias=alias_name --password=password --packageType=bundle`.
```bash
cordova run android --release "--" --keystore=../my-release-key.keystore --storePassword=password --alias=alias_name --password=password --packageType=bundle
```

### Using `build.json`

Expand Down
8 changes: 6 additions & 2 deletions www/docs/en/latest/guide/platforms/ios/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,13 @@ To sign an app, you need the following parameters:

These parameters can be specified using the command line arguments above to the Cordova CLI `build` or `run` commands.

**Note**: You should use double `--` to indicate that these are platform-specific arguments, for example:
**Note**: You should use double `--` to indicate that these are platform-specific arguments.

`cordova run ios --release -- --codeSignIdentity="iPhone Developer" --developmentTeam=FG35JLLMXX4A --packageType=development`.
Comment thread
GitToTheHub marked this conversation as resolved.
**Example (Unix/macOS):**

```bash
cordova run ios --release -- --codeSignIdentity="iPhone Developer" --developmentTeam=FG35JLLMXX4A --packageType=development
```

### Using build.json

Expand Down
Loading