What are the required gradle dependencies for the Google Cloud Messaging App Engine firewall?
Currently, when you add such a module to your Android Studio project, it adds this dependency:
'compile' com.google.android.gms: play-services: 8.4.0 '
However, when you start the project, you get this error:
Error: execution completed for task ': Application: transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: process command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk / Contents / Home / bin / java '"completed with nonzero exit value 2
Someone suggested using this:
defaultConfig { multiDexEnabled true }
But that really didn't work for me.
So, it seems that I should specify only the necessary libraries for GAE + GCM. So far, I:
compile 'com.google.android.gms:play-services-auth:8.4.0' compile 'com.google.android.gms:play-services-gcm:8.4.0' compile 'com.google.android.gms:play-services-base:8.4.0'
full list here . But that did not work. I got this error:
E / GMPM: GoogleService failed to initialize, status: 10, Missing expected resource: "R.string.google_app_id" to initialize Google Services. Possible reasons are missing google-services.json or com.google.gms.google-services gradle.
Therefore, I find it difficult.
Is there any other way to solve this problem? It’s strange that my old GAE + GCM projects work perfectly with all Google Play services. However, importing old versions of Google Play services in my new project does not work. Therefore, I am not sure what is going on.
EDIT: Additional Information:
I did some tests.
1) Launched a new project for Android Studio, a new Google App Engine Java Endpoints Module cloud module was added. The build.grade generator (Module: app) looks like this:
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile project(path: ':backend', configuration: 'android-endpoints') }
Result? Compiles and works fine - no problem!
2) Started a new Android Studio project, added a new Google App Engine cloud module using Google Cloud Messaging. automatically generated build.grade (Module: app) is as follows:
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.google.android.gms:play-services:8.4.0' compile project(path: ':backend', configuration: 'android-endpoints') }
Result? I also crappy mistake that I get!
So it looks like the command line "compile" com.google.android.gms: play-services: 8.4.0 ''. I replaced it with
'compile' com.google.android.gms: play-services-gcm: 8.4.0 ''
since in theory that’s all I need for Google cloud messaging. When I run it, I get the following:
12-30 14: 14: 16.482 10573-10573 / com.myapp.myapp E / GMPM: GoogleService failed to initialize, status: 10, Missing expected resource: "R.string.google_app_id" to initialize Google Services. Possible reasons are missing google-services.json or com.google.gms.google-services gradle. 12-30 14: 14: 16,482 10573-10573 / com.myapp.myapp E / GMPM: Do not set the scheduler. Do not log error / warning. 12-30 14: 14: 16,502 10573-10623 / com.myapp.myapp E / GMPM: download not possible. Failed to install the application.
So it looks like I'm missing this google-services.json file or something like that. I don’t understand what happened with Android Studio, because a few months ago I made an application with GCM turned on in the same way and no one compiles any problems. The gradle.build file of this application is as follows:
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile project(path: ':gcm-backend', configuration: 'android-endpoints') compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.ganyo:gcm-server:1.0.2' compile 'com.google.android.gms:play-services:7.5.0' compile 'com.android.support:support-v4:22.2.0' }
So, it looks like Android Studio has stopped adding the “compile” com.ganyo: gcm-server: 1.0.2 '' dependency.
So, I started the project with
'compile 'com.ganyo:gcm-server:1.0.2' 'compile 'com.google.android.gms:play-services:8.4.0'
Result? Error with the same execution.
So, try the old game services library in my new project:
'compile 'com.ganyo:gcm-server:1.0.2' 'compile 'com.google.android.gms:play-services:7.5.0'
Result? Error with the same execution.
I just do not understand why this does not work out of the box, as before ...