项目里要用 chromcast,所以集成了一个CastCompanionLibrary-android ,里面的build.gradle 有 compile 'com.google.android.gms:play-services-cast:7.8.+'
然后 在我的主项目里 有个 compile 'com.google.android.gms:play-services-analytics:7.5.0'
主项目依赖 cast项目
compile project(':library')
compile project(':slidingmenu_library')
compile project(':CastCompanionLibrary')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
然后可以build,但是会报错 在运行到这行代码时
googleAnalytics = GoogleAnalytics.getInstance(this);
03-03 17:11:31.882 25423-25423/? E/TestApplication﹕ [color=red]_____java.lang.NoSuchMethodError: No static method zzu(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzu; or its super classes (declaration of 'com.google.android.gms.common.internal.zzu' appears in /data/app/com.test-2/base.apk) java.lang.NoSuchMethodError: No static method zzu(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzu; or its super classes (declaration of 'com.google.android.gms.common.internal.zzu' appears in /data/app/com.test-2/base.apk)
at com.google.android.gms.analytics.internal.zzf.zzV(Unknown Source)[/color]
然后 我要么把主项目里的改成 7.8.+ 要么把cast里面的改成7.5.0就好了。
这里估计android classloader在load的时候,cast 和 analytics 这两个库里面有相同的核心库,然后系统在load的时候 只load了其中的某一份,这样就导致了不一致的问题,所以解决的方法就是尽量统一google play service的版本
然后 在我的主项目里 有个 compile 'com.google.android.gms:play-services-analytics:7.5.0'
主项目依赖 cast项目
compile project(':library')
compile project(':slidingmenu_library')
compile project(':CastCompanionLibrary')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
然后可以build,但是会报错 在运行到这行代码时
googleAnalytics = GoogleAnalytics.getInstance(this);
03-03 17:11:31.882 25423-25423/? E/TestApplication﹕ [color=red]_____java.lang.NoSuchMethodError: No static method zzu(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzu; or its super classes (declaration of 'com.google.android.gms.common.internal.zzu' appears in /data/app/com.test-2/base.apk) java.lang.NoSuchMethodError: No static method zzu(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzu; or its super classes (declaration of 'com.google.android.gms.common.internal.zzu' appears in /data/app/com.test-2/base.apk)
at com.google.android.gms.analytics.internal.zzf.zzV(Unknown Source)[/color]
然后 我要么把主项目里的改成 7.8.+ 要么把cast里面的改成7.5.0就好了。
这里估计android classloader在load的时候,cast 和 analytics 这两个库里面有相同的核心库,然后系统在load的时候 只load了其中的某一份,这样就导致了不一致的问题,所以解决的方法就是尽量统一google play service的版本