对我们有用的解决方案是使用Cordova / PhoneGap Hook进行此操作.
原文链接:https://www.f2er.com/xml/292350.html在以下路径创建一个钩子
{app-root} / hooks / after_prepare目录/ 010-update-android-manifest.js
重要的是使此文件可执行
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')); }); });
这会将android:largeHeap =“true”附加到应用程序标记.
构建您的应用
科尔多瓦建造