最新消息:20210917 已从crifan.com换到crifan.org

【未解决】rcsjta的core出错:java.lang.NullPointerException Attempt to invoke virtual method java.lang.String com.gsma.rcs.utils.ContactUtil PhoneNumber.getNumber on a null object reference

core crifan 567浏览 0评论
折腾:
【未解决】rcsjta的core出错:FATAL EXCEPTION main android.os.FileUriExposedException file exposed beyond app through Intent.getData()
期间,调试core期间,点击保存,遇到另外的错误:
D/View: [Warning] assignParent to null: this = android.widget.LinearLayout{a0c8df0 V.E...... ......ID 0,0-880,162}
W/InputEventReceiver: Slow Input: took 118ms in dispatching, now at finishInputEvent (MotionEvent: event_seq=5, seq=39535, action=ACTION_UP)
V/[RCS][Provisioning]: Save provisioning
V/[RCS][StackProvisioning]: persistRcsSettings
V/[RCS][ProfileProvisioning]: persistRcsSettings
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.gsma.rcs, PID: 16077
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.gsma.rcs.utils.ContactUtil$PhoneNumber.getNumber()' on a null object reference
        at com.gsma.rcs.utils.ContactUtil.createContactIdFromValidatedData(ContactUtil.java:128)
        at com.gsma.rcs.provisioning.local.ProvisioningHelper.saveContactIdEditText(ProvisioningHelper.java:90)
        at com.gsma.rcs.provisioning.local.ProfileProvisioning.persistRcsSettings(ProfileProvisioning.java:144)
        at com.gsma.rcs.provisioning.local.Provisioning.onOptionsItemSelected(Provisioning.java:168)
        at android.app.Activity.onMenuItemSelected(Activity.java:3608)
        at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:408)
        at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:198)
        at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:107)
        at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:671)
        at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:817)
        at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156)
        at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:964)
        at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:954)
        at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:624)
        at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:157)
        at android.view.View.performClick(View.java:6614)
        at android.view.View.performClickInternal(View.java:6587)
        at android.view.View.access$3100(View.java:787)
        at android.view.View$PerformClick.run(View.java:26122)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6831)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:927)
E/MQSEventManagerDelegate: failed to get MQSService.
代码是:
src/com/gsma/rcs/utils/ContactUtil.java
/**
 * Creates a ContactId from a validated phone number
 * 
 * @param phoneNumber the validated phone number
 * @return the Contact Identifier
 */
public static ContactId createContactIdFromValidatedData(PhoneNumber phoneNumber) {
    synchronized (ContactUtil.class) {
        if (mContactUtil == null) {
            mContactUtil = com.gsma.services.rcs.contact.ContactUtil.getInstance(AndroidFactory
                    .getApplicationContext());
        }
    }
    try {
        return mContactUtil.formatContact(phoneNumber.getNumber());


    } catch (RcsPermissionDeniedException e) {
        /*
         * This exception cannot occur since PhoneNumber can only be instantiated for valid
         * numbers.
         */
        String errorMessage = "Phone number '" + phoneNumber
                + "' cannot be converted into contactId!";
        throw new IllegalStateException(errorMessage, e);
    }
}
看起来是:
获取手机号失败了?
那去找找代码逻辑。
number是前面传入的
src/com/gsma/rcs/provisioning/local/ProvisioningHelper.java
public void saveContactIdEditText(int resViewTextId, String settingsKey) {
    EditText txt = (EditText) mRootView.findViewById(resViewTextId);
    String text = txt.getText().toString();
    ContactUtil.PhoneNumber number = ContactUtil.getValidPhoneNumberFromUri(text);
    if (number == null) {
        txt.setText("");
    }
    mRcsSettings.writeContactId(settingsKey,
            "".equals(text) ? null : ContactUtil.createContactIdFromValidatedData(number));
}
去研究看看第一就:
EditText txt = (EditText) mRootView.findViewById(resViewTextId);
此处返回的值如何
然后此处运行不到断点,无法调试。
再去想其他办法
再去找找相关代码逻辑
后记:
【未解决】通过调试rcsjta中core的入口Provisioning去寻找服务启动的逻辑
期间,可以调试到一些断点了
包括 点击保存后,最终触发运行到了上面的
com.gsma.rcs.provisioning.local.Provisioning.onOptionsItemSelected
的部分,所以继续调试看看
【记录】调试rcsjta的core的apk点击保存按钮触发Provisioning的onOptionsItemSelected相关代码调用逻辑

转载请注明:在路上 » 【未解决】rcsjta的core出错:java.lang.NullPointerException Attempt to invoke virtual method java.lang.String com.gsma.rcs.utils.ContactUtil PhoneNumber.getNumber on a null object reference

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.179 seconds, using 23.29MB memory