rosjava / android_apps

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

Build map_nav got errors #51

Closed wennycooper closed 7 years ago

wennycooper commented 8 years ago

I got following errors in building map_nav module in Android Studio.

Error:(161, 16) error: cannot find symbol method addLayer(ViewControlLayer)
Error:(162, 16) error: cannot find symbol method addLayer(OccupancyGridLayer)
Error:(163, 16) error: cannot find symbol method addLayer(LaserScanLayer)
Error:(164, 16) error: cannot find symbol method addLayer(PathLayer)
Error:(165, 16) error: cannot find symbol method addLayer(MapPosePublisherLayer)
Error:(166, 16) error: cannot find symbol method addLayer(InitialPoseSubscriberLayer)

I post the same problem in ros answer as well. Plz help!! Thanks!!

http://answers.ros.org/question/220324/building-android_apps-errors-on-android-studio/

samiHajjaj commented 8 years ago

referring to this ... https://github.com/rosjava/android_apps/issues/42 (second last point)

change the above code to this ..

mapView.onCreate(Lists.newArrayList( viewControlLayer, occupancyGridLayer, laserScanLayer, pathLayer, mapPosePublisherLayer, initialPoseSubscriberLayer ));

should do the trick .. and without altering the old android library

wennycooper commented 8 years ago

Thank you!!

tony1213 commented 8 years ago

Change this code: mapView.addLayer(viewControlLayer); mapView.addLayer(occupancyGridLayer); mapView.addLayer(laserScanLayer); mapView.addLayer(pathLayer); mapView.addLayer(mapPosePublisherLayer); mapView.addLayer(initialPoseSubscriberLayer); To: mapView.onCreate(Lists.newArrayList(viewControlLayer, occupancyGridLayer, laserScanLayer, pathLayer, mapPosePublisherLayer,nitialPoseSubscriberLayer));

HelloEgg commented 7 years ago

I tried this method. However, I get an error saying: Process: com.github.rosjava.android_apps.make_a_map.indigo, PID: 1031 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.make_a_map.MainActivity.init(MainActivity.java:308) 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) 

The "MainActivity" part indicates the mapview.onCreate method.. I really don't get why I am getting this error

adamantivm commented 7 years ago

@HelloEgg this report is for map_nav, not make_a_map, would you mind opening a separate issue for this?

HelloEgg commented 7 years ago

Oh I WAS having problem with "map_nav" Do you have any known repository that works on Android studio 2.2.2? gradle version I use is 2.2.1

adamantivm commented 7 years ago

@HelloEgg the stack trace shown above is for make_a_map.

If you test the latest kinetic versions of android_core and android_extras, they are working on Android Studio 2.2.2.

I was able to go through most of the basic / core applications, but not android_apps unfortunately.

HelloEgg commented 7 years ago

Oh.. I must have uploaded wrong stack trace.. kinetic version of android_core works perfectly fine, however I want to use "map_nav" and other apps that are included in "android_apps"

adamantivm commented 7 years ago

@HelloEgg unfortunately no one seems to have had the time to update android_apps yet. If you could please send a PR with the changes you're doing and post the correct stack trace perhaps together we can find the issue and incorporate the workaround for you and everyone else.

HelloEgg commented 7 years ago

Could you tell me what you mean by "PR"? Changes I made on "MainActivity" was exactly the same code with what stonier fixed(https://github.com/rosjava/android_apps/commit/9e780b4bbb647360a3ebfb25b0edbb9b8e023391) And stack trace were: 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)

adamantivm commented 7 years ago

@HelloEgg I don't know if this is an option for you but these apps are available from the Google Play Store. If you install them from there they do work fine.

HelloEgg commented 7 years ago

Resolved! I commented on #55 Apparently neither addlayer or #42 seems to be current solution. Therefore, do depend on local android_10 or android_15 rather than whats in github

ernestmc commented 7 years ago

Indeed the solution is to use android_15 v0.3+. For example use the following line:

compile 'org.ros.android_core:android_15:[0.3,0.4)'

Will submit a PR fixing this.

JENkt4k commented 7 years ago

Any luck building this? I'm still having missing resources issues: Using Android 2.2.2 and gradle version 2.2.1 (also tried 2.14.1) git checkout -b kinetic https://github.com/rosjava/android_apps.git SDK 15 target example errors that appear: Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. When experiencing this type of issue, it's normally resolved with something like: compile 'com.android.support:appcompat-v7:<platform version>' I'm guessing that compile 'org.ros.android_core:android_15:[0.3,0.4) replaces this?

adamantivm commented 7 years ago

@JENkt4k yes, compile 'org.ros.android_core:android_15:[0.3,0.4) should solve the issue. Which particular project is failing to build? Could you please upload a gist with the full log?

jubeira commented 7 years ago

I'm getting the same error too... I think the Gradle scripts need some updating, I will issue a PR with the fixes soon

JENkt4k commented 7 years ago

@jubeira You are the man! It built and ran after update. I'm currently looking through your changes, and I see some similar to the ones I made locally, but I haven't found the piece(s) I was missing, or maybe never I tried the entire/exact combination, BeyondCompare to the rescue soon I suppose. Thanks again for your help.

@adamantivm Sorry I did't get back to you in time, been working on some other issues related to Kunman SM5-1 Android/ROS/Python integration. Hopefully I'll be able to share with you soon. Thanks for the support.

jubeira commented 7 years ago

@JENkt4k YW! That's what the community is for ;). Perhaps you didn't apply the kinetic script with the latest Gradle version in the top-level script. I think this is the best way to get your project working with the current tools. I can't tell if all the apps work as expected though. If you see something broken, please feel free to open an issue/ send a PR.