Skip to content

Commit

Permalink
Fix for Android issue with PNG image during pre-build step
Browse files Browse the repository at this point in the history
  • Loading branch information
chill117 committed Feb 4, 2018
1 parent 257cc45 commit d7a88a4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
5 changes: 5 additions & 0 deletions build-extras.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
android {
aaptOptions {
cruncherEnabled = false
}
}
4 changes: 3 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<description>A merchant terminal app which allows payments by customers via multiple cryptocurrencies.</description>
<icon density="mdpi" height="57" src="www/favicon.ico" width="57" />
<access origin="https://*/*" />
<engine name="browser" spec="5.0.3" />
<platform name="android">
<hook src="scripts/copy-build-extras-gradle-to-platform-dir.js" type="before_prepare" />
</platform>
<engine name="android" spec="6.3.0" />
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
</widget>
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "A merchant terminal app which allows payments by customers via multiple cryptocurrencies.",
"main": "index.js",
"scripts": {
"cordova-browser": "grunt build && cordova platform remove browser && cordova platform add browser && cordova run browser",
"android-device": "grunt build && cordova run android --device",
"android-device": "grunt build && cordova platform remove android && cordova platform add android && cordova run android --device",
"start": "grunt",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -31,7 +30,6 @@
"browserify": "14.3.0",
"bs58check": "2.0.2",
"cordova-android": "6.3.0",
"cordova-browser": "5.0.3",
"cordova-plugin-whitelist": "1.3.3",
"ecurve": "1.0.5",
"grunt": "1.0.1",
Expand All @@ -57,7 +55,6 @@
},
"cordova": {
"platforms": [
"browser",
"android"
],
"plugins": {
Expand Down
21 changes: 21 additions & 0 deletions scripts/copy-build-extras-gradle-to-platform-dir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node

module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var deferral = new Q.defer();
setTimeout(function() {
var fs = require('fs');
var path = require('path');
var srcFilePath = path.join(__dirname, '..', 'build-extras.gradle');
var destFilePath = path.join(__dirname, '..', 'platforms', 'android', 'build-extras.gradle');
var readStream = fs.createReadStream(srcFilePath);
var writeStream = fs.createWriteStream(destFilePath);
readStream.pipe(writeStream);
writeStream.on('error', function(error) {
deferral.reject(error);
}).on('finish', function() {
deferral.resolve();
});
}, 0);
return deferral.promise;
};

0 comments on commit d7a88a4

Please sign in to comment.