我正在尝试构建一个混合应用程序,我在大约一小时前构建了具有相同环境的应用程序,但现在我无法为任何平台构建。 cordova给我以下错误
D:\xampp\htdocs\applications\quadBuild>phonegap build android
[phonegap] executing 'cordova build android'...
D:\xampp\htdocs\applications\quadBuild>cordova build android
Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char:
at error (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordova\node_m
odules\cordova-lib\node_modules\elementtree\node_modules\sax\lib\sax.js:347:8)
at strictFail (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordova\n
ode_modules\cordova-lib\node_modules\elementtree\node_modules\sax\lib\sax.js:364
:22)
at Object.write (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordova
\node_modules\cordova-lib\node_modules\elementtree\node_modules\sax\lib\sax.js:6
03:11)
at XMLParser.feed (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordo
va\node_modules\cordova-lib\node_modules\elementtree\lib\parsers\sax.js:48:15)
at ElementTree.parse (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\node_modules\elementtree\lib\elementtree.js:263:1
0)
at Object.exports.XML (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\node_modules\elementtree\lib\elementtree.js:593:
13)
at Object.module.exports.parseElementtreeSync (C:\Users\Spartan 7\AppData\Ro
aming\npm\node_modules\cordova\node_modules\cordova-lib\src\util\xml-helpers.js:
123:38)
at ConfigFile_load [as load] (C:\Users\Spartan 7\AppData\Roaming\npm\node_mo
dules\cordova\node_modules\cordova-lib\src\plugman\util\ConfigFile.js:69:33)
at new ConfigFile (C:\Users\Spartan 7\AppData\Roaming\npm\node_modules\cordo
va\node_modules\cordova-lib\src\plugman\util\ConfigFile.js:48:10)
at ConfigKeeper_get [as get] (C:\Users\Spartan 7\AppData\Roaming\npm\node_mo
dules\cordova\node_modules\cordova-lib\src\plugman\util\ConfigKeeper.js:51:23)
重启后会发生这种情况。可能是什么问题呢?请帮帮我。
答案 0 :(得分:0)
您是否考虑过删除Windows系统自动从XML数据中添加到utf-8文件的字节顺序标记字符?
在传递要解析的xml值之前,请尝试删除该字符:
AlarmManager am = (AlarmManager)getApplicationContext().getSystemService(Context.ALARM_SERVICE);
Intent inte = new Intent(this,NotificationReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(this,0,inte,0);
if(settings.getBoolean("backgroundRunning",true)){
/*Intent intent = new Intent(this,BackgroundService.class);
bindService(intent, m_serviceConnection,BIND_AUTO_CREATE);
startService(intent);*/
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.set(Calendar.HOUR_OF_DAY,17);
cal.set(Calendar.MINUTE,0);
cal.set(Calendar.SECOND,0);
am.setRepeating(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis(),AlarmManager.INTERVAL_DAY,pi);
}
else if(am!=null&&settings.getBoolean("backgroundRunning",true)){
am.cancel(pi);
}
来源:http://www.multiasking.com/blog/xml2js-sax-js-non-whitespace-before-first-tag/