1.登录创建应用后得到id
2.在清单文件中添加权限
3.在mainactivity中添加初始化代码
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bmob.initialize(this, "Your Application ID");
4.在gradle文件中添加仓库地址
allprojects { repositories { jcenter() //Bmob的maven仓库地址,必须填写 maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" } }}
5.在另一个gradle文件中添加依赖
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'cn.bmob.android:bmob-sdk:3.4.6'
6.创建JavaBean,类名要和数据库的表明一致,属性名要和表中字段一致
7.增删改查
save/delete/update/getObject