Here is the fifth part of my journey (also known as "How-to create a simple mobile app for newbies"):
Part I: Make sure your phone can access SAP Gateway
Part II: Create your first service with SAP Gateway
Part III: Develop your mobile app on Eclipse
Part IV: Test your mobile app on your phone
Part V: Troubleshooting... and finally make it work!
http://developer.android.com/sdk/installing/installing-adt.html
http://ant.apache.org/bindownload.cgi
http://simonmacdonald.blogspot.ca/2012/11/getting-create-command-to-work-on.html
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
In my last blog post I showed how to adapt the HTML code of the index.html file of your application so it will load correctly in preview mode within Eclipse... but unfortunately that was not enough for being able to have the same result on my phone. I had to copy the "resources" folder from the SAPUI5 toolkit into the "WebContent" repository of my application. So here is what I've done:
The problem is: this "resources" folder is quite heavy (80Mo). So my virtual machine didn't support it and Eclipse kept crashing all the time. So I managed (via debugging) to extract only the files that I really needed -- and those files only -- before droping this folder into Eclipse. If you're having the same problem, you can give it a try (I'll explain how to debug later on) but be cautious: if you're deleting one of the files that are actually used, then you'll probably get a blank page when starting your application from your phone without any details on why it happened, nor how to fix it... so if you're following this blog series, I can send you my light "resources" folder (1,83Mo) instead.
Also, there seems to be a bug in the SAP Netweaver Gateway Plug-in for Eclipse that we installed in Part III - Step 2. On my computer the wizard that I used to build this application created a controller for the list view with an incorrect value line 76:
There is a missing slash character. So do remember that this line has to be converted into something like this (you'll find the relevant file in "WebContent >> <appname> >> resources >> <listview>.controller.js") before you can actually see any value in the table:
One last thing: when running on your phone, this application won't display any popup to enter a user/password to connect to your SAP backend system. So you'll need to provide the credentials in the very same file to avoid connection issues (see <listview>.controller.js, line 12):
Before trying to install our brand new application on our phone, let's test it with "real" data coming from the backend first. As you may have noticed, until now the table displayed within the HTML5 application is always empty although valid data exists in the backend. This is due to some security restrictions within the web browsers... but there is a small trick that we can use to by-pass this limitation:
Now start the preview mode... And enjoy!
If you're lucky, you can now run through step 2 & 3 of Part IV, and off you go with a nice mobile application working on your phone and connected to your home-made SAP Netweaver Gateway system (don't forget to set the URL back to its initial value -- i.e. without the "proxy" prefix -- in the file named "connectivity.js", and mind your firewall settings on your machine).
But that's not me... I couldn't make it work. Every ".apk" (it's the type of file we use for Android) created with PhoneGap Build wouldn't work on my phone: either I got a blank page or the application couldn't be installed at all. And even if this service is free and very convenient, I was experiencing a big drawback: you have no possibility to understand what's wrong when something goes wrong. So I had to go for the "hardcore" method described below.
This section is intended to put some light on how to install/debug your application the old fashion way. Basically, we need to install "native-application" tools in our Eclipse environment to be able to debug. As far as I'm concerned I've got both a laptop running Windows 7 64bits, and an Android phone: so the following steps will reflect what needs to be installed for my own situation. I believe this shouldn't differ too much if you're running Mac OS and an Iphone: adapt it according to your needs. And it'salso worth mentioning that I didn't follow the installation instructions from Android website on purpose because their method was less straightforward than this one:
That's it. You might face some issues with Eclipse (mine freezed a few times). But if you successfully reached this point you are now ready to test/install/debug the android application either on a simulator, or on a real phone (need to activate debugging). Important remark: if you're working inside a virtual machine (like I did), the latter might not work because of a known issue in VirtualBox... so either use a non-virtualized installation, or see what happens on the simulator only:
I spent definitely more than 5 minutes to finally create a mobile application that I can use on my phone :wink:
But within five days I could both make it work and take some time to note down my progress throughout this blog series... so I don't think that's much considering I had never seen Eclipse before. And it was worth the effort! All in all my biggest mistake was to try "the lazy way" with PhoneGap Build Service... I wasted a lot of time trying to make it work, while the problem doesn't seem to come from my application, but from the service itself (the application runs fine when I install it from Eclipse the "hardcore" way).
Enough writing: now I'm ready to play.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 |