My app started to fail sending invitations. The invitation screen popups and when the sender press send to send emails to the selected contacts it receive the error
Message Failed to send
I try everything i could remember, checking connection, use other google account, and even build a small app that only sends invitations. The only thing i can find that gives a clue about the error is the following log entry's:
05-05 19:56:41.191 1409-1409/? D/SurfaceFlinger: duplicate layer name: changing com.google.android.gms/com.google.android.gms.appinvite.AppInviteActivity to com.google.android.gms/com.google.android.gms.appinvite.AppInviteActivity#3
...
05-05 19:56:41.411 3254-4228/? E/Volley: [216] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/plusdatamixer/v1/mutateonekey?alt=proto&key=AIzaSyAP-gfH3qvi6vgHZbSYwQ_XHqV_mXHhzIk
There are about 10 log entry's generated after pressing send, but only these 2 seems relevant.
Here is the full code from my test app, copy from documentation, in case i fail somewhere:
public class MainActivity extends AppCompatActivity {
private static final int REQUEST_INVITE = 1002;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
private void onInviteClicked() {
Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.setMessage(getString(R.string.invitation_message))
.setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
// .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))
.setCallToActionText(getString(R.string.invitation_cta))
.build();
startActivityForResult(intent, REQUEST_INVITE);
}
public void click(View view) {
onInviteClicked();
}
}
The dependencies are the ones added automatically by android builder. Here a snapshot of the gradle file:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-invites:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I am stuck in this for a few hours and still clueless. Any pointer?
Update: The app and the test project can send invites successfully on my physical android, that runs API 21. Running the app in a android simulator with API 21 still fails, so it points that the service is constrained to physical devices, but during the week i tested successfully on virtual devices. Also, there is nothing supporting that the service is restricted, so i must be doing something wrong.
Update 6-May-2018:
Just updated to the invites package to com.google.firebase:firebase-invites:15.0.1
and still got the same error, but preceded by:
W/GLSUser: [AppCertManager] IOException while requesting key:
java.io.IOException: Invalid device key response.
at gga.a(:com.google.android.gms@12529024@12.5.29 (040700-192802242):12)
at gga.a(:com.google.android.gms@12529024@12.5.29 (040700-192802242):64)
at gga.a(:com.google.android.gms@12529024@12.5.29 (040700-192802242):21)
at gfy.a(:com.google.android.gms@12529024@12.5.29 (040700-192802242):4)
at gfy.onTransact(:com.google.android.gms@12529024@12.5.29 (040700-192802242):4)
at android.os.Binder.transact(Binder.java:627)
at cwl.onTransact(:com.google.android.gms@12529024@12.5.29 (040700-192802242):3)
at android.os.Binder.execTransact(Binder.java:697)
W/GLSUser: [DeviceKeyStore] Cannot load key: Device key file not found.
E/Volley: [220] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/plusdatamixer/v1/mutateonekey?alt=proto&key=AIzaSyAP-gfH3qvi6vgHZbSYwQ_XHqV_mXHhzIk