2016-06-27 3 views
0

アンドロイドスタジオプロジェクトでFireベース分析を追加すると、次のエラーが表示されます: "エラー:バイトコードをdexに変換中にエラーが発生しました: 原因:com.android.dex .DexException:複数のdexファイルでLcom/google/android/gms/measurement/AppMeasurementContentProviderが定義されています。アンドロイドスタジオでfireベースアナリティクスを追加中に複数のdexファイルエラーが発生しました

追加のAppmeasurementContentProviderがどこから来ているのか、腐食に対応している「除外」コマンドが誰かに教えてくれて本当に感謝しています。 MultidexのためのiPhoneアプリの設定ここで

は私のbuild.gradleある

apply plugin: 'com.android.application' 
apply plugin: 'com.google.gms.google-services' 
android { 
compileSdkVersion 21 
buildToolsVersion "22.0.1" 

lintOptions { 
    abortOnError false 
} 
packagingOptions { 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/maven/com.google.guava/guava/pom.properties' 
    exclude 'META-INF/maven/com.google.guava/guava/pom.xml' 
    exclude 'com.google.android.gms.measurement' 

} 
defaultConfig { 
    applicationId "com.elisiumlabs.sarthi" 
    minSdkVersion 10 
    targetSdkVersion 19 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 

    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
    } 
} 
compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_7 
    targetCompatibility JavaVersion.VERSION_1_7 
} 

} 

dependencies { 

compile project(':androidQuery') 
compile project(':pinnedSectionListActivity') 
compile project(':volley') 
compile project(':facebookSDK') 
compile 'com.google.code.gson:gson:2.2.4' 
compile 'joda-time:joda-time:2.3' 
compile 'com.android.support:gridlayout-v7:21.0.0' 
compile "com.google.android.gms:play-services-location:8.3.0" 
// compile "com.google.android.gms:play-services-gcm:8.3.0" 
compile 'com.android.support:appcompat-v7:21.0.3' 


compile('com.google.android.gms:play-services-gcm:8.3.0') { 
    exclude group: 'com.google.android.gms.measurement' 
} 
compile('com.google.firebase:firebase-core:9.0.2') 
     { 
      exclude group: 'com.google.android.gms.measurement' 
     } 
/*compile files('libs/appcompat_v7.jar')*/ 
compile files('libs/commons-io-1.4.jar') 
compile files('libs/commons-lang-2.4.jar') 
compile files('libs/httpclient-4.3.5.jar') 
/*compile files('libs/objectify-5.0.3.jar')*/ 
compile 'commons-codec:commons-codec:1.9' 
compile files('libs/splunk-mint-4.1.jar') 
testCompile 'junit:junit:4.12' 
// androidTestCompile 'com.android.support:support-annotations:21.0.0' 
androidTestCompile 'com.android.support.test:runner:0.4.1' 
androidTestCompile 'com.android.support.test:rules:0.4.1' 
// Optional -- Hamcrest library 
androidTestCompile 'org.hamcrest:hamcrest-library:1.3' 
// Optional -- UI testing with Espresso 
/* androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.1') { 
    // Necessary if your app targets Marshmallow (since Espresso 
    // hasn't moved to Marshmallow yet) 
    exclude group: 'com.android.support', module: 'support-annotations' 
}*/ 
androidTestCompile('com.android.support.test.espresso:espresso- contrib:2.2.2') { 
    // Necessary if your app targets Marshmallow (since Espresso 
    // hasn't moved to Marshmallow yet) 
    exclude group: 'com.android.support', module: 'support-annotations' 
    exclude group: 'javax.inject' 
    exclude group: 'com.android.support' 
} 
androidTestCompile('com.android.support.test.espresso:espresso-web:2.2.2'){ 
    // Necessary if your app targets Marshmallow (since Espresso 
    // hasn't moved to Marshmallow yet) 
    exclude group: 'com.android.support', module: 'support-annotations' 
} 
// Optional -- UI testing with UI Automator 
    androidTestCompile('com.android.support.test.uiautomator:uiautomator-v18:2.1.1'){ 
     // Necessary if your app targets Marshmallow (since the test runner 
     // hasn't moved to Marshmallow yet) 
     exclude group: 'com.android.support', module: 'support-annotations' 
    } 


} 
configurations.all { 
resolutionStrategy { 
    force 'com.android.support:support-annotations:23.0.1' 
} 
} 

答えて

0

のGradle 参照https://developer.android.com/studio/build/multidex.html#mdex-gradle

とサポートライブラリが含まれており、multidex出力を可能にするために、モジュールレベルのbuild.gradleファイルの設定を変更します、次のコードスニペットに示すように:

android { 
compileSdkVersion 21 
buildToolsVersion "21.1.0" 

defaultConfig { 
    ... 
    minSdkVersion 14 
    targetSdkVersion 21 
    ... 

    // Enabling multidex support. 
    multiDexEnabled true 
} 
... 
} 

dependencies { 
compile 'com.android.support:multidex:1.0.0' 
} 

をすることができます、Applicationクラスを拡張しますattachBaseContext()メソッドをオーバーライドし、MultiDex.install(this)を呼び出してmultidexを有効にします。詳細については、MultiDexApplicationリファレンスドキュメントを参照してください。

0

ここ

がリンク

Android Studio Gradle Error:Execution failed for task ':app:dexDebug' using Ion koush lib

が私の答えとして、Googleのサービスを取得してもまた示すように、あなたのGradleにコードを追加してくださいです....私の答えに試してみてくださいあなたのmainfiestファイルにいくつかのコードを追加してください

また、回答

に示されているように、マルチプレックスをcomideでtrueにしてください

まずコンパイルあなたののAndroidManifest.xml

compile 'com.android.support:multidex:1.0.1'

compile 'com.google.android.gms:play-services:+'

とビルドは、このラインにアンドロイドを追加します。

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" 
    android:name="android.support.multidex.MultiDexApplication" 
    > 

そして、あなたのbuild.gradleに名前を付けるも

を追加します
dexOptions { 
    //incremental = true; 
    preDexLibraries = false 
    javaMaxHeapSize "4g" 
} 
0

FCMは新しいGCMであるため、GCMとFCMを混在させることはできません。論理的には、インターワークに近い類似のAPIを共有する必要があります。

FCMまたはGCMを選択する必要があります。あなたのbuild.gradlesからgcmで作業するように見えます。 FCMコードを削除してください。これらの行を削除します。

compile('com.google.firebase:firebase-core:9.0.2') 
{ 
    exclude group: 'com.google.android.gms.measurement' 
} 

Add Firebase to your Android ProjectSetting Up Google Play Services でGCMとFCMでプレイサービスのセットアップをお読みください。

0

私がしようとすると、バージョンレベルが一致しない場合は、Androidのメーカーは、次の警告提供します:依存関係が互いに

compile('com.google.android.gms:play-services-gcm:11.8.0') 
    compile('com.google.firebase:firebase-core:11.8.0') 
で作業していない解決このように同じバージョンのレベルに設定する

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/)

関連する問題