Android Tutorial Google Maps

Status
Not open for further replies.

nidpea04

Member
Licensed User
Longtime User
My project Google map error with Run Release
-----------------------------------------
B4A version: 6.00 BETA #1
Parsing code. (0.00s)
Compiling code. (0.04s)
Compiling layouts code. (0.00s)
Generating R file. (0.33s)
Compiling generated Java code. (1.34s)
Convert byte code - optimized dex. (1.79s)
Packaging files. Error
 

nidpea04

Member
Licensed User
Longtime User
Thank Erel.
I'm remove v.6 beta. and install v5.8 ( windows 10 )
But there error.
'---------------------------------------------
B4A version: 5.80
Parsing code. (0.00s)
Compiling code. (0.08s)

ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code. (0.00s)
Generating R file. (0.25s)
Compiling generated Java code. (1.50s)
Convert byte code - optimized dex. (0.55s)
Packaging files. Error

Please advise me.
 

iCAB

Well-Known Member
Licensed User
Longtime User
After updating Google-play-services to Rev31, I commented out

B4X:
#AdditionalRes: C:\Android\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res,com.google.android.gms
and added the following

B4X:
#AdditionalJar: com.google.android.gms:play-services-maps

The code compiles no problem, but I am getting the following error now

B4X:
java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object anywheresoftware.b4a.objects.collections.Map.Get(java.lang.Object)' on a null object reference
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady


I have modified the manifest to include
B4X:
'************ Google Play Services Base ************
AddApplicationText(
   <activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
  android:theme="@android:style/Theme.Translucent.NoTitleBar"
  android:exported="false"/>
    <meta-data
  android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSy......"/>
)
'************ Google Play Services Base (end) ************

I also tried replacing maps.v2.API_KEY with geo-API as recommended in the first post but I still got the same error.

I have also tried following the instruction for downloading google-service.json. That also didn't make a difference.

One thing I have noticed, that after I updated google-play-services, I was unable to find a new version of google-play-services.jar installed on my PC. Is this file no longer needed

Thanks in advance
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
I never used the designer. The GUI built during run time
 

iCAB

Well-Known Member
Licensed User
Longtime User
You need to load the map with the designer.
That is going to be an issue for the following reasons:
1. The application is huge and doesn't use the designer at all
2. All layouts/dimensions are automatically calculated during run time and auto adjusted to fit any screen size / resolution
3. I put a lot of effort in this so when I start doing my B4I conversion, there will be no dependency on the designer/GUI

Is there any other way? .. This was all working fine, until I updated the SDK (hoping to use Firebase )

BTW, I am not sure, about the designer thing, since I am facing the same issue with the sample project I uploaded for the Chopped Icons
( I believe this one is using the designer to load the map )

https://www.b4x.com/android/forum/threads/google-map-marker-icon-chopped.66781/#post-423450
 

Daniel-White

Active Member
Licensed User
Longtime User

I come from B4A 5.8 and I was working all the google maps by code. in my particular case, I only added the fragment map to the layout and put it "invisible". that is it in my case.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
GoogleMaps v2 is implemented as a custom view and should be added with the designer.

2. All layouts/dimensions are automatically calculated during run time and auto adjusted to fit any screen size / resolution
It will be easier to do it with the designer.

3. I put a lot of effort in this so when I start doing my B4I conversion, there will be no dependency on the designer/GUI
It will be easier to port an application that uses the designer as the layout handling in iOS is different than Android.

Anyway you can create a layout with only the map and load it. It will not interfere with the other views.
 

KMatle

Expert
Licensed User
Longtime User
GoogleMaps v2 is implemented as a custom view and should be added with the designer.

Of course I ran into the same problem (adding it by code -> exception, designer -> ok). Could you please desribe where the exact difference is (adding by designer / by code) in that specific case?
 

luciano deri

Active Member
Licensed User
Longtime User
How can find multi point in map, having only addresses (street, number, city, country ...)
Thanks.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…