报错内容:
06-20 16:47:49.519: E/AndroidRuntime(21018): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zipingfang.wanhucang/com.heiyue.project.ui.IndexActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.intern()' on a null object reference 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2460) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2522) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.ActivityThread.access$800(ActivityThread.java:167) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.os.Handler.dispatchMessage(Handler.java:111) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.os.Looper.loop(Looper.java:179) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.ActivityThread.main(ActivityThread.java:5543) 06-20 16:47:49.519: E/AndroidRuntime(21018): at java.lang.reflect.Method.invoke(Native Method) 06-20 16:47:49.519: E/AndroidRuntime(21018): at java.lang.reflect.Method.invoke(Method.java:372) 06-20 16:47:49.519: E/AndroidRuntime(21018): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955) 06-20 16:47:49.519: E/AndroidRuntime(21018): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750) 06-20 16:47:49.519: E/AndroidRuntime(21018): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.intern()' on a null object reference 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.content.IntentFilter.addCategory(IntentFilter.java:1167) 06-20 16:47:49.519: E/AndroidRuntime(21018): at cn.jpush.android.service.ServiceInterface.a(Unknown Source) 06-20 16:47:49.519: E/AndroidRuntime(21018): at cn.jpush.android.api.JPushInterface.a(Unknown Source) 06-20 16:47:49.519: E/AndroidRuntime(21018): at cn.jpush.android.api.JPushInterface.setAliasAndTags(Unknown Source) 06-20 16:47:49.519: E/AndroidRuntime(21018): at cn.jpush.android.api.JPushInterface.setAlias(Unknown Source) 06-20 16:47:49.519: E/AndroidRuntime(21018): at com.heiyue.project.dao.ServerDao.setJpushAlias(ServerDao.java:198) 06-20 16:47:49.519: E/AndroidRuntime(21018): at com.heiyue.project.ui.IndexActivity.initViews(IndexActivity.java:55) 06-20 16:47:49.519: E/AndroidRuntime(21018): at com.heiyue.project.base.BaseActivity.onCreate(BaseActivity.java:151) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.Activity.performCreate(Activity.java:5975) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) 06-20 16:47:49.519: E/AndroidRuntime(21018): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413) 06-20 16:47:49.519: E/AndroidRuntime(21018): ... 10 more
报错位置:
public void setJpushAlias() { User cacheUser = getCacheUser(); if (cacheUser == null) { return; } String tel = cacheUser.tel; if (!TextUtils.isEmpty(tel)) { LogOut.d(" 绑定极光 ", " tel:" + tel); // 为极光设置别名,后台使用用户的账户id作为别名推送 JPushInterface.setAlias(context, tel, new TagAliasCallback() { @Override public void gotResult(int arg0, String arg1, Set<String> arg2) { LogOut.d(" 绑定极光 ", "[initJPush] 设置别名: " + "arg0:" + arg0 + ",arg1:" + arg1 + ",arg2:" + arg2); if (arg0 != 0) { // 设置失败,重新设置 setJpushAlias(); } } }); } }
准确的报错位置是:
JPushInterface.setAlias(context, tel, new TagAliasCallback() {解决方案
在libs下的每个子文件夹里拷入相对应的so文件
注明:如果上面的方法不能解决您的问题,那就需要升级一下jar文件和so文件了,我用的是,就解决了这个问题,如果您用的是205的版本,报这种错误,就可以用这种方式。