Android Question "google_play_services_version not found"

juacochero

Member
Licensed User
Longtime User
Hi everyone!

I'm following the tutorial by Erel, and can't seem to get it working.
- I registered a project in Google developer console and got an API key
- Copied the libraries in the tutorial to the additional folder
- Added the reference to google maps library
- added to the manifest

And I'm getting this error when I try to compile it:
AndroidManifest.xml:29: error: resource integer/google_play_services_version (aka b4a.example:integer/google_play_services_version) Not found

Any help is much appreciated!!
Thank you ?

My code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Private rp As RuntimePermissions
End Sub

Sub Globals
    Private gmap As GoogleMap
    Private MapFragment1 As MapFragment
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("layout")
    Wait For MapFragment1_Ready
    gmap = MapFragment1.GetMap
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        gmap.MyLocationEnabled = True
    Else
        Log("No permission!")
    End If
End Sub

My manifest (just changed my API key here a bit)

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)

AddApplicationText(
<meta-data
  android:name="com.google.android.geo.API_KEY"
  android:value="AIzaSyBfRS9SZ_6Q797PdyOqywGtpYlWXXXXXXXXX"/>
)

AddApplicationText(
<uses-library
      android:name="org.apache.http.legacy"
      android:required="false" />
)

Libraries selected:

1645103475223.png
 

juacochero

Member
Licensed User
Longtime User
First step is to upgrade to latest version of B4A.

My guess is that your SDK is misconfigured.

Follow these instructions: https://www.b4x.com/b4a.html
Thanks Erel.
I updated B4a to the latest version, downloaded a fresh copy of the SDK and resources from the main page, and ran it again, still the same error.
Even tried on a separate PC, starting from the beginning as well, its a no go.

Will I get this same error if I've got the API key process wrong? it's the only thing that's different from the tutorial, but it does sound pretty straightforward, I'm pretty sure I got that right.
Or perhaps I'm not installing something in the SDK manager? I just left the vanilla installation instructed in the main site.
Thank you for your time!
 
Upvote 0

juacochero

Member
Licensed User
Longtime User
Ok, I got it working.
It seems that the internal Google Maps library is 2.0, and the one to download is 2.5. But when I copied it to the B4A Additional libraries folder, it would still use the internal 2.0 for some reason. So I replaced the internal for the one in the tutorial, and now it's working.
Thank you @Erel For your help and time!
 
Upvote 0

juacochero

Member
Licensed User
Longtime User
There shouldn't be a Google Maps jar and xml in the internal libraries folder, they are not part of the B4A installation - perhaps you mistakenly copied them there at some time.
Yes perhaps that was the case! Thank you for your time, problem solved!
 
Upvote 0
Top