szaza / set-detector

This object detection application is able to play the classic SET card game.
0 stars 0 forks source link

Client apk getting stopped #1

Open spaul13 opened 5 years ago

spaul13 commented 5 years ago

I have already started the server on a ubuntu machine in the same local area network where my phone is connected. BootRun is running and showing 80% Executing with the time when it started executing.

I changed the IP address and port number in config.java in the client side and launch the app on Pixel 2. But after hitting the send button to send a particular image to the server to detect it. I am getting the following error and the apk got stopped.

ERROR: 04-03 13:11:52.118 8778-8778/edu.tensorflow.client E/AndroidRuntime: FATAL EXCEPTION: main Process: edu.tensorflow.client, PID: 8778 java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.tensorflow.client/edu.tensorflow.client.camera.ListResultActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String edu.tensorflow.client.api.dto.ResultDTO.getPredictedImage()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String edu.tensorflow.client.api.dto.ResultDTO.getPredictedImage()' on a null object reference at edu.tensorflow.client.api.ResultAssembler.convertToEntityList(ResultAssembler.java:24) at edu.tensorflow.client.camera.ListResultActivity.onCreate(ListResultActivity.java:25) at android.app.Activity.performCreate(Activity.java:6999) at android.app.Activity.performCreate(Activity.java:6990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6494)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

Can @szaza or anyone else please tell me why I am getting this error and how to resolve it?

szaza commented 5 years ago

Hi,

That is interesting, I cannot tell you for sure what the problem is. The error message is descriptive enough, it is because the resultDTO is null at that point so the getPredictedImage() cannot be called for it. The better question: why is it null? Hmmm... good question. Could you replace the android client with Postman and try to simulate a valid request? I would be curious if the server responds correctly? Have you set correctly the port forwarding on your router? Could you please start the client application in debug mode and check the server response? Does the server logs any error message?

Kind regards, Zoltan

spaul13 commented 5 years ago

Hi @szaza, thanks for replying me back. sorry for replying you after a long time. Can u please elaborate

1) what port forwarding I have to add in the router settings?

2) How to replace the android client with a postman?