Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于接口参数类型 #37

Open
huafresh opened this issue Mar 1, 2020 · 0 comments
Open

关于接口参数类型 #37

huafresh opened this issue Mar 1, 2020 · 0 comments

Comments

@huafresh
Copy link

huafresh commented Mar 1, 2020

如果接口这么定义:
int add(int a, Integer b);
会报异常:
2020-03-01 16:51:58.608 15114-15114/com.hua.myandromeda E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hua.myandromeda, PID: 15114
java.lang.NullPointerException: Expected to unbox a 'int' primitive type but was returned null
at $Proxy0.add(Unknown Source)
at com.hua.myandromeda.MainActivity$2.onClick(MainActivity.java:31)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
点击事件代码:
IApi apiService = InterStellar.with(MainActivity.this).getRemoteService(IApi.class);
int add = apiService.add(4, 5);

@huafresh huafresh closed this as completed Mar 1, 2020
@huafresh huafresh reopened this Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant