本文主要是介绍easeui使用的坑,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-
直接复制 easemob-sdk-3.5.4\examples\easeui\easeui 这个文件
-
settings.gradle文件改成include ':app',':easeui'
-
app的build.gradle中dependencies{api project(':easeui')}
-
easeui中build.gradle改成
api files('libs/hyphenatechat_3.5.4.jar') api files('libs/BaiduLBS_Android.jar') api files('libs/org.apache.http.legacy.jar')
-
manifest中设置权限和APPKEY
-
compile 改成 implementation
-
androidTestCompile 改成 androidTestImplementation
-
easeui中build.gradle中除了minSdkVersion可改,其它版本不要动.
如果报Error:Program type already present: com.hyphenate.EMCallBack
1:删除app\libs下面的hyphenatechat_3.5.0.jar
2:注销app中build.gradle 中的//api files('libs/hyphenatechat_3.5.0.jar')
3:在easeui中build.gradle中 dependencies里面添加
configurations { all*.exclude group: 'com.android.support', module: 'support-v13' }
原因是hyphenatechat_3.5.4.jar重复了
不建议直接用EASEUI..封闭的太多.BUG太多.不友好...
public class EMChatActivity extends AppCompatActivity {@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_chat);//new出EaseChatFragment或其子类的实例EaseChatFragment chatFragment = new EaseChatFragment();//传入参数Bundle args = new Bundle();args.putInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_SINGLE);args.putString(EaseConstant.EXTRA_USER_ID, "z1");chatFragment.setArguments(args);getSupportFragmentManager().beginTransaction().add(R.id.ec_layout_container, chatFragment).commit();}
}
-----------------------------------------------------------case R.id.btn_fr_easeui_danliao:Intent intent = new Intent(getActivity(), EMChatActivity.class);startActivity(intent);
这篇关于easeui使用的坑的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!