Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 11    Views: 186

Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
11/20/16 09:37 PM (7 years ago)

Android App Maps Not Working on Lollipop

A client notified me that the maps on a Buzztouch app are not working on Lollipop devices for Android. I believe I found the solution on Stack Overflow, but I can't seem to implement it without errors. According to this Stack Overflow article, it seems that for Lollipop devices we need to use "getFragmentManager" and for all other device we need to use "getChildFragmentManager. Here is the article: http://stackoverflow.com/questions/26592889/mapfragment-or-mapview-getmap-returns-null-on-lollipop The relevant code is in BT_screen_map.java around line 226: mapView = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapView)).getMap(); All we need to do is detect the type device and slip in the right code. I can't seem to figure it out even though the answer is in Stack Overflow. Anyone have a fix? Thanks for your help!
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
11/21/16 05:07 AM (7 years ago)
I had a problem last time I released an android app with maps. My map had driving instructions, as soon as I removed that, the map worked. My test device is Android 5, but I didn't appreciate it was an Android 5 related issue at the time. It would be interesting to see if your problem is the same, as removing driving instructions may be viable as a temporary workaround.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
11/21/16 06:08 PM (7 years ago)
Mark (GNW) and I have been working with "US of Wine" on the same issue. I've had to drop out of the troubleshooting to focus on personal issues that are taking up a bit of my time. Once it's fixed for one, I'm certain it will be fixed for all, but I haven't had the time to continue looking into it. Hopefully I will soon, but again; I've had personal things I have to deal with first. Cheers! -- Smug
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
11/21/16 06:10 PM (7 years ago)
I am meeting with a Java developer on Wednesday night, so I'll hopefully have an answer then.
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/25/16 01:29 AM (7 years ago)
Have you solved this issue? How old is your buzz touch version? Cause Ive recently created 2 apps on Buzztouch using BT_screen_map.java on android lollipop 5.0.1 phone and maps work 100% correctly What is your targetSdkVersion? Some say It looks like this might be an issue with a targetSdkVersion of 21: I am using targetSdkVersion 14
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
11/25/16 09:52 AM (7 years ago)
I will try it out. We were using the following. minSdkVersion 14 targetSdkVersion 21 We worked on it a couple hours on Wednesday night, but no luck yet. The person I am working with is a professional Java developer, and I know a bit about Android, so the two of us together should be able to solve it. I'll try changing the targetSdkVersion.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
11/25/16 04:07 PM (7 years ago)
That seemed to work. Thank you, immacul8 apps! Are there any negative consequences for using an older Android target SDK?
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/26/16 03:21 PM (7 years ago)
You are very welcome I'm glad that fixed the issue. And no there shouldn't be any consequences for using older target SDK. If your app compiles then its all good. What compileSDKversion & buildToolsVersion are you using? Targeting older versions just makes the app use only the required API's for that version and doesn't worry about the new API's Although this did fix the issue I am going to take a look at fixing it with targetsdkversion set to 21
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/26/16 06:41 PM (7 years ago)
If you'd like to revert your project back to your previous build settings minSdkVersion 14 targetSdkVersion 21 and try adding the following code in BT_screen_map.java import the following import android.os.Build; import android.app.FragmentManager; change the following line mapView = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapView)).getMap(); to MapFragment mapView = getMapFragment(); then below return thisScreensView; }//onCreateView... add private MapFragment getMapFragment() { FragmentManager fm = null; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { fm = getFragmentManager(); } else { fm = getChildFragmentManager(); } return (MapFragment) fm.findFragmentById(R.id.map); } and that should solve the maps returning null in Lollipop versions. Good luck :)
 
USofWine
Aspiring developer
Profile
Posts: 89
Reg: Apr 21, 2012
Denver, CO
5,390
like
11/28/16 08:02 AM (7 years ago)
Oh thank you all for posting this! I'm still pretty new to coding and have been very thankful for expert help :) I'll try to troubleshoot this later today and post if I run into trouble....
 
USofWine
Aspiring developer
Profile
Posts: 89
Reg: Apr 21, 2012
Denver, CO
5,390
like
11/28/16 12:50 PM (7 years ago)
well i'm not getting a map error so that's progress! I'm still getting these 2 funny errors related to BT (R.drawable.bt_screen_settingslogin_dot_green)); These various dots (colors) are nowhere to be found.... I'm also seeing "Execution failed for task 'app:compailerelase java with javac" I update everything studio recommends when i launch...any ideas here?
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/30/18 08:18 PM (6 years ago)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.