App Engine Backend with Google Cloud Messaging connection fails building release version with proguard

216 views Asked by At

I have an android app using GCM and an app backend in google app engine. Everything works fine in debug mode. In my IntentService "RegistrationIntentService" I get the token calling

InstanceID instanceID = InstanceID.getInstance(this);
          String token = instanceID.getToken(SENDER_ID,
                        GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
sendRegistrationToServer(token);//send to app engine

and I pass it to app engine backend with

private void sendRegistrationToServer(String token) {
    //
    if (regService == null) {
        Registration.Builder builder = new Registration.Builder(AndroidHttp.newCompatibleTransport(), new AndroidJsonFactory(), null)
                .setRootUrl("https://android-app-backend.appspot.com/_ah/api/");
               //where android-app-backend corresponds to my own Project ID

        regService = builder.build();
    }

    try {
        regService.register(token).execute();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

It works fine also if a generate a signed APK disabling proguard

(minifyEnabled false)

but if I generate the APK enabling proguard I can get the token(registration id),but I cannot store it in the cloud. The android application log tells me

D/libc﹕ Forward DNS query to netd(h=*****************.appspot.com s=^)
W/System.err   com.google.api.client.googleapis.json.GoogleJsonResponseException:
404 Not Found
W/System.err﹕ Not Found
W/System.err﹕ at  com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(Unknown Source)
W/System.err﹕ at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(Unknown Source)
W/System.err﹕ at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(Unknown Source)
W/System.err﹕ at com.google.api.client.http.HttpRequest.execute(Unknown Source)
W/System.err﹕ at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(Unknown Source)
W/System.err﹕ at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(Unknown Source)
W/System.err﹕ at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(Unknown Source)
W/System.err﹕ at com.example.android.RegistrationIntentService.a(Unknown Source)
W/System.err﹕ at com.example.android.RegistrationIntentService.onHandleIntent(Unknown Source)
W/System.err﹕ at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
W/System.err﹕ at android.os.HandlerThread.run(HandlerThread.java:60)

My proguard file is the default file 'proguard-android.txt'.

How can I fix that issue?

0

There are 0 answers