2016-04-25 49 views
0

私は学校のアンドロイドスタジオを使用してアンドロイドアプリに取り組んでいます。私はJerseyクライアントを使用してアプリを自分のウェブサービスに接続しようとしています。 Jerseyクライアントに必要なJARファイルを追加してプロジェクトをコンパイルしようとすると、次のエラーが表示されます。エラー:タスク ':app:dexDebug'の実行に失敗しました。

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

この問題の解決のために周りに検索するから、私がjarを追加することにより、メソッドの65Kの制限を超えていますので、それが発生している私には思えます。私は実装しようとしたmultidexサポートを使ってこれを修正できることも見てきましたが、gradleをコンパイルするとエラーは残ります。ここで

は私のbuild.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    defaultConfig { 
     applicationId "com.example.williamj.hertz" 
     minSdkVersion 15 
     targetSdkVersion 23 
     multiDexEnabled true 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions{ 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/LISCENSE.txt' 
     exclude 'META-INF/LISCENSE' 
     exclude 'META-INF/liscense.txt' 
    } 
    dexOptions{ 
     incremental true 
     preDexLibraries = false 
     javaMaxHeapSize "4g" 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile 'com.android.support:recyclerview-v7:23.1.1' 
    compile 'com.parse:parse-android:1.10.0' 
    compile 'com.parse.bolts:bolts-android:1.+' 
    compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2' 
    compile 'com.google.android.gms:play-services:8.4.0' 
    compile 'com.android.support:support-v4:23.1.1' 
    compile 'com.android.support:multidex:1.0.1' 

} 

されており、ここで私は私がちょうどmultidexを実装していないよと仮定してい

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

multidexのサポートを追加した私のAndroidManifestの一部であります正しくサポートしてください。このエラーを解決するための助けがあれば、大変感謝します。ありがとうございます。

答えて

0

は、アプリケーションのオーバーライドattachBaseContextを持っている:

@Override 

protected void attachBaseContext(Context base) { 
    super.attachBaseContext(base); 
    MultiDex.install(this); 
} 

リンク:http://developer.android.com/tools/building/multidex.html

第二Methodeの:

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

あなたがすることがあります。私はまた、あなたがすべてのGoogle Playのサービスを含めていることに気づいた アプリで使用する特定のGoogle PlayサービスAPIのみを指定してアプリをコンパイルするときにこの問題を緩和することができますそれらのすべてを教えてください。これを行う方法については、https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project

をご覧ください。
関連する問題