Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 1db0697

Browse files
ruslan-bikkininMax
authored andcommitted
[Cordova] Update assets manifest file location for release-cordova command (#548)
* Update assets manifest file location * Update docs * Change from let to const
1 parent 4407244 commit 1db0697

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ It's important that the path you specify refers to the platform-specific, prepar
313313

314314
| Platform | Prepare command | Package path (relative to project root) |
315315
|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
316-
| Cordova (Android) | `cordova prepare android` | `./platforms/android/assets/www` directory |
316+
| Cordova (Android) | `cordova prepare android` | For `cordova-android` version **7 and later**: `./platforms/android/app/src/main/assets/www` directory;<br>For `cordova-android` version **6 and earlier**: `./platforms/android/assets/www` directory; |
317317
| Cordova (iOS) | `cordova prepare ios` | `./platforms/ios/www ` directory |
318318
| React Native wo/assets (Android) | `react-native bundle --platform android --entry-file <entryFile> --bundle-output <bundleOutput> --dev false` | Value of the `--bundle-output` option |
319319
| React Native w/assets (Android) | `react-native bundle --platform android --entry-file <entryFile> --bundle-output <releaseFolder>/<bundleOutput> --assets-dest <releaseFolder> --dev false` | Value of the `--assets-dest` option, which should represent a newly created directory that includes your assets and JS bundle |

cli/script/command-executor.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,14 @@ export var releaseCordova = (command: cli.IReleaseCordovaCommand): Promise<void>
12181218
if (platform === "ios") {
12191219
outputFolder = path.join(platformFolder, "www");
12201220
} else if (platform === "android") {
1221-
outputFolder = path.join(platformFolder, "assets", "www");
1221+
1222+
// Since cordova-android 7 assets directory moved to android/app/src/main/assets instead of android/assets
1223+
const outputFolderVer7 = path.join(platformFolder, "app", "src", "main", "assets", "www");
1224+
if (fs.existsSync(outputFolderVer7)) {
1225+
outputFolder = outputFolderVer7;
1226+
} else {
1227+
outputFolder = path.join(platformFolder, "assets", "www");
1228+
}
12221229
} else {
12231230
throw new Error("Platform must be either \"ios\" or \"android\".");
12241231
}

0 commit comments

Comments
 (0)