Android 使用Google云消息连接的应用程序引擎后端无法使用proguard构建发布版本
我有一个使用GCM的android应用程序和谷歌应用程序引擎中的应用程序后端。在调试模式下一切正常。在我的IntentService“registrationtentservice”中,我得到了令牌调用Android 使用Google云消息连接的应用程序引擎后端无法使用proguard构建发布版本,android,google-app-engine,android-proguard,Android,Google App Engine,Android Proguard,我有一个使用GCM的android应用程序和谷歌应用程序引擎中的应用程序后端。在调试模式下一切正常。在我的IntentService“registrationtentservice”中,我得到了令牌调用 InstanceID instanceID = InstanceID.getInstance(this); String token = instanceID.getToken(SENDER_ID, GoogleCloudMes
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(SENDER_ID,
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
sendRegistrationToServer(token);//send to app engine
然后我将其传递到应用程序引擎后端
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();
}
}
如果生成签名的APK禁用proguard,它也可以正常工作
(minifyEnabled false)
但是如果我生成APK启用proguard,我可以获得令牌(注册id),但我不能将其存储在云中。
android应用程序日志告诉我
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)
我的proguard文件是默认文件“proguard android.txt”
如何解决该问题?可能重复检查编辑历史,提问者将重复问题链接为修复,我将其删除并标记。可能重复检查编辑历史,提问者将重复问题链接为修复,我将其删除并标记。可能重复检查编辑历史,提问者将重复的问题链接为修复,我将其删除并标记。