cordova - How to add android:largeHeap = "true" in manifest file using Plugin.xml file in phonegap plugin -
how can add android:largeheap true in manifest file using plugin.xml file in android phonegap
a solution worked doing cordova/phonegap hook.
create hook @ following path
{app-root}/hooks/after_prepare directory/010-update-android-manifest.js
important make file executable
chmod +x 010-update-android-manifest.js
#!/usr/bin/env node var fs = require('fs'); var async = require('async'); var exec = require('child_process').exec; var path = require('path'); var root = process.argv[2]; var androidmanifest = path.join(root, 'platforms/android/androidmanifest.xml'); fs.exists(path.join(root, 'platforms/android'), function(exists) { if(!exists) return; fs.readfile(androidmanifest, 'utf8', function(err, data) { if(err) throw err; var lines = data.split('\n'); var searchingfor = '<application android:hardwareaccelerated="true"'; var newmanifest = []; var largeheap = 'android:largeheap="true"'; lines.foreach(function(line) { if(line.trim().indexof(searchingfor) != -1 && line.trim().indexof(largeheap) == -1) { newmanifest.push(line.replace(/\>$/, ' ') + largeheap + ">"); } else { newmanifest.push(line); } }); fs.writefilesync(androidmanifest, newmanifest.join('\n')); }); });
this append android:largeheap="true" application tag.
build app
cordova build
Comments
Post a Comment