+ Start a Discussion
jyothsna reddy 5jyothsna reddy 5 

Getting started with Hybrid Development challenge not completed

I'm pretty sure I have created a hybrid mobile app - but I still get this message 'Challenge Not yet complete... here's what's wrong: You haven't run and logged in from the 'TrailheadHybridTest' app.' I created a new Dev org and logged in to the app OK but Trailhead won't let me pass this challenge. 
Guiomar Fernández de BobadillaGuiomar Fernández de Bobadilla
Hi!

I had the same issue. Here is what I did to solve:

1. Create Application type: hybrid_local following the example in the trailhead
2. I use the js which is indicated in the step 3 of the project 'Build Hybrid Apps with the Mobile SDK' (https://developer.salesforce.com/trailhead/project/mobile-sdk-hybrid-apps/mobilesdk-hybrid-apps-02)
3. The callbacks URL in the Connected App in Salesforce are: trailheadapp://auth/success and http://localhost:8200/oauthcallback.html
4. I set 'bootconfig.json' with my remoteAccessConsumerKey and  oauthRedirectURI (trailheadapp://auth/success)
5. Launch the cordova project  in the app's 'www' directory with 'force-server' instruction to load your app in a browser window (make sure you haven't pop-up window blocked)
6. Allow Salesforce permission and it will show a list of contacts.

With this, you can pass the chanllenge, but it doesn't function correctly because it doesn't use the Visualforce Page you created for the challenge.

Regards.
 
Emil Puchalski PLEmil Puchalski PL
Same problem here. 

I think I know the reson - even though the app is named as mentioned in the Trailhead challenge, it is still visible in the system as "SampleMobile SDK Sample App".  You can check it in the user's login history (Application column).

I've checked all the configurations and even searched for mentioned phrase in all the project files but with no results :( 

Anyone knows how to force android to authenticate with the name of the app / package itself instead of that dummy name?
eva.ax625eva.ax625
Hi there...I'm having the same problem. I don't know what I'm doing wrong. I didn't even get to log into the app. Very frustrating and offputting. Did any of the above solutions work?

Thanks, Laura
Allan Schweighardt 13Allan Schweighardt 13
Having the same problem, App works fine in Android. Anyone able to complete this?
Allan Schweighardt 13Allan Schweighardt 13
So... I did a new install on another Mac and it worked fine. Follwed the same install steps so not sure what was different. 
Aitor AlonsoAitor Alonso
Same problem here. App works fine on Android device but the check callenge feature doesn't give credit.

As Emil states, on Salesforce i see "SampleMobile SDK Sample App".

Anyone managed to solve on same device facing the issue?

Kind regards,

Aitor.
Yan SaunierYan Saunier
It worked for me when I replaced in the file index.html (in www), the force.login code function with all the code mentionned in charpter 3.6 (force.init + force.login functions).

Regards,

Yan.
Michele Losch 4Michele Losch 4
Aitor-
Were you able to pass the challenge? I'm having the same issue.

Regards,

Michele
Fred DunawayFred Dunaway
After fighting this for several days, finally figured it out.  What triggered the solution was the post from Guiomar Fernández de Bobadilla above.  Thankyou Fernandez!

Key to making this work and isn't mentioned:  the cordova app must be built via the cordova command.  After creating all of required artifacts, enter the following in the same terminal that was used to create the Hybrid app.
cordova build <the target os>
npm install -g <target os>-sim
cordova emulate <target os>

For iOS, this would be:
cordova build ios
npm install -g ios-sim
cordova emulate ios

The reason for this is the app is signed during the build process using the salesforce creditinals provided.  Without signing, salesforce won't fully acknowalge the log in from the app.  The signing done by Xcode is for Apple's appstore, which is something different alotogether.
 
Brian KesslerBrian Kessler
After resolving many environmental problems, I also faced this problem, but found a proper solution for it.

In \res\values\strings.xml, you need to change the value of the first resource/string.

1. In Android Studio, use Ctrl + Shift + F to launch the "Find in Path" dialog.

2. Search for "<string name="app_name">"

3. Change the contents of the XML element to "TrailheadHybridTest"
(Tip: If you go to the "Preview" tab, you can do this directly in the "Find dialog"!)

The strings.xml should now read:
 
<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name">TrailheadHybridTest</string>
    <string name="launcher_name">@string/app_name</string>
    <string name="activity_name">@string/launcher_name</string>
    <string name="account_type">your.package.name.login</string>
    <string name="app_package">your.package.name</string>
</resources>













 
Brian KesslerBrian Kessler
Oh, one other thing that some of you may find useful if/for the above to solve your problem:

You will need to delete permission for your application to log in from your emulated device so that the application itself will ask you for permission again.  Otherwise (if for example, you just log out from the HybridPage) your login will be recorded as a browser login, not an application login.



 
Diana ManDiana Man
I was having the same problem and I finally managed to do it.
Somehow when building the project the builder ignores all the folders under android platform, so you will need to remove android platform and readd it by the following command lines
 
cordova platform remove android
cordova platform add android


If you see a message saying that the version of cordova-android doesn't support com.salesforce plugin, re-remove android and add the version required. After that remove com.salesforce plugin and readd it.

For example:

# Command line messages

Installing "com.salesforce" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 6.1.2, failed version requirement: 6.1.0
Skipping 'com.salesforce' for android


# Type the following:

cordova platform remove android
cordova platform add android@6.1.0
cordova plugin remove com.salesforce
cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin --force

 

After doing this, go to Android Studio, rebuild the app and log in again to your application (you might need to clean the application data at Settings (from phone or emulator) > Apps/ Manage Apps (or the closest option available) > yourappname > Clear Data (not cache) ).
If that solved the problem, apart from being able to complete the challenge, you will be able to see your log history with Trailhead Hybrid as the application name.
This will also remove the double log in screen, surely because we were doing a wrong request.
Jun_DE YaoJun_DE Yao
Hi, I did for iOS only. I managed to pass the verification by updating the bootconfig.json under the Staging folder, with Consumer Key and CallbackURI. 

User-added image
Kelly CreechKelly Creech
Is anyone able to get the Visualforce page to show up? I cant figure out want I am doing wrong!
Peter BölkePeter Bölke
Facing same issue.

Seems that "SampleMobile SDK Sample App" cannot be used with DEV-Env. Poor Tutorial....
Peter BölkePeter Bölke
one more thing,... got it working changing 

"startPage": "HybridPage",

to

"startPage": "apex/HybridPage",

 
Victor ArchellaVictor Archella

If you're having a hard time completing the challenge eventhough you HAVE technically completed it do this:

 

- Create the Connected App as is said in the hybrid challenge and the Visualforce Page (you can leave it empty):

  • Create a new Connected App in your Developer Edition named 'Trailhead Hybrid' with a resulting API Name of 'Trailhead_Hybrid'.
  • Select 'trailheadapp://auth/success' as the Callback URL and 'Access and manage your data (api)', 'Provide access to your data via the Web (web)' and 'Perform requests on your behalf at any time (refresh_token, offline_access)' as the scope for the Connected App.
  • Create a new Visualforce page named 'HybridPage' in your Developer Edition Org. We won't test for this, but you can display a list of Contact records on this page.

- Create a native iOS (or android) app with the name TrailheadHybridTest. And do the steps to set it up that are described in the Native app modules (if you use an android use the first challenge in the Native Android Module and if you're using iOS use the first challenge in the Native iOS Module).

- When you login it should say you logged in with an app that has the correct name and allow you to pass...

 

 

Shukla YogeshShukla Yogesh
Hi 

I am facing several issues in this module. Please someone can list out the exact steps and commands that can work? Really frustrated after working more than 20 hours on this bloody module.

1. The version mentioned in the trail isn't working properly and have bugs (as per stackexchange). It gives errors like package names should be x[.y.[. etc. Also same issue when it asks to create the page name.

2. I do not see the BOOTCONFIG file (no relevant file in any directory).

3. Even if I'm able to create the app git import doesn't finish and errros out showing there is is deference in versions.


User-added image

Thanks in advance,
Yogesh
Gemma Fiore 3Gemma Fiore 3
Hi all, 
did someone find the way to pass this challenge? I find the same issue both on Get Started with Native Android Development and Getting started with Hybrid Development. In both cases my login shows "SalesforceMobileSDK Sample App" instead of the correct app name, and the challenge test fails. I miss only those 2 modules to finish my trailhead path to Dreamforce :) 
Any suggestions? 
thank you 
Gemma
Shukla YogeshShukla Yogesh
Hi Gemma I recently passed this challenge and can understand pain. Will try to help on this. Can you tell me how exactly you are trying to build app. I used Android SDK and deployed apk in my mobile and logged in from the app.
Gemma Fiore 3Gemma Fiore 3
Hi Yogesh, I'm sure you can understand....
Since I'm not a developer, I followed carefully the instructions gave into the module:

- created the mobile app through command "forcedroid create" in my command line (not GIT command)
- created the connected app in my Dev Edition environment with all the recommended settings 
- updated the consumer key and callback URL in "my path\mobile_sdk\salesforcemobilesdk-android\native\NativeSampleApps\SmartSyncExplorer\res\bootconfig.xml" (and in the related file for hybrid)
- imported the app in Android Studio 
- ran the app on my mobile
I can successfully log into the app, but into the login history of my profile in salesforce I find the access from a "SalesforceMobileSDK Sample App" that probably causes the error. 
I also tried to find <string name="app_name"> with the wrong value, as suggested, but mine are already correct... 
thank you 
G.
 
Shukla YogeshShukla Yogesh
I need to dig into.. I didn't find this issue but mostly in setup (version bugs) and the oauth errors. I will check how this is controlled and get back to you. please in mean while can you share show your config file. I'm outside so will respond after 3-4 hours.
Gemma Fiore 3Gemma Fiore 3
Finally I did them! 
after days and nights spent on these modules I found the way to pass the ckeck.
In both cases (Android and Hybrid) the only thing I had to do was updating ALL the bootconfig files existing in the project, that wasn't so clear to me.
Thank you anyway for you support.
Gemma 
Christian Santos 6Christian Santos 6
Hello, 
@shukla Yogesh, are you still available to help? I'm facing a similar problem during this challange. I'm not seeing the file I have to edit and I think there is an issue with the Cordova plugins that I just can't figure out. I have followed every step in the lesson and I was able to pass the Windows native challenge, but not this one. I get an error on the forcedroid create saying it failed. I have tried multiple times and at one point I saw two bootconfig files in the folder created, which I edited both with the call back URL and the key, however, the App did not work properly. Any help you, or any other developer out there could provide is greatly appreciated. 
Thanks,
Chris.
Ghislain NGhislain N
Hi All,
This was crazy as well - I spend almost all day yesterday and all day today to actually get mine work. After no success with IOS XCODE asking me to set up a developer profile and enroll in a dev program, I decided to go the route of Android.
Steps:
1. Open the application in Android Studio - Bypassed :
Gradle sync failed: Failed to find Build Tools revision 26.0.0 Consult IDE log for more 
2. Opened the bootconfig.json file under www folder and noticed that first two parameters were not updated as per the tutorial
     * Updated remoteAccessConsumerKey vlaue to my Consumer Key value of my Connected App
     * Updated oauthRedirectURI value to suggested value in tutorial ("trailheadapp://auth/success")
3. Cleaned the project
4. Rebuilt
5. Voila! Was able to log into my Salesforce and validate the challenge to claim points
Radha PatnayakuniRadha Patnayakuni
I'm getting the same issue with the iOS project. error "You haven’t run and logged in from the ‘TrailheadHybridTest’ app" in the Get Started with Hybrid Development trailhead module. Can someone please help? 
Arun Jain 16Arun Jain 16
Hello,

Please follow the link :
https://medium.com/@richard_whitley/tips-for-passing-mobile-sdk-trailhead-challenges-eba51ab90296

As per this tutorial i found my bootconfig.json file on below path :
<app_path>\platforms\android\app\src\main\assets\www

Now it is taking "trailhead hybrid" connected app to get access.
 
Radha PatnayakuniRadha Patnayakuni
I was not using the Playground credentials but trying to use the ORg62 credentails. Once I got the correct user/password from playground org everything worked!
SalhinSalhin
Just run the following in the terminal after editing the "www/bootconfig.json" file.
 
cordova prepare

 
Albert JamesAlbert James
This is occuring because the Connected App ID that is built into your app is that of the default SDK ("SampleMobileSDK Sample App").

This occurs if you:
1.  create the hybrid local app
2.  change into the directory
3.  edit the two files as instructed
5.  open in Android Studio
6.  build
7.  test

In those steps, notice that cordova prepare is missing from #4.  This will result in building the app with the default SDK Connected App ID and hence the problem.

Simply add cordova prepare command, in the base directory, right after editing the two files in www.  This will propegate the Connected App ID into the right place in the android or iOS files and voila.

Note if you've gotten this error, you'll need to go to the SDK OAuth usage and revoke all - this will revoke all with that connected app ID and then when you launch the app again, it should re-authenticate with the correct Connected App ID and the Trailhead will pass.

I got this issue, read all the above comments, figured this is what happened, and was then able to get the 500 points.  Woohoo!