Jut*_*orn 9 android google-maps
我按照此处的说明实施Googlemap for business(选项2:将SDK导入为库模块):
https://developers.google.com/maps/premium/android-get-started 当我尝试运行该应用时,它会返回此错误:
* 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
Run Code Online (Sandbox Code Playgroud)
这是我的gradle文件:
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'
}
Run Code Online (Sandbox Code Playgroud)
我试着把
packagingOptions {
pickFirst 'protobuf.meta'
}
Run Code Online (Sandbox Code Playgroud)
上面的错误刚刚消失,但当应用程序运行时,它会在运行时崩溃,说它无法找到com.google.android.m4b.maps.MapFragment
我在我的项目中使用Android架构组件,其中可能包含Guava,但我已将其从googlemapssdkm4b_lib中排除,但仍然无效.
有没有人在这里使用Googlemap做生意并且之前遇到过这个问题?
| 归档时间: |
|
| 查看次数: |
679 次 |
| 最近记录: |