Topic
  • 17 replies
  • Latest Post - ‏2012-12-31T15:29:32Z by SystemAdmin
Michael Dundek
Michael Dundek
3 Posts

Pinned topic Android 4.1 problems

‏2012-07-07T08:13:07Z |
Hello everyone,

I am having trouble with the worklight 5.0 developer edition and the android 4.1 emulator. I have been working for two days now on a project that uses dojox.mobile, without trouble as long as I tested my application within the console, but as soon as I try to deploy and run the application on the Android emulator, everything goes south!

I have 2 issues here, the first one is that the deployed application cannot connect to the worklight server, as soon as the application starts, a error message shows saying that the server is not accessible, I tried changing the server IP in the application descriptor to localhost, still the same, the worklight console is available as well with the host ip address and localhost, so the problem is not that the server is unreachable or down, but that the worklight application in the emulator can not access it for some strange reason (the console is available from the emulator web browser!).

Strangely, at some point it did work for a while, and when it did, I had a second problem that in my opinion is a bigger problem than the 1st one.The application once deployed and started on the android emulator could not find the WL libraries, all the dojo stuff worked, but as soon as the application made some WL calls, it didn't work anymore, the js logs mentioned "can not invoke blablabla from undefined", undefined being WL library objects that I made calls from such as busyIndicator.show(); for example. My first thought was that maybe I did not initiate the bussyIndicator object, but I did in the wlCommonInit function. So I tried to log some messages inside the init function and realized that the WL framework did not even call the init function all together. I am talking about a very basic simple HelloWorklight application, unchanged code what so ever, so the html body onload event calls the WL init function, the JS files are referenced in the html....

The installation of the whole environment went well, I followed the steps from the developerWorks installation site, and then from the Installation reference guide in the additional documentation section. My environment is composed of the following:

JRE 1.6 - 64bit
Eclipse EE 3.7.2 Juno
Worklight plugin 5.0.1.293
Android SDK 4.1 + plugin

Any ideas?

