Search code examples
androidandroid-studioandroid-maps

Getting Manifest merger failed Error While Updating Places Api


Hey My Google Places Api Was Not Working And i see in The Log They Asked To Updated Places Api .. So I tried To Do So They Asked to Add Few Dependencies

implementation 'com.google.android.libraries.places:places:2.2.0'
implementation 'com.google.android.libraries.places:places-compat:2.2.0'

When I Add Both These Dependencies Then i Get This Errror

Merging Errors: Error: Attribute activity#com.google.android.libraries.places.widget.AutocompleteActivity@theme value=(@style/PlacesAutocompleteThemeOverlay) from AndroidManifest.xml:21:13-66 is also present at AndroidManifest.xml:18:13-61 value=(@style/PlacesAutocompleteOverlay). Suggestion: add 'tools:replace="android:theme"' to <activity> element at AndroidManifest.xml:16:9-23:20 to override. app main manifest (this file), line 20 Error: Attribute activity#com.google.android.libraries.places.widget.AutocompleteActivity@windowSoftInputMode value=(stateAlwaysVisible|adjustPan) from AndroidManifest.xml:22:13-71 is also present at AndroidManifest.xml:19:13-55 value=(adjustResize). Suggestion: add 'tools:replace="android:windowSoftInputMode"' to <activity> element at AndroidManifest.xml:16:9-23:20 to override. app main manifest (this file), line 21

But if i Add Only one Dependency Then its Work Okay Bu I Need Both These Dependencies in the code Please Help am trying to solve it for past 4 hours :(


Solution

  • According to Google's documentation version 2.0.0 of the Places SDK for Android now depends on AndroidX. In order to retain compatibility, you must migrate your projects to use AndroidX.

    You should remove one of those implementation

    com.google.android.libraries.places:places:2.2.0
    
    com.google.android.libraries.places:places-compat:2.2.0
    

    depending on what you want to do you have to choose the library you want to implement

    https://developers.google.com/places/android-sdk/client-migration