我想實現谷歌雲通訊和我的Android應用的推送通知雲通訊和Android
我關注的谷歌官方的教程中,我使用過Android Studio
https://developers.google.com/cloud-messaging/android/client
和我收到此錯誤
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2
,這裏是我的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/notice.txt'
}
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "com.myapp.example"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'rongi.rotate-layout:rotate-layout:1.0.1'
compile 'com.vdurmont:emoji-java:2.0.1'
compile 'commons-lang:commons-lang:2.5'
compile 'com.github.javadev:underscore:1.6'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.2.0'
compile 'com.beardedhen:androidbootstrap:1.1.1'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.reginald.swiperefresh:library:1.1.1'
compile 'com.makeramen:roundedimageview:2.2.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.github.d-max:spots-dialog:[email protected]'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
compile 'com.vstechlab.easyfonts:easyfonts:1.0.0'
}
也在這裏是我的項目的build.gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
我有類似的問題。我將項目build.gradle谷歌服務版本更改爲classpath'com.google.gms:google-services:1.3.0'並且它工作了 – subhash
它沒有工作,您可以發佈您的gradle.build文件 –