码迷,mamicode.com
首页 > 移动开发 > 详细

android google 统计导致的文件冲突

时间:2016-12-27 22:43:58      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:.exe   ati   bug   and   解决   问题   orm   studio   path   

android studio 加入google 统计

1、

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath ‘com.android.tools.build:gradle:2.2.3‘
        classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8‘

        classpath ‘com.google.gms:google-services:3.0.0‘



        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

2、

dependencies {


    // google 统计
    compile ‘com.google.android.gms:play-services-analytics:10.0.1‘



}
apply plugin: ‘com.google.gms.google-services‘

 

 

 

 

异常:

Error:Execution failed for task ‘:app:transformClassesWithDexForDebug‘.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzsl;

 

定位问题:

1、查看external libraries 中的jar包,发现多了一个    play-services-ads:8.4.0 , 并且其中的zzsl文件和 play-services-analytics:10.0.1中的zzsl文件冲突
2、新建一个项目,按上述方法引入google统计,发现并没有出现 play-services-ads:8.4.0
3、猜测可能是某个地方引入了ads导致冲突

 

解决方法:

compile ‘com.google.android.gms:play-services-analytics:10.0.1‘
    compile ‘com.google.android.gms:play-services-ads:10.0.1‘

同时引入analytics 和 ads ,实测可以避免冲突

 

android google 统计导致的文件冲突

标签:.exe   ati   bug   and   解决   问题   orm   studio   path   

原文地址:http://www.cnblogs.com/lipeil/p/6227513.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!