Android app crashes on addAccountExplicitly(account, password, null);
In my case it was happening that I had another app installed on the device with the same account name and type, but with different signing cert that the one I was trying to install.
So it was crashing the app.
Checking the android doc for the method addAccountExplicity, it says:
This method requires the caller to have a signature match with the authenticator that owns the specified account.
That was my problem
1) Reason for crash was because the following snippet was missing in AndroidManifest.xml.
<service android:name="com.example.accounts.GenericAccountService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator" />
</service>
2) It is absolutely possible, even though best practice example is still missing.
3) No idea. Yet...
You are using "com.example"
as unique identifier for your app,please check if it's same in "authenticator.xml"