Gradle exclude doesn't work as expected.
Currently, I'm using Firebase Firestore in android application, Firestore uses "protobuf-lite" internally which conflict with another library that uses "protobuf-java" which produces duplicate class gradle error and build fail.
Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractParser found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractProtobufList found in modules protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.Any found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Any$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Any$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.AnyProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
Duplicate class com.google.protobuf.Api found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and protobuf-java-3.0.0.jar (com.google.protobuf:protobuf-java:3.0.0)
I added a rule to Firestore implementation to exclude these modules that conflict with other libraries
implementation('com.google.firebase:firebase-firestore:20.1.0', {
exclude group: 'com.google.firebase', module:'protolite-well-known-types'
exclude group: 'com.google.firebase', module:'protobuf-lite'
exclude group: 'com.google.protobuf', module:'protobuf-lite'
})
Now, the project built successfully and the app runs but the app crashes when I make any Firestore operation which means that they are excluded from Firestore library itself not only from the app module.
java.lang.RuntimeException: Internal error in Firestore (20.1.0).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$5(com.google.firebase:firebase-firestore##20.1.0:379)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run(com.google.firebase:firebase-firestore##20.1.0)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6274)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.VerifyError: Verifier rejected class com.google.firestore.v1.WriteResponse: void com.google.firestore.v1.WriteResponse.mergeCommitTime(com.google.protobuf.Timestamp) failed to verify: void com.google.firestore.v1.WriteResponse.mergeCommitTime(com.google.protobuf.Timestamp): [0x10] register v3 has type Precise Reference: com.google.protobuf.Timestamp but expected Reference: com.google.protobuf.GeneratedMessageLiteVerifier rejected class com.google.firestore.v1.WriteResponse: java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object) failed to verify: java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object): [0x73] register v5 has type Precise Reference: com.google.protobuf.Timestamp but expected Reference: com.google.protobuf.GeneratedMessageLite (declaration of 'com.google.firestore.v1.WriteResponse' appears in /data/app/com.demo.myapplication-2/base.apk)
at com.google.firestore.v1.WriteResponse.getDefaultInstance(com.google.firebase:firebase-firestore##20.1.0:1012)
at com.google.firestore.v1.FirestoreGrpc.getWriteMethod(com.google.firebase:firebase-firestore##20.1.0:379)
at com.google.firebase.firestore.remote.WriteStream.<init>(com.google.firebase:firebase-firestore##20.1.0:74)
at com.google.firebase.firestore.remote.Datastore.createWriteStream(com.google.firebase:firebase-firestore##20.1.0:104)
at com.google.firebase.firestore.remote.RemoteStore.<init>(com.google.firebase:firebase-firestore##20.1.0:186)
at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore##20.1.0:263)
at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2(com.google.firebase:firebase-firestore##20.1.0:117)
at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(com.google.firebase:firebase-firestore##20.1.0)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4(com.google.firebase:firebase-firestore##20.1.0:311)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(com.google.firebase:firebase-firestore##20.1.0)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3(com.google.firebase:firebase-firestore##20.1.0:287)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(com.google.firebase:firebase-firestore##20.1.0)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run(com.google.firebase:firebase-firestore##20.1.0:205)
at java.lang.Thread.run(Thread.java:761)
The question is:
Doesn't exclude means that don't import these modules from Firestore library to the app module but don't remove them from Firestore?
If not, then how can I make them only available for internal Firestore usage only and hidden from the app module to avoid any conflict and duplicate class errors.
======= Update ==========
I fixed the problem
As we can't change the Firestore internal code that depends on protolite version then the only way was changing the other module that depends on proto-java to use protolite to fix this duplicate error, and to do that
I had to use protobuf lite compiler to generate java classes from the proto files which will generate classes that depend on the protolite library instead of proto-jave and now I can use the proto-lite library for both Firestore and the other Module and duplicate classes error gone.
Related
I am trying to integrate In App Review and I get this compile error:
Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
Edit: I ran the command: ./gradlew app:dependencies >> deps.txt
and found out that the conflict is caused by Amplify core. It has a dependency on androidx.navigation:navigation-dynamic-features-fragment:2.3.4 for some reason and that's has com.google.android.play:core:1.9.1 inside.
How can I prevent Amplify causing this? How to solve this confilct?
Here is the dependency tree
I was able to solve this by changing the gradle file:
// gradle imports from Amplify docs below.
implementation('com.amplifyframework:aws-storage-s3:1.35.4') {
exclude group: 'com.google.android.play', module: 'core'
}
implementation('com.amplifyframework:aws-auth-cognito:1.35.4') {
exclude group: 'com.google.android.play', module: 'core'
}
// Amplify core dependency
implementation('com.amplifyframework:core:1.35.4') {
exclude group: 'com.google.android.play', module: 'core'
}
I am having an android project using firestore, firebase-auth and FCM . Now when I am adding google-cloud-texttospeech to my project I am getting 'Duplicate class' error
Here is my dependencies
//Firebase
implementation "com.google.firebase:firebase-core:17.0.0"
implementation "com.google.firebase:firebase-firestore:20.1.0"
/*implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.crashlytics"*/
implementation "com.google.firebase:firebase-messaging:19.0.1"
implementation "com.google.firebase:firebase-auth:18.0.0"
// Ad-mob
implementation "com.google.android.gms:play-services-ads:18.0.0"
implementation ("com.google.cloud:google-cloud-texttospeech:0.97.0-beta")
This is the error I am getting while building the project.
Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Advice$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Advice$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AnnotationsProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthProvider found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthProvider$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthProvider$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthProviderOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthRequirement found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthRequirement$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthRequirement$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthRequirementOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Authentication found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Authentication$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.Authentication$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthenticationOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Duplicate class com.google.api.AuthenticationRule found in modules classes.jar (com.google.firebase:protolite-well-known-types:17.0.0) and proto-google-common-protos-1.16.0.jar (com.google.api.grpc:proto-google-common-protos:1.16.0)
Now I understand the firebase and google-cloud-texttospeech is using same classes inside there dependencies.
So I tried to exclude those by
implementation ("com.google.cloud:google-cloud-texttospeech:0.97.0-beta"){
exclude group: 'com.google.api.grpc', module: 'proto-google-common-protos'
exclude group: 'com.google.protobuf', module: 'protobuf-lite'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
Then the app is building but crashes while speech synthesising
2019-07-03 20:04:15.861 24851-24851/package.dev E/AndroidRuntime: FATAL EXCEPTION: main
Process: package.dev, PID: 24851
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/protobuf/GeneratedMessageV3;
at com.google.cloud.texttospeech.v1.TextToSpeechClient.create(TextToSpeechClient.java:101)
at package_name.tts.TextSpeachAPI.<init>(TextSpeachAPI.kt:8)
at package_name.ui.home.sofar.WordDetailsVM.speak(WordDetailsVM.kt:318)
at package_name.ui.home.sofar.WordDetailsFragment$listeners$11.onClick(WordDetailsFragment.kt:264)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.protobuf.GeneratedMessageV3" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/package_name.dev-apgPZPeLvH3LUXKWw2gBbg==/base.apk"],nativeLibraryDirectories=[/data/app/package_name.dev-apgPZPeLvH3LUXKWw2gBbg==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.cloud.texttospeech.v1.TextToSpeechClient.create(TextToSpeechClient.java:101)
at package_name.tts.TextSpeachAPI.<init>(TextSpeachAPI.kt:8)
at package_name.ui.home.sofar.WordDetailsVM.speak(WordDetailsVM.kt:318)
at package_name.ui.home.sofar.WordDetailsFragment$listeners$11.onClick(WordDetailsFragment.kt:264)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I experienced such a problem when using "google cloud speech".
In the use of "firestore" and "google cloud speech", I showed duplicate classes in "protobuf-java", "protobuf-lite", "proto-google-common-protos" and "protolite-well-known-types" I solved the problem by unzipping the jar files and creating a new jar file with no duplicate classes. Please refer to the github project I posted below.
https://github.com/ivso0001/GoogleCloudSpeechAndFirebaseIntegration
This worked for me:
android{
...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/INDEX.LIST'
}
}
dependencies{
...
implementation ('com.google.cloud:google-cloud-speech:0.41.0-alpha'){
exclude module: 'protobuf-javalite'
exclude module: 'protobuf-java'
exclude module: 'proto-google-common-protos'
}
}
Ref:
https://github.com/GoogleCloudPlatform/android-docs-samples/blob/master/speech/SpeechRecognitionClient/app/build.gradle
https://stackoverflow.com/a/64226363/8459761
I'm getting duplicate class errors when I try to build android app that use firebase-firestore and google-cloud-language.
Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
...
Duplicate class com.google.type.TimeOfDayProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
My build.gradle looks like follow:
...
dependencies {
...
implementation 'com.google.firebase:firebase-ml-vision:20.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'io.grpc:grpc-okhttp:1.19.0'
implementation'com.google.cloud:google-cloud-language:1.76.0'
}
How can I solve the issuse ?
I am getting following error :
Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:26.1.0)
.......
andin my gradle file there is following dependencies
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
}
I do not know what is the problem I tried multiple solution including this but did not get rid of this. Please help
It seems like a conflict between androidX and support libs.
If you are not supporting yet androidX you need to replace
implementation 'com.google.android.material:material:1.0.0' by implementation 'com.android.support:design:28.0.0'.
If you still want to use the material version, make sure your gradle.properties file has androidX and Jetifier enabled.
android.useAndroidX=true
android.enableJetifier=true
Make sure you follow the necessary setup to use material. Check it out here.
Hello everyone I am developing simple food delivery android application so its required to integrate google maps and auto suggestion I follow to find current location
[google sample code](https://github.com/googlemaps/android-samples/blob/master/tutorials/CurrentPlaceDetailsOnMap/app/src/main/java/com/example/currentplacedetailsonmap/MapsActivityCurrentPlace.java)
and for Auto suggestions I followed
https://developers.google.com/places/android-sdk/autocomplete
when build it gradle shows duplicate class error
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.AutocompletePredictionResult found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.AutocompletePredictionResult$StructuredFormatting found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.AutocompletePredictionResult$Substring found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.FetchPlacePabloResponse found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.internal.bc found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.internal.bd found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.internal.be found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
And this my gradle
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.google.android.libraries.places:places:1.1.0'
i try to exclude duplicate classes by below way
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation ('com.google.android.libraries.places:places:1.1.0'){
exclude group:'com.google.android.libraries.places.api.internal.impl.net.pablo'
exclude group: 'com.google.android.libraries.places.internal'
}
But no thing can solve my problem.
Remove
implementation'com.google.android.libraries.places:places-compat:1.1.0'
and keep only implementation 'com.google.android.libraries.places:places:1.1.0'.
Using implementation 'com.google.android.libraries.places:places-compat:1.1.0'
is neccessary only if you are using deprecated library of
implementation 'com.google.android.gms:play-services-places:16.0.0'
Please take a look here and documentation.