最近公司要在App里加IM功能,用融云IM。于是下载其cordova版示例:https://github.com/rongcloud/cordova-plugin-rongcloud-im-demo
按官方说明,编译失败!
一、新建ionic工程来编译
使用ionic命令行,建立一个新的工程,然后把官方示例的www目录下的文件复制过去覆盖掉。
编译,报错:
:compileDebugJavaWithJavacE:WorkAppsrc
ongcloud-demoplatformsandroidsrci
o
ongcordovaRongCloudLibPlugin.java:205: : Ҳ
notification.setLatestEventInfo(mContext, title, tickerText, pending
Intent);
^
: setLatestEventInfo(Context,String,String,PendingIntent)
λ : ΪNotification ı notification
ע: ijЩ ļ ʹ û ѹ ʱ API
ע: й ϸ Ϣ, ʹ -Xlint:deprecation ± 롣
ע: E:WorkAppsrc
ongcloud-demoplatformsandroidsrcio
ongcordovaRongClou
dLibPlugin.javaʹ δ ȫ IJ
ע: й ϸ Ϣ, ʹ -Xlint:unchecked ± 롣
FAILED
1
FAILURE: Build failed with an exception.
根据QQ群344487721中的说法,从源码中注释掉该语句,然后编译成功。
二、添加cordova.file插件
在手机上运行示例,成功登录(如果没有账号,请前往webim.demo.rong.io注册)后,GapDebug中报错:
TypeError: Cannot read property 'externalApplicationStorageDirectory' of undefined
at new <anonymous> (file:///android_asset/www/js/friend/controller.js:68:28)
查看代码:
var path = cordova.file.externalApplicationStorageDirectory;
可知使用了cordova.file插件。现在手工添加之:
cordova plugin add cordova-plugin-file
再次编译运行,无此错误了。
三、添加其他插件
cordova plugin add cordova-plugin-file-transfer cordova-plugin-media cordova-plugin-camera cordova-plugin-geolocation
更多待续...