rosjava / android_apps

Applications built on top of the rosjava android libraries.
133 stars 112 forks source link

Indigo camera update required #42

Open stonier opened 9 years ago

stonier commented 9 years ago

Most of the apps utilised the old Camera class which got updated for indigo. This stops map_nav, make_a_map, map_manager from compiling.

stonier commented 9 years ago

Disabled temporarily the map manager addLayer, hideLayer since that api got deprecated and there is no replacements for them. Fix when we test them. The api changes are in https://github.com/rosjava/android_core/commit/55054322e627d0c1d8950d315320abbc624deff3

HelloEgg commented 7 years ago

I cloned "android_apps" repository and changed "mapview.addLayer" to mapView.onCreate(Lists.newArrayList(viewControlLayer,occupancyGridLayer,laserScanLayer,pathLayer,mapPosePublisherLayer,initialPoseSubscriberLayer)); However, error occured when I connected to my robot saying:

Process: com.github.rosjava.android_apps.map_manager.indigo, PID: 21230 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.IllegalStateException: setRenderer has already been called for this instance. at android.opengl.GLSurfaceView.checkRenderThreadState(GLSurfaceView.java:1935) at android.opengl.GLSurfaceView.setEGLConfigChooser(GLSurfaceView.java:470) at android.opengl.GLSurfaceView.setEGLConfigChooser(GLSurfaceView.java:539) at org.ros.android.view.visualization.VisualizationView.onCreate(VisualizationView.java:81) at com.github.rosjava.android_apps.map_manager.MainActivity.init(MainActivity.java:225) at org.ros.android.RosActivity$2.doInBackground(RosActivity.java:204) at org.ros.android.RosActivity$2.doInBackground(RosActivity.java:201) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

Do you have any suggestion what I should do?

adamantivm commented 7 years ago

@HelloEgg can you share a bit more information on what you did in order to get to this point?

For example:

Any other relevant environment information that you can share would be helpful. Thanks!

HelloEgg commented 7 years ago

Well I havent change Gradle version.. I use the newest version of android studio And I use Galaxy s6 Marshmellow(api23) Do you happen to have a project file that has successfully ran on android device? Thank you very much for your help... I am dire for solution as I have been pulling my hears off for past few days figuring out possible way to run "map_nav" and other apps in "android_apps" repository...

I changed the

adamantivm commented 7 years ago

@HelloEgg my impression is that perhaps some instance of addLayer replacement was missed. I am trying myself and I see that the errors pointed at by the exception are places where I forgot to change the API as suggested on #51. Perhaps may I suggest that you create a PR to indigo with your code changes? That will allow myself (and others) to see exactly how are you doing what is suggested in #51 to give better advice and, when it works, we can merge it as a temporary workaround so that life will be easier for the next one.

HelloEgg commented 7 years ago

Sure thank you very much! You suggest that I should make a seperate tree? (Sorry I relatively newb to git) I tried the "MainActivity" code suggested by stonier as shown in the source code.. The original error(doInbackground) is fixed however new error came up though... It says: Process: com.github.rosjava.android_apps.map_nav.indigo, PID: 25063 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.opengl.GLSurfaceView$GLThread.surfaceCreated()' on a null object reference at android.opengl.GLSurfaceView.surfaceCreated(GLSurfaceView.java:629) at android.view.SurfaceView.updateWindow(SurfaceView.java:712) at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:209) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1014) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2560) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1487) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7450) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) at android.view.Choreographer.doCallbacks(Choreographer.java:695) at android.view.Choreographer.doFrame(Choreographer.java:631) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7229) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Seems like android studio cannot catch "surface created" as it says 'null pointer error'..

The "MainActivity"code is exactly same with what stonier fixed (https://github.com/rosjava/android_apps/commit/9e780b4bbb647360a3ebfb25b0edbb9b8e023391) What do you think to be a problem?? Thank you very much for your help guys..

adamantivm commented 7 years ago

@HelloEgg I think I know what the problem is: you're probably using the master branch? That one is currently obsolete. You should try using the indigo or kinetic branch instead, which already has this change applied to it.

HelloEgg commented 7 years ago

I tried both indigo and kinetic branch

I noticed that the "addlayer" part was still not fixed..

Should you know any repository that fixed right.. Please tell me

adamantivm commented 7 years ago

I tried a few things and I agree with you that even with the addLayer fixes (they were added again afterwards) map_nav still crashes. I am not sure what to suggest next, it needs more profound debugging to be fixed, it is currently broken.