1.在module的gradle添加依赖
android {
......
defaultConfig {
applicationId "com.xxx.xxx" //JPush上注册的包名.
......
ndk {
//选择要添加的对应cpu类型的.so库。
abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a','x86', 'x86_64', 'mips', 'mips64'
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "你的appkey", //JPush上注册的包名对应的appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
]
......
}
......
}
dependencies {
......
compile 'cn.jiguang.sdk:jpush:3.0.3' // 此处以JPush 3.0.3 版本为例。
compile 'cn.jiguang.sdk:jcore:1.1.1' // 此处以JCore 1.1.1 版本为例。
......
}
2.在Project 根目录的gradle.properties文件中添加:
android.useDeprecatedNdk=true
3.在application中初始化
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
4.复制res 到main
5.出现图片错误 删除build
6.
Set<String> set=new HashSet<>(); set.add("买手机"); set.add("买电脑"); JPushInterface.setAliasAndTags(this, "wanghaokun", set, new TagAliasCallback() { @Override public void gotResult(int i, String s, Set<String> set) { } });