由权限引起的悲剧——集成声网SDK遇到的问题总结

使用声网SDK demo做直播,发现本地摄像头可以调取,但是集成到应用中,却无法调取摄像头。

于是将声网SDK demo代码原封不动拷贝到应用中,还是无法使用本地摄像头。

查找声网网站发现,SDK有log保存到了SD卡,于是查看log。

INFO (22:59:48:123 | 0) 22311; Thread with name:Trace started
INFO (22:59:48:123 | 0) 22310; Agora Rtc Engine SDK ver 1.12.0 build 200, built on Jul 26 2017 10:52:52
INFO (22:59:48:124 | 1) 22310; CacheManager: load cache from storage elapsed 0
ERROR (22:59:48:124 | 0) 22310; CacheManager: load report cache from storage error, err=2 elapsed 0
INFO (22:59:48:124 | 0) 22310; use event engine
INFO (22:59:48:124 | 0) 22313; Agora Rtc Engine started
INFO (22:59:48:124 | 0) 22310; android init: deviceId 0xdbffedf8 configDir 0xdbffedfc dataDir 0xdbffee00
INFO (22:59:48:130 | 6) 22310; [AudioRoute] initialize +
INFO (22:59:48:132 | 2) 22310; [AudioRoute] Monitor stopped
INFO (22:59:48:132 | 0) 22310; [AudioRoute] Headset setup: Plugged = false
WARN (22:59:48:135 | 3) 22310; [AudioRoute] lacks BLUETOOTH permission
INFO (22:59:48:153 | 18) 22310; [RtcEngine] system phone call end
INFO (22:59:48:155 | 2) 22313; network: 'NETWORK_UNKOWN' -> 'WIFI' ipv4/v6 '192.168.0.104'/'' gw '192.168.0.1'/'' subtype 100 level 3 ssid 'dlink' bssid 'c8:d3:a3:47:8c:4a' rssi -46 asu 0
INFO (22:59:48:155 | 0) 22313; initialize plugin manager
INFO (22:59:48:155 | 0) 22313; checking if running on ARM emulator
INFO (22:59:48:156 | 1) 22313; cpu arch is 40
INFO (22:59:48:156 | 0) 22313; loading encryption module: '/data/app/com.huobi-2/lib/arm/libagora-crypto.so'
INFO (22:59:48:157 | 1) 22313; loaded lib '/data/app/com.huobi-2/lib/arm/libagora-crypto.so'
INFO (22:59:48:157 | 0) 22313; built-in encryption is enabled
INFO (22:59:48:158 | 1) 22313; [ps] start to apply
INFO (22:59:48:159 | 1) 22313; [ps] applied
INFO (22:59:48:160 | 1) 22313; found 'letv/' for device 'letv/x900/lemax_cn/max1/21/3.10.49-perf-gfb0d54d'
INFO (22:59:48:160 | 0) 22313; [rp] {"rtc.channel_profile":1}
INFO (22:59:48:160 | 0) 22313; [rp] {"rtc.video.enabled":true}
INFO (22:59:48:160 | 0) 22313; API call to enable video
INFO (22:59:48:160 | 0) 22313; [rp] {"rtc.log_file":"/storage/emulated/0/com.huobi/log/agora-rtc.lo

发现了这行话,
WARN (22:59:48:135 | 3) 22310; [AudioRoute] lacks BLUETOOTH permission

对比demo与应用发现,少了两个权限,立马加上:



于是发现本地摄像头可以调取了。

你可能感兴趣的:(由权限引起的悲剧——集成声网SDK遇到的问题总结)