在Android 7.1.1中断开调用时出现java.lang.reflect.InvocationTargetException

时间:2018-05-15 08:00:31

标签: android android-7.1-nougat

我使用以下代码来断开调用,在android更新到7.1.1之后它没有断开连接并且我得到了:" java.lang.SecurityException:MODIFY_PHONE_STATE权限"必要的例外。

|                   DT |   DAY |
|----------------------|-------|
| 2015-01-01T00:00:00Z |   NYD |
| 2015-01-02T00:00:00Z |   FRI |
| 2015-01-03T00:00:00Z |   SAT |
| 2015-01-04T00:00:00Z |   SUN |
| 2015-01-05T00:00:00Z |   MON |
| 2015-01-06T00:00:00Z |   TUE |
| 2015-01-07T00:00:00Z |   WED |
| 2015-01-08T00:00:00Z |   THU |
| 2015-01-09T00:00:00Z |   FRI |
| 2015-01-10T00:00:00Z |   SAT |
| 2015-01-11T00:00:00Z |   SUN |
| 2015-01-12T00:00:00Z |   MON |
...
| 2015-05-21T00:00:00Z |   THU |
| 2015-05-22T00:00:00Z |   FRI |
| 2015-05-23T00:00:00Z |   MEM |
| 2015-05-24T00:00:00Z |   MEM |
| 2015-05-25T00:00:00Z |   MEM |
| 2015-05-26T00:00:00Z |   TUE |
| 2015-05-27T00:00:00Z |   WED |
...
| 2015-07-02T00:00:00Z |   THU |
| 2015-07-03T00:00:00Z |   FRI |
| 2015-07-04T00:00:00Z |  JUL4 |
| 2015-07-05T00:00:00Z |   SUN |
| 2015-07-06T00:00:00Z |   MON |
...
| 2015-09-03T00:00:00Z |   THU |
| 2015-09-04T00:00:00Z |   FRI |
| 2015-09-05T00:00:00Z | LABOR |
| 2015-09-06T00:00:00Z | LABOR |
| 2015-09-07T00:00:00Z | LABOR |
| 2015-09-08T00:00:00Z |   TUE |
| 2015-09-09T00:00:00Z |   WED |
...
| 2015-12-23T00:00:00Z |   WED |
| 2015-12-24T00:00:00Z |   THU |
| 2015-12-25T00:00:00Z |  XMAS |
| 2015-12-26T00:00:00Z |   SAT |
| 2015-12-27T00:00:00Z |   SUN |
| 2015-12-28T00:00:00Z |   MON |
| 2015-12-29T00:00:00Z |   TUE |
| 2015-12-30T00:00:00Z |   WED |
| 2015-12-31T00:00:00Z |   NYE |
| 2016-01-01T00:00:00Z |   NYD |
| 2016-01-02T00:00:00Z |   SAT |
| 2016-01-03T00:00:00Z |   SUN |
...
| 2016-05-26T00:00:00Z |   THU |
| 2016-05-27T00:00:00Z |   FRI |
| 2016-05-28T00:00:00Z |   MEM |
| 2016-05-29T00:00:00Z |   MEM |
| 2016-05-30T00:00:00Z |   MEM |
| 2016-05-31T00:00:00Z |   TUE |
| 2016-06-01T00:00:00Z |   WED |
...
| 2016-06-30T00:00:00Z |   THU |
| 2016-07-01T00:00:00Z |   FRI |
| 2016-07-02T00:00:00Z |  JUL4 |
| 2016-07-03T00:00:00Z |  JUL4 |
| 2016-07-04T00:00:00Z |  JUL4 |
| 2016-07-05T00:00:00Z |   TUE |
| 2016-07-06T00:00:00Z |   WED |
...
| 2016-09-01T00:00:00Z |   THU |
| 2016-09-02T00:00:00Z |   FRI |
| 2016-09-03T00:00:00Z | LABOR |
| 2016-09-04T00:00:00Z | LABOR |
| 2016-09-05T00:00:00Z | LABOR |
| 2016-09-06T00:00:00Z |   TUE |
| 2016-09-07T00:00:00Z |   WED |
...
| 2016-12-23T00:00:00Z |   FRI |
| 2016-12-24T00:00:00Z |   SAT |
| 2016-12-25T00:00:00Z |  XMAS |
| 2016-12-26T00:00:00Z |   MON |
| 2016-12-27T00:00:00Z |   TUE |
| 2016-12-28T00:00:00Z |   WED |
| 2016-12-29T00:00:00Z |   THU |
| 2016-12-30T00:00:00Z |   FRI |
| 2016-12-31T00:00:00Z |   NYE |
| 2017-01-01T00:00:00Z |   NYD |
| 2017-01-02T00:00:00Z |   MON |
| 2017-01-03T00:00:00Z |   TUE |
...
| 2017-05-25T00:00:00Z |   THU |
| 2017-05-26T00:00:00Z |   FRI |
| 2017-05-27T00:00:00Z |   MEM |
| 2017-05-28T00:00:00Z |   MEM |
| 2017-05-29T00:00:00Z |   MEM |
| 2017-05-30T00:00:00Z |   TUE |
| 2017-05-31T00:00:00Z |   WED |
...
and so on...
...
| 2019-12-23T00:00:00Z |   MON |
| 2019-12-24T00:00:00Z |   TUE |
| 2019-12-25T00:00:00Z |  XMAS |
| 2019-12-26T00:00:00Z |   THU |
| 2019-12-27T00:00:00Z |   FRI |
| 2019-12-28T00:00:00Z |   SAT |
| 2019-12-29T00:00:00Z |   SUN |
| 2019-12-30T00:00:00Z |   MON |
| 2019-12-31T00:00:00Z |   NYE |

我有所有的电话许可,它在棉花糖中工作。

1 个答案:

答案 0 :(得分:0)

抛出

InvocationTargetException因为Reflection将底层方法中的任何其他Exception包装到此类中。尝试将整个代码放在try / catch块中,并使用e.printStackTrace()打印堆栈跟踪。应该有一个“引起的:”行,希望能指出你正确的方向。

修改: 或者,您可以使用e.getCause()方法获取基础Exceptione这里是被捕获的例外/可投掷。