I want to login community with mobile sdk (Android), but meet with problem.

What I tried: I installed the mobile sdk example (project name is "ContactExplorer", which is Hybrid local mode), and it works fine with my production login credential. Then I follow the Mobile SDK Development Guide (Salesforce Mobile SDK 3.2), CHAPTER 10 Using Communities With Mobile SDK Apps, and do the following:

1,create a community, set up API-enabled profile, create community user with the profile. In community "Login & Registration" settings, I just leave the default settings, because the developer guide example doesn't mention whether we need change this.

2,android project(ContactExplorer), in xml folder I added a file "servers.xml", and it looks like this:

<?xml version="1.0" encoding="utf-8"?>
    <server name="Community Login" 
        url="https://mycommunityname-developer-edition.eu0.force.com/customers" />

3, I run the android app in simulator, expecting it will go to the community login page. But I see the login page of production org(it even give errors,but forget this error, I want to see the community login page).

enter image description here

Even tap the top-right corner icon and select servers, the community server can't be found. enter image description here

I read the related chapters of SDK developer guide several times, and read some posts on internet. I don't know what I missed. Why it can't go to the community login page? Shall I must "add connection" manually as in the second screenshot? For users, this is troublesome to type long url letters on mobile device.

  • I have the same question #bump
    – DCBoy
    Sep 18, 2015 at 4:52
  • Your salesforce login uses a different OAuth Flow compared to the login for communities. Did you solve this problem?
    – abhi
    Feb 19, 2016 at 17:42
  • same issue. anyone know how to fix this?
    – MJRForce
    Dec 8, 2016 at 19:56

1 Answer 1


The file to modify is [project directory]/platforms/android/SalesforceSDK/res/xml/servers.xml

After modifying the XML, follow the following directions in a note on XML changes at Setting Custom Login Servers in Android Apps:

  1. Force stop the app if it’s already running in the emulator.
  2. Uninstall the app in the emulator.
  3. Do a full clean and rebuild.
  4. Run the app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.