2015-11-19 51 views
2
Error:Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.process.ProcessException:   org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_51\bin\java.exe'' finished with non-zero exit value 2 


    apply plugin: 'com.android.application' 

    android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.example.zumoappname" 
     minSdkVersion 10 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     //multiDexEnabled true 
    } 
    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 


    repositories { 
     flatDir { 
      dirs 'aars' 
     } 
    } 
    } 

    dependencies { 
      compile fileTree(dir: 'libs', include: ['*.jar']) 
      compile 'com.microsoft.azure:azure-notifications-handler:[email protected]' 
      compile 'com.google.code.gson:gson:2.3' 
      compile 'com.google.guava:guava:18.0' 
      compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3' 
      compile 'com.google.android.gms:play-services:8.3.0' 
      compile 'com.android.support:appcompat-v7:23.1.1' 
    } 

如果我不使用'com',我可以編譯並運行。 google.android.gms:play-services:8.3.0',但這打破了我的應用程序的目的。試過multidexenabled。試圖乾淨和重建。任何意見,將不勝感激?':app:dexDebug'。 gradle失敗'C: Program Files Java jdk1.7.0_51 bin java.exe''以非零退出值結束2

+0

依賴性{ 編譯文件樹(DIR: '庫',包括:[ '的* .jar']) 編譯 'com.microsoft.azure:azure-notifications-handler:[email protected]' 編譯「COM .google.code.gson:gson:2.3' compile'c​​om.google.guava:guava:18.0' compile'c​​om.microsoft.azure:azure-mobile-services-android-sdk:2.0.3' compile 'com.google.android.gms:play-services:8.3.0' compile'c​​om.android.support:appcompat-v7:23.1.1' } –

+0

剛剛在原帖中添加了您的評論。 –

+0

使用./gradlew彙編--info獲取堆棧跟蹤 –

回答

4

問題是您的方法數量已超過65K。 這是你的問題的解決方案。

步驟:1使multidex支撐

defaultConfig { 
     ... 
     multiDexEnabled true 
    } 

步驟:2這2條線路

dependencies { 
     ... 
     compile 'com.google.android.gms:play-services-location:8.3.0' 
     compile 'com.android.support:multidex:1.0.0' 
    } 

步驟:在清單

<application 
     ... 
     android:name="android.support.multidex.MultiDexApplication"> 
     ... 
    </application> 

步驟3的(a)變化:3 (b)如果您有自己的自定義應用程序類,則像這樣初始化MultiDex。

public class YouApplication extends Application { 

    @Override 
    protected void attachBaseContext(Context base) { 
     super.attachBaseContext(base); 
     MultiDex.install(this); 
    } 
} 
+0

謝謝dhuma,這解決了我的問題 –

+0

@ dhuma1981你能解釋一下第三步嗎?我應該在哪裏插入android:name?什麼是自定義應用程序類? – Srichakradhar

+0

@Srichakradhar在你的AndroidManifest.xml中有標籤添加該名稱:「...」字符串那裏,如果你已經創建了你自己的繼承Application類的自定義類然後按照步驟3(b)所示。 – dhuma1981

0

能否請您檢查是否有播放服務8.3.0版本android-sdk/extras/google/m2repository/com/google/android/gms/play-services/8.3.0。如果沒有,下載它可能會解決這個問題。

相關問題