Duplicate files copied to protobuf.meta APK on Googlemap for Business

I follow the instructions here to implement Googlemap for business (Option 2: Import the SDK as a library module):

https://developers.google.com/maps/premium/android-get-started When I try to start the application, it returns me this error:

* What went wrong: Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK protobuf.meta File1: /Users/name/.android/build-cache/f333e5a1ed5f958c1e7d100de7935a31efd81cd6/output/jars/classes.jar File2: /Users/name/Documents/name/project-name/googlemapssdkm4b_lib/build/intermediates/bundles/default/classes.jar 

Here is my gradle file:

 apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: 'test-environment.gradle' apply plugin: 'io.fabric' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' repositories { maven { url 'https://maven.fabric.io/public' } maven { url "https://jitpack.io" } mavenCentral() } allprojects { repositories { jcenter() mavenCentral() maven { url 'https://maven.fabric.io/public' } } } android { compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION defaultConfig { applicationId "com.myapp.android" minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION) targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true versionCode 1 versionName "1.0" multiDexEnabled true } dexOptions { incremental true jumboMode = true javaMaxHeapSize "4g" } lintOptions { abortOnError false // true by default checkAllWarnings false checkReleaseBuilds false ignoreWarnings true // false by default quiet true // false by default } configurations { compile.exclude group: 'org.intellij', module: 'annotations' compile.exclude group: 'org.jetbrains', module: 'annotations' } if (System.getenv("CIRCLECI") || System.getenv("CIRCLE") || System.getenv("CI")) { defaultConfig { versionCode Integer.parseInt(System.getenv("CIRCLE_BUILD_NUM")) } } signingConfigs { debug { storeFile file("../company_debug.keystore") storePassword "company" keyAlias "company" keyPassword "company" } integration { storeFile file("../company.keystore") storePassword "company" keyAlias "company" keyPassword "company" } staging { storeFile file("../company.keystore") storePassword "company" keyAlias "company" keyPassword "company" } release { storeFile rootProject.file('pizza.keystore') storePassword System.getenv("KEYSTORE_PASS") keyAlias System.getenv("ALIAS_NAME") keyPassword System.getenv("ALIAS_PASS") } } buildTypes { debug { ext.betaDistributionNotifications = false signingConfig signingConfigs.debug applicationIdSuffix ".dev" minifyEnabled false shrinkResources false jniDebuggable false debuggable true zipAlignEnabled true proguardFile 'proguard-release.cfg' testProguardFile 'proguard-release.cfg' manifestPlaceholders = [providerSuffix: ".dev"] } integration { ext.betaDistributionEmailsFilePath = "integration_distribution_emails.txt" ext.betaDistributionReleaseNotesFilePath = "release_notes.txt" signingConfig signingConfigs.integration applicationIdSuffix ".integration" shrinkResources true minifyEnabled true jniDebuggable false debuggable true zipAlignEnabled true proguardFile 'proguard-release.cfg' manifestPlaceholders = [providerSuffix: ".integration"] } staging { ext.betaDistributionEmailsFilePath = "staging_distribution_emails.txt" ext.betaDistributionReleaseNotesFilePath = "release_notes.txt" signingConfig signingConfigs.staging applicationIdSuffix ".staging" shrinkResources true minifyEnabled true jniDebuggable false debuggable false zipAlignEnabled true proguardFile 'proguard-release.cfg' manifestPlaceholders = [providerSuffix: ".staging"] } release { signingConfig signingConfigs.release shrinkResources true minifyEnabled true proguardFile 'proguard-release.cfg' } } } kapt { generateStubs = true } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':apphelper') compile project(':customview') compile 'com.android.support:appcompat-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION compile 'com.android.support:cardview-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION compile 'com.android.support:design:' + project.ANDROID_SUPPORT_LIBRARY_VERSION compile 'com.android.support:support-v13:' + project.ANDROID_SUPPORT_LIBRARY_VERSION compile group: 'com.google.code.gson', name: 'gson', version: '2.7' compile('com.crashlytics.sdk.android:crashlytics: 2.6.2@aar ') { transitive = true } compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" compile "android.arch.lifecycle:runtime:" + project.ANDROID_ARCH_VERSION compile "android.arch.lifecycle:extensions:" + project.ANDROID_ARCH_VERSION annotationProcessor "android.arch.lifecycle:compiler:" + project.ANDROID_ARCH_VERSION kapt "com.android.databinding:compiler:$android_plugin_version" // compile "com.google.android.gms:play-services-maps:" + project.GMS_VERSION compile "com.google.android.gms:play-services-location:" + project.GMS_VERSION compile( project(':googlemapssdkm4b_lib') ){ exclude group:'com.google.guava' } //Auto Scroll ViewPager compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') { exclude module: 'support-v4' } compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.dagger:dagger:2.5' compile 'hanks.xyz:smallbang-library:0.1.2' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.facebook.device.yearclass:yearclass:1.0.1' compile 'com.facebook.android:facebook-android-sdk:[4,5)' compile 'com.android.support:support-vector-drawable:26.0.0' compile 'com.makeramen:roundedimageview:2.3.0' compile 'com.github.andremion:counterfab:1.0.1' kapt 'com.google.dagger:dagger-compiler:2.5' provided 'javax.annotation:jsr250-api:1.0' compile 'io.card:android-sdk:5.5.1' } 

I tried to put

 packagingOptions { pickFirst 'protobuf.meta' } 

and the error above just disappeared, but when the application is launched, it will crash at runtime, saying that it cannot find com.google.android.m4b.maps.MapFragment

I use Android Architecture components in my project that may contain Guava, but I already exclude it from googlemapssdkm4b_lib and it still does not work.

Has anyone here used Googlemap for business and have encountered this problem before?

+7
android google-maps
source share

No one has answered this question yet.

See related questions:

1169
Is there a way to get the source code from an APK file?
703
How to install apk file in android emulator?
703
How to avoid reverse engineering an APK file?
687
Android error: Failed to install * .apk on device *: timeout
6
Which means "specified for property" resDir "does not exist."
2
Gradle build: Could not find signatureConfig () method for arguments
2
Kotlin cannot compile the library
one
Could not find class 'dalvik.system ....'
one
All fragrances should now belong to the named fragrance dimension Android Studio NDK
one
Android - Koltin files present in apk after compilation

All Articles