最近公司要在App里加IM功能,用融雲IM。於是下載其cordova版示例:https://github.com/rongcloud/cordova-plugin-rongcloud-im-demo
按官方說明,編譯失敗!
一、新建ionic工程來編譯
使用ionic命令行,建立一個新的工程,然后把官方示例的www目錄下的文件復制過去覆蓋掉。
編譯,報錯:
:compileDebugJavaWithJavacE:\Work\App\src\rongcloud-demo\platforms\android\src\i
o\rong\cordova\RongCloudLibPlugin.java:205: : Ҳ
notification.setLatestEventInfo(mContext, title, tickerText, pending
Intent);
^
: setLatestEventInfo(Context,String,String,PendingIntent)
λ : ΪNotification ı notification
ע: ijЩ ļ ʹ û ѹ ʱ API
ע: й ϸ Ϣ, ʹ -Xlint:deprecation ± 롣
ע: E:\Work\App\src\rongcloud-demo\platforms\android\src\io\rong\cordova\RongClou
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
更多待續...