Thanks
  • Gosh
    Gosh
    8 Posts

    Re: Android 4.1 problems

    ‏2012-07-07T18:18:07Z  
    I also had a similar problem. The Android emulator requires an Oracle JDK. So if you're using an IBM JDK, it will give you errors. Next, you have to edit your eclipse.ini so it's pointing to the Oracle JDK javaw.exe. Add the line (use your directory):
    -vm "C:\Java\jre6\bin\javaw.exe"

    Finally, if you're dealing with Worklight Consumer or Enterprise Edition, and if you pointed to an Oracle JDK during the install process, than make sure to launch Worklight.cmd instead of eclipse.exe. Or, laucnh start > programs > IBM Software Delivery Platform > IBM Worklight Studio
  • Michael Dundek
    Michael Dundek
    3 Posts

    Re: Android 4.1 problems

    ‏2012-07-09T06:57:02Z  
    I tried everything the last three days, I installed the environment from scratch on a Windows Server 2008 64 bit, two different Windows 7 64bit and a Windows XP 32 bit, all this on two different machines, some in a VM, some directly on the machine OS. I used Eclipse Indigo 32 and 64 bit with Oracle JDK 1.6 and 1.7 also 32 and 64 bit, Installed Android SDK and Plugin, updated the Android SDK updates to get the 4.1 image (it's the only one compatible since requires API16), then installed the Worklight plugin. Every time with the same results, the application cannot access the server service once deployed on the emulator, the application contains nothing, I only created it, then created the Android environment and deployed it onto the server. There is no dojo, jQuery or any other framework dependencies in there. When the android application pops up with that error message, I looked at the details of the message and tried entering that URL into my browser (I also tried setting the server URL to "localhost", "127.0.0.1" and the actual IP of the host), that generated a 500 error "java.util.NoSuchElementException" on the class "GadgerAPIRequestCoder": StringTokenizer.nextToken, it might or might not be normal, that I don't know, but if not, that would mean that something is wrong with the generated Android application, right? If that is normal, maybe because I try to access that URL from a browser instead of from an Android client application, then my next guess would be that the reason must come from the emulator itself, restriction of certain applications to access the network maybe? Or could the use of Websphere LP have anything to do with it? I am out of ideas here, and I have a very hard time believing that I am the only one facing that issue, especially since I tried it on so many configuration and two different machines.
    Any tips would be greatly appreciated!

    Michael
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-10T12:26:34Z  
    I tried everything the last three days, I installed the environment from scratch on a Windows Server 2008 64 bit, two different Windows 7 64bit and a Windows XP 32 bit, all this on two different machines, some in a VM, some directly on the machine OS. I used Eclipse Indigo 32 and 64 bit with Oracle JDK 1.6 and 1.7 also 32 and 64 bit, Installed Android SDK and Plugin, updated the Android SDK updates to get the 4.1 image (it's the only one compatible since requires API16), then installed the Worklight plugin. Every time with the same results, the application cannot access the server service once deployed on the emulator, the application contains nothing, I only created it, then created the Android environment and deployed it onto the server. There is no dojo, jQuery or any other framework dependencies in there. When the android application pops up with that error message, I looked at the details of the message and tried entering that URL into my browser (I also tried setting the server URL to "localhost", "127.0.0.1" and the actual IP of the host), that generated a 500 error "java.util.NoSuchElementException" on the class "GadgerAPIRequestCoder": StringTokenizer.nextToken, it might or might not be normal, that I don't know, but if not, that would mean that something is wrong with the generated Android application, right? If that is normal, maybe because I try to access that URL from a browser instead of from an Android client application, then my next guess would be that the reason must come from the emulator itself, restriction of certain applications to access the network maybe? Or could the use of Websphere LP have anything to do with it? I am out of ideas here, and I have a very hard time believing that I am the only one facing that issue, especially since I tried it on so many configuration and two different machines.
    Any tips would be greatly appreciated!

    Michael
    I haven't tried this on Windows, but wonder if you are hitting a firewall issue. You might try setting he worklightServerRootURL to be http://10.0.2.2:8080 This is an IP that the emulator uses for the host. This should work from the emulator with http://${local.IPAddress}:8080, but try the 10.0.2.2 address just in case there is something particular about your network environment.

    Can you connect to the Worklight console in a browser in the emulator?
    Can you run the app as a mobile Web App in a browser in the emulator?
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-19T19:14:35Z  
    I tried everything the last three days, I installed the environment from scratch on a Windows Server 2008 64 bit, two different Windows 7 64bit and a Windows XP 32 bit, all this on two different machines, some in a VM, some directly on the machine OS. I used Eclipse Indigo 32 and 64 bit with Oracle JDK 1.6 and 1.7 also 32 and 64 bit, Installed Android SDK and Plugin, updated the Android SDK updates to get the 4.1 image (it's the only one compatible since requires API16), then installed the Worklight plugin. Every time with the same results, the application cannot access the server service once deployed on the emulator, the application contains nothing, I only created it, then created the Android environment and deployed it onto the server. There is no dojo, jQuery or any other framework dependencies in there. When the android application pops up with that error message, I looked at the details of the message and tried entering that URL into my browser (I also tried setting the server URL to "localhost", "127.0.0.1" and the actual IP of the host), that generated a 500 error "java.util.NoSuchElementException" on the class "GadgerAPIRequestCoder": StringTokenizer.nextToken, it might or might not be normal, that I don't know, but if not, that would mean that something is wrong with the generated Android application, right? If that is normal, maybe because I try to access that URL from a browser instead of from an Android client application, then my next guess would be that the reason must come from the emulator itself, restriction of certain applications to access the network maybe? Or could the use of Websphere LP have anything to do with it? I am out of ideas here, and I have a very hard time believing that I am the only one facing that issue, especially since I tried it on so many configuration and two different machines.
    Any tips would be greatly appreciated!

    Michael
    Hi Michael,

    Did you resolve this issue? I am facing same issue. My RSS reader App hits engadget.com. Failing in Android Simulator(device version 4.1). But works perfectly fine from iOS simulator.

    However works fine from Mobile browser Simulator for both iOS & Android.

    I also tried changing to application-descriptor.xml as follows:
    <worklightServerRootURL>http://127.0.0.1:8080</worklightServerRootURL>
    <worklightServerRootURL>http://localhost:8080</worklightServerRootURL>

    But no luck. Android simulator trying to hit http://127.0.0.1:8080/apps/services/api/EngadgetReader/android/ & fails.

    Here is the error messages from CatLog:
    07-19 15:12:36.621: E/EngadgetReader(616): Client init failed. Connection to the service is not available.
    07-19 15:12:39.421: E/Web Console(616): XMLHttpRequest cannot load http://127.0.0.1:50198/73c6020f-7727-4e5e-a80f-d2d8451f2c0c. Origin null is not allowed by Access-Control-Allow-Origin. at null:1

    Thanks,
    Purush
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-19T19:24:21Z  
    Hi Michael,

    Did you resolve this issue? I am facing same issue. My RSS reader App hits engadget.com. Failing in Android Simulator(device version 4.1). But works perfectly fine from iOS simulator.

    However works fine from Mobile browser Simulator for both iOS & Android.

    I also tried changing to application-descriptor.xml as follows:
    <worklightServerRootURL>http://127.0.0.1:8080</worklightServerRootURL>
    <worklightServerRootURL>http://localhost:8080</worklightServerRootURL>

    But no luck. Android simulator trying to hit http://127.0.0.1:8080/apps/services/api/EngadgetReader/android/ & fails.

    Here is the error messages from CatLog:
    07-19 15:12:36.621: E/EngadgetReader(616): Client init failed. Connection to the service is not available.
    07-19 15:12:39.421: E/Web Console(616): XMLHttpRequest cannot load http://127.0.0.1:50198/73c6020f-7727-4e5e-a80f-d2d8451f2c0c. Origin null is not allowed by Access-Control-Allow-Origin. at null:1

    Thanks,
    Purush
    Hi,

    Did you try the suggestions above?:

    "You might try setting he worklightServerRootURL to be http://10.0.2.2:8080 This is an IP that the emulator uses for the host. This should work from the emulator with http://${local.IPAddress}:8080, but try the 10.0.2.2 address just in case there is something particular about your network environment."

    Thanks,
    Nell
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-19T19:47:49Z  
    Hi,

    Did you try the suggestions above?:

    "You might try setting he worklightServerRootURL to be http://10.0.2.2:8080 This is an IP that the emulator uses for the host. This should work from the emulator with http://${local.IPAddress}:8080, but try the 10.0.2.2 address just in case there is something particular about your network environment."

    Thanks,
    Nell
    Yes. I have tried all those options.

    Android simulator trying to hit http://127.0.0.1:8080/apps/services/api/EngadgetReader/android/. When hit this URL in the browser, see following error:
    Looks like simulator having issue with 4.1 version.

    HTTP ERROR 500

    Problem accessing /apps/services/api/EngadgetReader/android/. Reason:

    java.util.NoSuchElementException

    Caused by:

    com.worklight.gadgets.GadgetRuntimeException: java.util.NoSuchElementException
    at com.worklight.gadgets.api.GadgetAPIRequestCoder.decodeGadgetRequestInfo(GadgetAPIRequestCoder.java:212)
    at com.worklight.gadgets.serving.filters.InstanceAuthenticationFilter.doFilter(InstanceAuthenticationFilter.java:59)
    at org.eclipse.equinox.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:81)
    at org.eclipse.equinox.http.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:35)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:130)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
    Caused by: java.util.NoSuchElementException
    at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
    at com.worklight.gadgets.api.GadgetAPIRequestCoder.decodeGadgetRequestInfo(GadgetAPIRequestCoder.java:186)
    ... 20 more
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-19T20:04:47Z  
    Yes. I have tried all those options.

    Android simulator trying to hit http://127.0.0.1:8080/apps/services/api/EngadgetReader/android/. When hit this URL in the browser, see following error:
    Looks like simulator having issue with 4.1 version.

    HTTP ERROR 500

    Problem accessing /apps/services/api/EngadgetReader/android/. Reason:

    java.util.NoSuchElementException

    Caused by:

    com.worklight.gadgets.GadgetRuntimeException: java.util.NoSuchElementException
    at com.worklight.gadgets.api.GadgetAPIRequestCoder.decodeGadgetRequestInfo(GadgetAPIRequestCoder.java:212)
    at com.worklight.gadgets.serving.filters.InstanceAuthenticationFilter.doFilter(InstanceAuthenticationFilter.java:59)
    at org.eclipse.equinox.http.servlet.internal.FilterRegistration.doFilter(FilterRegistration.java:81)
    at org.eclipse.equinox.http.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:35)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:130)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
    Caused by: java.util.NoSuchElementException
    at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
    at com.worklight.gadgets.api.GadgetAPIRequestCoder.decodeGadgetRequestInfo(GadgetAPIRequestCoder.java:186)
    ... 20 more
    I guess I'm a little confused... are you having issues with access not allowed when hitting engadget.com? Or are you trying to hit the worklight server on localhost and getting an error from the worklight server?
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-19T20:15:27Z  
    I guess I'm a little confused... are you having issues with access not allowed when hitting engadget.com? Or are you trying to hit the worklight server on localhost and getting an error from the worklight server?
    The same flow works fine with iOS simulator. So no access issues with engadget.com.

    The android simulator is trying to hit that URL. I found that in the Simulator error details. So just tried hitting the same url in the browser & got that error. So simulator is trying to hit URL (http://localhost:8080/apps/services/api/EngadgetReader/android)& getting 500 as response.

    Thanks
  • AntonAleksandrov
    AntonAleksandrov
    55 Posts

    Re: Android 4.1 problems

    ‏2012-07-23T07:10:50Z  
    The same flow works fine with iOS simulator. So no access issues with engadget.com.

    The android simulator is trying to hit that URL. I found that in the Simulator error details. So just tried hitting the same url in the browser & got that error. So simulator is trying to hit URL (http://localhost:8080/apps/services/api/EngadgetReader/android)& getting 500 as response.

    Thanks
    You shouldn't specify localhost(==127.0.0.1) as your Worklight server URL. localhost is LOCAL host. It means that when application is running on Android device it will try to connect to itself and clearly fail. You need to specify an IP address of a machine running Worklight server and make sure that this IP is accessible from handset (e.g. try to open Worklight console from handset's browser)
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-07-24T17:40:00Z  
    You shouldn't specify localhost(==127.0.0.1) as your Worklight server URL. localhost is LOCAL host. It means that when application is running on Android device it will try to connect to itself and clearly fail. You need to specify an IP address of a machine running Worklight server and make sure that this IP is accessible from handset (e.g. try to open Worklight console from handset's browser)
    Thanks for the response.
    I have tried with http://${local.IPAddress} earlier. Since this didn't work, I just played changing it to localhost.

    With http://${local.IPAddress} in application-descriptor.xml, Android simulator trying to hit following URL:

    http://192.168.1.2:8080/apps/services/api/EngadgetReader/android/ & failing with following error.
    java.util.NoSuchElementException Caused by: com.worklight.gadgets.GadgetRuntimeException: java.util.NoSuchElementException at com.worklight.gadgets.api.GadgetAPIRequestCoder.decodeGadgetRequestInfo(GadgetAPIRequestCoder.java:212) at com.worklight.gadgets.serving.filters.InstanceAuthenticationFilter.doFilter(InstanceAuthenticationFilter.java:59) at

    So issue with GadgetAPIRequestCoder for Android 4.1.
    Works fine with iOS Simulator.

    I am using Mac OS X 10.7.4 .
  • bdelima
    bdelima
    4 Posts

    Re: Android 4.1 problems

    ‏2012-07-25T17:16:20Z  
    I had similar problems on Android 4. There's a weird timing quirk with Android 4 in that it's possible for dojo init to occur before WL.Client.init() completes. When using Studio to create your initial html page, Studio defaults to placing dojo init code in a global javascript block as soon as you drop in your first dojo widget. This global block will cause the issue with Android 4 to occur.

    Example : the following will break Android 4
    ...
    <script type="text/javascript" src="dojo/mobile-compat-layer.js"></script>
    <!-- BEGIN: THIS BLOCK BREAKS ANDROID 4 -->
    <script type="text/javascript">
    require(
    // Set of module identifiers
    ["dojo",
    "dojox/mobile/parser",
    "dojox/mobile/View",
    "dojox/mobile/compat",
    "dojox/mobile/Heading",
    "dojox/mobile/ScrollableView",
    "dojox/mobile/Button",
    "dojox/mobile/RoundRectList",
    "dojox/mobile/RoundRectCategory",
    "dojox/mobile/deviceTheme",
    "dojox/mobile/ListItem",
    "dojox/mobile/ProgressIndicator",
    "dojox/mobile" ],
    // Callback function, invoked on dependencies evaluation results
    function(dojo) {
    dojo.ready(function() {
    dojo.style("content", "display", "");
    }
    );
    });
    </script>
    <!-- END: THIS BLOCK BREAKS ANDROID 4 -->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    </head>

    <body onload="WL.Client.init({})" id="content" style="display: none;">
    ...

    In order to correct this issue, I had to remove that global Javascript block and relocate the code to my app's wlCommonInit function like this:
    function wlCommonInit() {
    // Common initialization code goes here

    require(
    // Set of module identifiers
    ["dojo",
    "dojox/mobile/parser",
    "dojox/mobile/View",
    "dojox/mobile/compat",
    "dojox/mobile/Heading",
    "dojox/mobile/ScrollableView",
    "dojox/mobile/Button",
    "dojox/mobile/RoundRectList",
    "dojox/mobile/RoundRectCategory",
    "dojox/mobile/deviceTheme",
    "dojox/mobile/ListItem",
    "dojox/mobile/ProgressIndicator",
    "dojox/mobile" ],
    // Callback function, invoked on dependencies evaluation results
    function(dojo) {
    dojo.ready(function() {
    dojo.style("content", "display", "");
    }
    );
    });
    }

    NOTE: While this will fix the issues with Android 4, removing that global javascript block will have the undesired effect of breaking the Rich Editor's ability to render the page in a WYSIWIG fashion and it will break the user agent detection features of the MobileBrowserSimulator (everything will show as common theme regardless of selected "device").

    Best Regards,
    Bob
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-08-01T13:46:26Z  
    • bdelima
    • ‏2012-07-25T17:16:20Z
    I had similar problems on Android 4. There's a weird timing quirk with Android 4 in that it's possible for dojo init to occur before WL.Client.init() completes. When using Studio to create your initial html page, Studio defaults to placing dojo init code in a global javascript block as soon as you drop in your first dojo widget. This global block will cause the issue with Android 4 to occur.

    Example : the following will break Android 4
    ...
    <script type="text/javascript" src="dojo/mobile-compat-layer.js"></script>
    <!-- BEGIN: THIS BLOCK BREAKS ANDROID 4 -->
    <script type="text/javascript">
    require(
    // Set of module identifiers
    ["dojo",
    "dojox/mobile/parser",
    "dojox/mobile/View",
    "dojox/mobile/compat",
    "dojox/mobile/Heading",
    "dojox/mobile/ScrollableView",
    "dojox/mobile/Button",
    "dojox/mobile/RoundRectList",
    "dojox/mobile/RoundRectCategory",
    "dojox/mobile/deviceTheme",
    "dojox/mobile/ListItem",
    "dojox/mobile/ProgressIndicator",
    "dojox/mobile" ],
    // Callback function, invoked on dependencies evaluation results
    function(dojo) {
    dojo.ready(function() {
    dojo.style("content", "display", "");
    }
    );
    });
    </script>
    <!-- END: THIS BLOCK BREAKS ANDROID 4 -->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    </head>

    <body onload="WL.Client.init({})" id="content" style="display: none;">
    ...

    In order to correct this issue, I had to remove that global Javascript block and relocate the code to my app's wlCommonInit function like this:
    function wlCommonInit() {
    // Common initialization code goes here

    require(
    // Set of module identifiers
    ["dojo",
    "dojox/mobile/parser",
    "dojox/mobile/View",
    "dojox/mobile/compat",
    "dojox/mobile/Heading",
    "dojox/mobile/ScrollableView",
    "dojox/mobile/Button",
    "dojox/mobile/RoundRectList",
    "dojox/mobile/RoundRectCategory",
    "dojox/mobile/deviceTheme",
    "dojox/mobile/ListItem",
    "dojox/mobile/ProgressIndicator",
    "dojox/mobile" ],
    // Callback function, invoked on dependencies evaluation results
    function(dojo) {
    dojo.ready(function() {
    dojo.style("content", "display", "");
    }
    );
    });
    }

    NOTE: While this will fix the issues with Android 4, removing that global javascript block will have the undesired effect of breaking the Rich Editor's ability to render the page in a WYSIWIG fashion and it will break the user agent detection features of the MobileBrowserSimulator (everything will show as common theme regardless of selected "device").

    Best Regards,
    Bob
    Thanks for the response. I am not using DOJO in my example.
  • V14V_ashwani_kabra
    V14V_ashwani_kabra
    5 Posts

    Re: Android 4.1 problems

    ‏2012-08-09T08:27:09Z  
    I'm exactly getting the same issue and could not solve it yet.
    I'm using XP, Worklight developer verion, AVD android 4.1, hello world application, eclipse Indigo latest.

    simple creating hellow world application on eclipse, running build deploy then from eclipse run android application, it launch android amulator where i see my appplication, i click and then screen come with busy indicator and then exception come with 3 options 'detail, exit, reload'

    In Application discriptor server URl is http://{local.IPAddress}:8080
    when i see the detail in amulator it is showing following :
    service url : http://10.0.2.2:8080/apps/services/api/todo/android
    IP Address : 10.0.2.15

    I'm also in Prxoy environment so i set my proxy detail with user name and password in amulator settings.

    I tried the same service URL in amulator browser it is saying TCP error (network error) connection refused.

    I have tried so many other IP address (like DNS, system IP, 10.0.2.15, 10.0.2.2, localhot) nothing worked. It seems like amulator is not connecting to workligth server. but where is that server than.

    amulator browser is working with internet.
    Could you please suggest what i'm doing wrong.

    i don't have any worklight server separatly other that developer version with eclipse.
  • DG1M_Harry_Ho
    DG1M_Harry_Ho
    49 Posts

    Re: Android 4.1 problems

    ‏2012-08-09T16:24:27Z  
    Hey guys, I actually found a fix on this problem when I was helping someone else in another thread. However, it is a bit specific.

    When troubleshooting, you can definitely use 10.0.2.2 or the actual host machine ip address.

    This if really only relevant if you are creating an app that is using Api 16. I dropped the api to 10 and ran it on the emulator and it connects fine.

    It seems that Android 4.1 doesn't connect well with the worklight server in the emulator. I don't know if it will run on a phone either. However, if you make some backwards compatability (which is a good idea seeing most phones still have 2.3), it should work.

    Navigating to the Android Manifest and project properties, change the min and target to 10. Rebuild, then send the app to the emulator. Give it time and make sure you fully rebuild.

    Hopefully this helps!
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-12-27T12:13:29Z  
    Hey guys, I actually found a fix on this problem when I was helping someone else in another thread. However, it is a bit specific.

    When troubleshooting, you can definitely use 10.0.2.2 or the actual host machine ip address.

    This if really only relevant if you are creating an app that is using Api 16. I dropped the api to 10 and ran it on the emulator and it connects fine.

    It seems that Android 4.1 doesn't connect well with the worklight server in the emulator. I don't know if it will run on a phone either. However, if you make some backwards compatability (which is a good idea seeing most phones still have 2.3), it should work.

    Navigating to the Android Manifest and project properties, change the min and target to 10. Rebuild, then send the app to the emulator. Give it time and make sure you fully rebuild.

    Hopefully this helps!
    I am having this problem on the device. I have the correct IP address in the descriptor as I can see the console in the browser, it worked once, I then changed the code. It then was unable to connect to the server. I changed the code back and could still not connect to the server.

    I have added timeouts and also changed the build target to api level 10. This is really frustrating.
  • IdanAdar
    IdanAdar
    741 Posts

    Re: Android 4.1 problems

    ‏2012-12-28T07:47:16Z  
    Can't really tell what is your specific problem without logs.
    What is printed to LogCat, from application launch until the error is displayed?

    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
  • SystemAdmin
    SystemAdmin
    2327 Posts

    Re: Android 4.1 problems

    ‏2012-12-31T15:29:32Z  
    I am having this problem on the device. I have the correct IP address in the descriptor as I can see the console in the browser, it worked once, I then changed the code. It then was unable to connect to the server. I changed the code back and could still not connect to the server.

    I have added timeouts and also changed the build target to api level 10. This is really frustrating.
    Use your emulator's browser to access worklight console. If it is successfully, means your emulator internet settings are correct. Lots of times, corporation network gives lots of trouble when do mobile testing...

    The IP address in application descriptor has to be very specific if you want to test in emulator.

    Jerry