Android Question Found multiple <meta-data> elements for key 'com.google.android.gms.version', expected at most one.

Turkan Ergin

Member
Licensed User
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="5" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
SetApplicationAttribute(android:largeHeap,"true")
CreateResourceFromFile(Macro, Core.NetworkClearText)
AddPermission(android.permission.INTERNET)
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResource(values-v20, theme.xml,
<resources>
    <style
        name="DarkTheme" parent="@android:style/Theme.Material">
    </style>
</resources>
)

SetApplicationAttribute(android:theme, "@style/DarkTheme")
CreateResource(values, colors.xml,
<resources>
    <color name="statusbar">#ff000000</color>
    <color name="textColorPrimary">#ffffffff</color>
    <color name="navigationBar">#ff000000</color>
</resources>
)

CreateResource(values-v20, theme.xml,
<resources>
    <style name="DarkTheme" parent="@android:style/Theme.Material">
         <item name="android:colorPrimary">@color/navigationBar</item>
         <item name="android:colorPrimaryDark">@color/statusbar</item>
         <item name="android:textColorPrimary">@color/textColorPrimary</item>
         <item name="android:navigationBarColor">@color/navigationBar</item>
    </style>
</resources>
)

AddPermission(android.permission.INTERNET)

CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)

AddActivityText(Main,
<intent-filter>
   <action android:name="android.intent.action.SEND" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="video/*" />
</intent-filter>)

CreateResource(xml, provider_paths,
   <files-path name="name" path="shared" />
)
'***** KAMERA KONTROLLERİ
AddManifestText(
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
)

B4X:
#Region  Project Attributes
    #ApplicationLabel: AKS
    #VersionCode: 21
    #VersionName: 1.1.7
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
    #BridgeLogger:True   
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: false
#End Region
#LibraryVersion: 2.20
'#AdditionalJar: mobile-ffmpeg-full-4.4.LTS.aar
#MultiDex: True
#BridgeLogger: True
#AdditionalJar: com.android.support:support-v4
#AdditionalJar: com.google.android.gms:play-services-location
#AdditionalJar: com.android.support:exifinterface
#AdditionalJar: com.google.android.gms:play-services-vision
#AdditionalJar: com.google.android.gms:play-services-base

I'm getting this error when I try to update my application. Can you help me with how to resolve it?
Found multiple <meta-data> elements for key 'com.google.android.gms.version', expected at most one.
 

Sandman

Expert
Licensed User
Longtime User
This line appears twice:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
Is there ever a reason for a line to appear twice in the manifest?

(Let's assume that multiline macros like CreateResource etc are optimized to be a single line before answering that question.)
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Probably not and I know what you are thinking.
Hey now, am I that obvious? :D But yeah, that's what I was thinking. It kind of feels like you know me. :)

I don't think that I will change its behavior to track duplicate calls. It is really a rare programming bug.
Yeah, I can understand that, makes sense. It's a bad payback on that development investment.

Just a small note that this (as far as I can tell) could be outsourced to a build action that would stop compilation if there was a double entry. Meaning it could be made by a forum member, if one were so inclined.
 
Upvote 0
Top