2015-11-04 43 views
0

我試圖在我的應用中爲GCM添加​​Google Play服務,但無法實現它。無法在Android Studio(版本1.3.1)中添加GooglePlayServices(GCM)

  • 出錯: 任務':app:dexDebug'的執行失敗。

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:進程 '命令' C:\ Program Files文件\的Java \ jdk1.7.0_79 \ BIN \ java中.EXE'非零退出值2

完如果我刪除編譯「com.google.android.gms:發揮服務-GCM:8.1.0」再有就是建築沒問題。我哪裏錯了?

的build.gradle文件:

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.1" 

defaultConfig { 
    applicationId "xxx.yyy.zzz" 
    minSdkVersion 14 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
packagingOptions { 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/LICENSE' 
} 

dexOptions { 
    jumboMode true 
    incremental true 
    preDexLibraries false 
    javaMaxHeapSize "4g" 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 

compile 'com.google.code.gson:gson:2.3' 
compile 'com.github.bumptech.glide:glide:3.5.2' 
compile 'com.google.android:multidex:0.1' 
compile 'com.edmodo:cropper:1.0.1' 
compile 'com.google.android.gms:play-services-analytics:7.3.0' 
compile 'com.loopj.android:android-async-http:1.4.5' 
compile 'com.google.android.gms:play-services-gcm:8.1.0' 
compile 'com.android.support:appcompat-v7:23.1.0' 
compile 'com.jakewharton:butterknife:6.1.0' 
compile 'com.afollestad:material-dialogs:0.7.4.2' 
} 
+0

PLZ分享您的build.gradle文件內容 – Fahim

+0

的方式GCM應如何整合最近已更改。 https://developers.google.com/cloud-messaging/android/client – Christopher

+0

您的build.gradle中沒有添加「apply plugin:'com.google.gms.google-services'」。 – Christopher

回答

1

你可能已經過時支持庫SDK mananger

試試這個:

右鍵點擊應用打開模塊設置依賴標籤

點擊'+'圖標並在那裏添加com.google.android.gms:play-services並單擊搜索圖標,並添加該依賴項,正確版本應根據您的存儲庫彈出。

編輯:

enter image description here

+0

8.1.0是最新的 – Santhosh

+0

然後從那裏添加它應該自動從互聯網上解析,你準備好了。 –

+0

更新我的答案截圖 –

0

添加依賴關係之後,嘗試刪除build/app/build/文件夾,然後重新生成項目。

如果它不能解決您的問題,則需要提供完整的gradle日誌。

+0

我已經刪除了這兩個文件夾,但它仍然給出相同的錯誤 – Santhosh

相關問題