2017-12-11 23 views
0

この質問は何度か尋ねられましたが、私はすべての回答を試みましたが、私はまだ同じエラーがあります。タスク ':app:transformClassesWithDexForDebug'の例外が失敗しました

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
    { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile files('libs/itextpdf-5.3.2.jar') 
    compile 'com.androidadvance:topsnackbar:1.1.1' 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.android.support:cardview-v7:25.3.1' 
    compile 'com.android.support:recyclerview-v7:25.3.1' 
    compile 'com.android.support:support-v4:25.3.1' 
    compile 'com.android.support:palette-v7:25.3.1' 
    compile 'com.google.android.gms:play-services-ads:11.6.0' 
    compile 'com.google.android.gms:play-services-location:11.6.0' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'org.apache.commons:commons-io:1.3.2' 
    compile 'com.squareup.picasso:picasso:2.5.2'  
    compile 'com.anjlab.android.iab.v3:library:1.0.44' 
    compile project(':adcolony-sdk-3.1.2') 

    testCompile 'junit:junit:4.12' 
} 

それは私の依存関係とは何かを持っている他の質問によると:以下

はすべて私の依存関係です。 This質問はまったく同じ質問です。その質問の最初の答えは次のとおりです。

You are including all play services in your project. Only add those you want.

これは、上記のとおりです。


私も追加してみました:

defaultConfig { 
    multiDexEnabled true 
} 

dexOptions { 
    javaMaxHeapSize "4g" 
    preDexLibraries = false 
} 

上記は、新たなエラーが発生します。

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug' 

質問についてthisと私は

べき答えに従ってもあります

Build/Clean Project


私はすべての答えを試しましたが、私はまだこのエラーを出すことはできません。おそらく私は見落としているものがありますか?どんな援助も大いに歓迎されます。すべてのあなたが必要とする、More info.

あなたのminSdkVersionが21以上に設定されている場合

Android app (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536—including Android framework methods, library methods, and methods in your own code. In the context of computer science, the term Kilo, K, denotes 1024 (or 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the '64K reference limit'.

-


は、私はこの問題

私は64kの方法の限界に達したことをどのような問題を解決しましたここに示すように、モジュールレベルのbuild.gradleファイルでmultiDexEnabledをtrueに設定します。

android { 
    defaultConfig { 
     ... 
     minSdkVersion 21 
     targetSdkVersion 26 
     multiDexEnabled true 
    } 
    ... 
} 

あなたのminSdkVersionが20以下に設定されている場合、次のようにしかし、あなたはmultidexサポートライブラリを使用する必要があります。

android { 
    defaultConfig { 
     ... 
     minSdkVersion 15 
     targetSdkVersion 26 
     multiDexEnabled true 
    } 
    ... 
} 

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

主な問題は、私は私のlibsフォルダにjarファイルを追加しようとしていたということでしたそうすることによって、私は最大のメソッドの限界に達しました。 compile 'com.android.support:multidex:1.0.1'multiDexEnabled trueを追加した後、私の問題は解決します。

回答とコメントありがとうございます。

+0

をテストケースの使用のために '11.4.2'の代わりに、 '11.6.0'。 –

+0

@IntelliJAmiyaまだ同じ問題があります – ClassA

+0

'compile 'org.apache.commons:commons-io:2.4'' –

答えて

0

この行をgradleファイルの下に追加します。

apply plugin: 'com.google.gms.google-services' 

これは、問題を解決しない場合は、同じバージョンのすべてのサポートライブラリを使用しようとするのいずれかV4またはV7

・ホープ、このことができます:)

+0

詳しいことを教えてください。 – ClassA

+0

上記の行をgradleの末尾に追加する必要があるため、Firebaseのドキュメントhttps://firebase.google.com/docs/android/setup – AkashK

+0

から入手できます。つまり、 'google-services'私は広告と場所のみを使用しています。 Firebaseはあなたに 'apply plugin: 'com.google.gms.google-services''を含める必要があることを知っています – ClassA

関連する問題