WebBRowser Component RuntimeException - onLoad

144 views
Skip to first unread message

hru...@gmail.com

unread,
Dec 3, 2014, 8:19:58 AM12/3/14
to codenameone...@googlegroups.com

IDE: NetBeans 8.0.1
Desktop OS: Mac 10.9.5 Maverick
Simulator: The problem don't occur in Simulator. It woks FINE
Devices: 
    Motolola - Moto G (Android 4.4) and 
    Sumsung Galaxy Note 8 (Android 4.4)


The problem occurs only in my physical devices (Android 4.4) as enumerated above.

On this week, The Android-App is throwing the following RuntimeException on my devices:

" an internal application error occurred:
java.lang.RuntimeException:
java.lang.Throwable:
A WebView method was called on thread 'EDT'.
All WebView methods must be called on the same thread.
(Expected Looper Looper(main, tid 1)
{41f9cfa8} called on null, FYI main Looper is Looper (main, tid 1) {41f9cfa8}"

When it started to occur I can't determine, but a few days ago it did not occur.
The same code worked fine until now and it continues OK on simulator.

I made some tests and figure out when it occurs.
It occurs when the OnLoad method (overloaded) of WebBrowser is called.
(I have a customized IwWebBrowser component. It extends WebBrowser and overloads "OnLoad" method.)

In my project, I use a lot of bidirecional communication between Java Code and JavaScript. All of that is set in OnLoad method.
If  onLoad method isn't executed, my app don't work. So it's  a critical point.

Did You recently change something in Android Builder that can cause that behavior?

Any help will be appreciated.

hru...@gmail.com

unread,
Dec 3, 2014, 11:36:58 AM12/3/14
to codenameone...@googlegroups.com, hru...@gmail.com
Only adding more information about the problem.

I read  other posts in this forum that seem related to the same problem
and I made a Android Build passing the following "build-hints":

android.oldTarget = true
android.asyncPaint = false

The result is the same. The problem occurs too.



Shai Almog

unread,
Dec 3, 2014, 1:01:27 PM12/3/14
to codenameone...@googlegroups.com, hru...@gmail.com
We will be reverting this change tomorrow and redo it with a different approach which will hopefully resolve your issue.

hru...@gmail.com

unread,
Dec 4, 2014, 11:47:24 PM12/4/14
to codenameone...@googlegroups.com, hru...@gmail.com

Is the Android Builder reverting process completly finished?

The RuntimeException described here  still occurs.

I have little time to show the App to client.
Without bidirectional communication between java code and javascript the app doesn't work.

As described before. All works fine in simulator, but in physical Android devices not.

Any help will very  ... very... very appreciated.

Shai Almog

unread,
Dec 5, 2014, 1:14:39 AM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com
It was reverted yesterday night.

hru...@gmail.com

unread,
Dec 5, 2014, 7:47:44 AM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com
Hi Shai.

You have some idea or suggestion how to solve  that in Android devices?
Before changes in Builder it did not occur.
The Exception occurs when the OnLoad Method is called.
I noted that no line (OnLoad method) is executed. The problem occurs during the call.

It is not my code who makes that call. This is an internal component behavior. 

I can't make sure, but a behavior within the Builder may not have been completely reversed (This is only a hypothesis).
The code it is writing is breaking some important rule yet. 
Before everything worked well.

Melo90_...@hotmail.it

unread,
Dec 5, 2014, 9:38:53 AM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com


On Friday, December 5, 2014 7:14:39 AM UTC+1, Shai Almog wrote:
It was reverted yesterday night.


me too continues not working 

Shai Almog

unread,
Dec 5, 2014, 1:02:02 PM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Chen made some additional fixes that might resolve this. Please try again.

hru...@gmail.com

unread,
Dec 5, 2014, 1:41:08 PM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
I made a Build right now and tested it on Android device.
The problem continues.

Melo90_...@hotmail.it

unread,
Dec 5, 2014, 2:59:04 PM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi Shai, thanks for the attention.
I tried but still nothing.

i hope that all returns to work fine early. 

Chen Fishbein

unread,
Dec 5, 2014, 4:04:27 PM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Can you please post the full trace and the offending code?

Melo90_...@hotmail.it

unread,
Dec 5, 2014, 5:15:40 PM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
I created this simple project to reproduce the bug/error.

Like for the real project it work in the simulator but not on real Android device.

Give me a reply.... :D Thanks.  


Enter code here...    
private void showMainMenu() {
        Form hi = new Form("Test");
        hi.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        Button btn = new Button("Test1");
        btn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent evt) {
                Display.getInstance().callSerially(new Runnable() {

                    public void run() {
                        showReport2();
                    }

                });

            }

        });
        hi.addComponent(btn);
        hi.show();
     }
 
     
        public void showReport2(){
        Log.p("Show Report ");
        Form f = new Form("Test");
        f.setLayout(new BorderLayout());
        final WebBrowser web = new WebBrowser(){
            @Override
            public void onLoad(String url) {                
                Component c = getInternal();               
                if(c instanceof BrowserComponent) {                   
                    BrowserComponent b = (BrowserComponent)c; 
                    b.setPinchToZoomEnabled(true); 
                    String call="";
                    call="report2([1,2,3,4,5])";
                    b.execute(call);                                                      
                }               
            }
        };
        web.setURL("jar:///report2.html");
        f.addComponent(BorderLayout.CENTER, web);
        List lista= new  ArrayList();
        lista.add("A");
        lista.add("B");
        lista.add("C");
        ComboBox combo= new ComboBox(new DefaultListModel(lista));
        f.addComponent(BorderLayout.SOUTH, combo);
        combo.addSelectionListener(new SelectionListener() {

            public void selectionChanged(int oldSelected, int newSelected) {
              System.out.println(""+newSelected);
                if(oldSelected!=newSelected){
                    System.err.println("zzzz");
                    showReport2();
                }
            }
        });
        f.setBackCommand(new Command(" ") {

            @Override
            public void actionPerformed(ActionEvent evt) {
                showMainMenu();
            }

        });
        
        current=f;
        f.show();
    }
     


hru...@gmail.com

unread,
Dec 5, 2014, 6:01:00 PM12/5/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi Chen.

I want to provide you all informations you requested.
Please help me because I think I don't know how to do that exactly.
Message has been deleted
Message has been deleted

Steve Hannah

unread,
Dec 5, 2014, 7:03:06 PM12/5/14
to codenameone...@googlegroups.com

The example code you provided doesn't include any reference to the JavaScript bridge.  That suggests the problems are more fundamental.

On Dec 5, 2014 3:56 PM, <hru...@gmail.com> wrote:

I have a suggestion:

In my point of view, the problem is:
Javascript-Bridge stopped to work after last changes. 

In my project I simply used the principles documented here

My suggestion is implement the examples listed in the link.

I believe they will fail too. 
So, we could get more informations to solve that question.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/dd721bf1-6cc1-4de9-9892-4cb2f730e045%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Dec 6, 2014, 1:14:49 AM12/6/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi,
connect the device with a cable to the computer. Run the DDMS utility from the Android SDK and see the exception stack trace which you can paste here.

Melo90_...@hotmail.it

unread,
Dec 6, 2014, 2:08:27 AM12/6/14
to codenameone...@googlegroups.com


On Saturday, December 6, 2014 1:03:06 AM UTC+1, shannah wrote:

The example code you provided doesn't include any reference to the JavaScript bridge.  That suggests the problems are more fundamental.

On Dec 5, 2014 3:56 PM, <hru...@gmail.com> wrote:

I have a suggestion:

In my point of view, the problem is:
Javascript-Bridge stopped to work after last changes. 

In my project I simply used the principles documented here

My suggestion is implement the examples listed in the link.

I believe they will fail too. 
So, we could get more informations to solve that question.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

hru...@gmail.com

unread,
Dec 6, 2014, 7:36:45 AM12/6/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi Shai.

I will do this procedure to get the stack-trace and send it for you as soon as possible. (at monday - I can't do it now)

With the intent  adding more details, here you have the code of my OnLoad method.
Might be it could contribute with something at this moment.

   @Override
    public void onLoad(String url) {
        
        BrowserComponent c = (BrowserComponent)this.getInternal();
        c.setPinchToZoomEnabled(true);
        
        jsCtx = new JavascriptContext(c);
        
        // Provides JSObjects that allow to call Java Code from the Javascript context.
        // Provides the Access Key for WebBrowser component.
        // It allows to make Web-Services calls target to IwRestAPI.
        // Provides the same information to JS document object.
        JSObject jsWin = (JSObject) jsCtx.get("window");
        
        jsWin.set("javaCodeCaller"  , new JSFunction() {
            
            @Override
            public void apply(JSObject self, final Object[] args) {
                
                JSObject jsInfo      = (JSObject) args[0];
                JSObject jsVariables = (JSObject) args[1];
                JSObject jsCallback  = (JSObject)args[2];
                
                Object buttonType = jsInfo.get(IW_BUTTON_TYPE_ATTR);
                Object varName = jsInfo.get(IW_VAR_NAME_ATTR);

                JSObject jsResult = null;
                if (IWBUTTON_CALENDAR_LAUNCHER.equals(buttonType)) {
                    
                    StringTokenizer st = new StringTokenizer((String) varName, "_");
                    ArrayList<String> aList = new ArrayList<String>();
                    while (st.hasMoreTokens()) {
                        aList.add(st.nextToken());
                    }
                    String varDate_name = "iwvar_eventdate";
                    if (!aList.isEmpty()) {
                        varDate_name = "iwvar_" + aList.get(aList.size()-1) ; 
                    }
                    
                    String varDate_value = jsVariables.getString(varDate_name);
                    String strDateEdited = launchIwCalendar(varDate_value);
                    
                    if (strDateEdited != null) {
                        HashMap<String,String> hm = new HashMap<String, String>();
                        hm.put(varDate_name, strDateEdited);
                        setHtmlVariablesValues(hm, jsCallback);
                    }
                    
                }
                else if (IWBUTTON_RICH_EDITOR_LAUNCHER.equals(buttonType)) {
                    launchRichTextEditor(jsVariables, varName.toString());  
                }
                else if (IWBUTTON_PLUGGED_FUNCTION_CALLER.equals(buttonType)) {
                    String functionName = (String) jsInfo.get(IW_VAR_NAME_ATTR);
                    callPlugFuncAsync(idText, idTemplate, functionName, idPatient, idAdmssion, jsCallback);

                }

            }
            
            private void callPlugFuncAsync(
                    String   idText,
                    String   idTemplate,
                    String functionName,
                    String   idPatient,
                    String   idAdmssion,
                    final JSObject jsCallback) {
                
                InfiniteProgress prog = new InfiniteProgress();
                final Dialog dlgProgress = prog.showInifiniteBlocking();
                
                IwHttpRequesterCallBack<Map<String,MobRecordset>> callback =
                      new IwHttpRequesterCallBack<Map<String,MobRecordset>>() {

                   @Override
                   public void onFailure(MobRecordsetError rsError) {
                       dlgProgress.dispose();
                       Dialog.show("Alert", rsError.getTranslation(), "OK", null);
                   }
                   @Override
                   public void onSuccess(Map<String,MobRecordset> resultMap) {
                        dlgProgress.dispose();
                        MobRecordset mobResult = resultMap.get("rsVariables");
                        HashMap<String,String> hmResp = new HashMap<String,String>();
                        for(MobField f : mobResult.rows.get(0).fields) {
                            hmResp.put(f.getName(), f.getValue());
                        }
                        if (hmResp != null) {
                            if (hmResp.containsKey(CTRL_VAR_DISPLAY_ERROR)) {
                                String displayError = hmResp.get("displayError");
                                Dialog.show("Erro", displayError, "OK", null);
                                hmResp.remove(CTRL_VAR_DISPLAY_ERROR);
                            }
                            setHtmlVariablesValues(hmResp, jsCallback);
                        }                       
                   }
                };
                
                final IwServiceCaller caller = Brain.getInstance().getIwServiceCaller();
                caller.execPluggedFunctionAsync(
                       idText,
                       idTemplate,
                       functionName,
                       idPatient,
                       idAdmssion,
                       getHtmlVariableValues(),
                       callback);
           }
            
            private String launchIwCalendar(String strDate) {
               IwDlgInputDate1 dlg = new IwDlgInputDate1(strDate);
                dlg.show();
                if (dlg.getUserAction() == dlg.USER_ACTION_CONFIRM) {
                    return dlg.getStrEditedDate();
                }
                return null;
            }            

            private void launchRichTextEditor(JSObject jsVariables, Object varName) {
                
                String varValue = jsVariables.getString(varName.toString());
                
                IwDlgInputHtmlRichText f = new IwDlgInputHtmlRichText(
                        varName.toString(),
                        varValue,
                        jsVariables,
                        me);
                
                Command backCommand = new Command("Voltar") {
                     @Override
                     public void actionPerformed(ActionEvent ev) {
                          parentForm.show();
                     } 
                }; 
                f.setBackCommand(backCommand);               
                f.show();
            }
            
        });
        
        jsWin.set("iwCareHeaderIdle", IwParameters.IW_CARE_HEADER_IDLE);
        jsWin.set("accessKey"       , Brain.getInstance().getIwServiceCaller().getAccessKey());
        jsWin.set("dynTableName"    , this.dynamicTableName);
        jsWin.set("idTemplate"      , this.idTemplate);
        jsWin.set("idText"          , this.idText);

Shai Almog

unread,
Dec 6, 2014, 11:08:54 AM12/6/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi,
we only accept code from pro or higher subscribers and even then its only after all other options were exhausted. Its hard getting into other peoples code and trying to figure out issues in this way.

Steve Hannah

unread,
Dec 6, 2014, 12:54:02 PM12/6/14
to codenameone...@googlegroups.com, Hélio Rugani, Melo90_...@hotmail.it
Here is the stack trace from DDMS fro the example posted a few posts back by Melo90:

12-06 09:49:34.403: W/WebView(32057): java.lang.Throwable: A WebView method was called on thread 'EDT'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {42611cf0} called on null, FYI main Looper is Looper (main, tid 1) {42611cf0})
12-06 09:49:34.403: W/WebView(32057): at android.webkit.WebView.checkThread(WebView.java:2072)
12-06 09:49:34.403: W/WebView(32057): at android.webkit.WebView.getSettings(WebView.java:1685)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.impl.android.AndroidImplementation$AndroidBrowserComponent.setPinchZoomEnabled(AndroidImplementation.java:3466)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.impl.android.AndroidImplementation.setPinchToZoomEnabled(AndroidImplementation.java:2707)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.BrowserComponent.setPinchToZoomEnabled(BrowserComponent.java:194)
12-06 09:49:34.403: W/WebView(32057): at ca.weblite.browsertest.BrowserTest$2.onLoad(BrowserTest.java:97)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.components.WebBrowser$2.actionPerformed(WebBrowser.java:79)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.util.EventDispatcher.fireActionSync(EventDispatcher.java:392)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.util.EventDispatcher.access$100(EventDispatcher.java:41)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.util.EventDispatcher$CallbackClass.run(EventDispatcher.java:90)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.Display.processSerialCalls(Display.java:1110)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.Display.edtLoopImpl(Display.java:1054)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.Display.mainEDTLoop(Display.java:960)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
12-06 09:49:34.403: W/WebView(32057): at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
12-06 09:49:34.403: W/WebView(32057): at java.lang.Thread.run(Thread.java:841)
12-06 09:49:34.403: W/System.err(32057): java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'EDT'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {42611cf0} called on null, FYI main Looper is Looper (main, tid 1) {42611cf0})
12-06 09:49:34.403: W/System.err(32057): at android.webkit.WebView.checkThread(WebView.java:2082)
12-06 09:49:34.403: W/System.err(32057): at android.webkit.WebView.getSettings(WebView.java:1685)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.impl.android.AndroidImplementation$AndroidBrowserComponent.setPinchZoomEnabled(AndroidImplementation.java:3466)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.impl.android.AndroidImplementation.setPinchToZoomEnabled(AndroidImplementation.java:2707)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.BrowserComponent.setPinchToZoomEnabled(BrowserComponent.java:194)
12-06 09:49:34.403: W/System.err(32057): at ca.weblite.browsertest.BrowserTest$2.onLoad(BrowserTest.java:97)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.components.WebBrowser$2.actionPerformed(WebBrowser.java:79)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.util.EventDispatcher.fireActionSync(EventDispatcher.java:392)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.util.EventDispatcher.access$100(EventDispatcher.java:41)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.util.EventDispatcher$CallbackClass.run(EventDispatcher.java:90)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.Display.processSerialCalls(Display.java:1110)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.Display.edtLoopImpl(Display.java:1054)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.Display.mainEDTLoop(Display.java:960)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
12-06 09:49:34.403: W/System.err(32057): at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
12-06 09:49:34.403: W/System.err(32057): at java.lang.Thread.run(Thread.java:841)
12-06 09:49:34.403: W/System.err(32057): Caused by: java.lang.Throwable: A WebView method was called on thread 'EDT'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {42611cf0} called on null, FYI main Looper is Looper (main, tid 1) {42611cf0})
12-06 09:49:34.413: W/System.err(32057): at android.webkit.WebView.checkThread(WebView.java:2072)

Haven't had a chance to look into it.  If you're developing Android, you should get comfortable using DDMS.  It will save you a lot of time (e.g. rather than throwing full projects at Shai, you can give a stack trace that shows *exactly* what is wrong).

Steve

On Sat, Dec 6, 2014 at 8:08 AM, Shai Almog <shai....@gmail.com> wrote:
Hi,
we only accept code from pro or higher subscribers and even then its only after all other options were exhausted. Its hard getting into other peoples code and trying to figure out issues in this way.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Web Lite Solutions Corp.

Chen Fishbein

unread,
Dec 6, 2014, 1:45:45 PM12/6/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Thanks Steve! the fix for this is now committed.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

Melo90_...@hotmail.it

unread,
Dec 6, 2014, 4:02:12 PM12/6/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hello everyone, 
shai sorry I did not want to abuse your kindness.

Thanks a lot Shai, Chen and Steve.

I tried to build now. but still don't works.

i tried to use ddms and this is the trace:

12-06 21:51:25.667: W/WebView(32270): java.lang.Throwable: A WebView method was called on thread 'EDT'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {41d690c0} called on null, FYI main Looper is Looper (main, tid 1) {41d690c0})
12-06 21:51:25.667: W/WebView(32270): at java.lang.Thread.run(Thread.java:841)
12-06 21:51:25.669: W/System.err(32270): java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'EDT'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {41d690c0} called on null, FYI main Looper is Looper (main, tid 1) {41d690c0})
12-06 21:51:25.672: W/System.err(32270): at java.lang.Thread.run(Thread.java:841)
12-06 21:51:25.672: W/System.err(32270): Caused by: java.lang.Throwable: A WebView method was called on thread 'EDT'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {41d690c0} called on null, FYI main Looper is Looper (main, tid 1) {41d690c0})
12-06 21:51:25.701: W/System.err(32270): java.lang.IllegalArgumentException: width and height must be > 0
12-06 21:51:25.705: W/System.err(32270): at java.lang.Thread.run(Thread.java:841)

hru...@gmail.com

unread,
Dec 7, 2014, 4:46:04 AM12/7/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it

Hi Shai.

Sorry my mistake of sending my code.

I didn't do the stack-trace generation yet, but I figure out exactly the command in my program that is throwing the RuntimeException.

The exception is being throwed by the following command within the OnLoad method (overloaded):

BrowserComponent c = (BrowserComponent) getInternal();

Additional Information:
I need to correct a wrong information that I told before.
In fact, the onLoad method is  being called and the exception occurs inside it  as I described above.
In a post before, I have mentioned that the problem occurs during the call and that OnLoad method didn't begin its execution. 

Shai Almog

unread,
Dec 7, 2014, 12:47:49 PM12/7/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi,
is that on the simulator?
On the simulator if you are running without JavaFX this will indeed throw an exception.

hru...@gmail.com

unread,
Dec 7, 2014, 7:51:23 PM12/7/14
to codenameone...@googlegroups.com, hru...@gmail.com, Melo90_...@hotmail.it
Hi Shai,

No. On Simulator, I never had problem. All worked fine and continues to work fine and smoothly. No Runtime Exceptions.

The app on simulator is really really good.
It is better than the Application version for Desktop (using java SE / Swing).
My client is really impressed when he sees all running on simulator. Fast and correctly.

This problem (since first post) occurs "only" on Android Physical devices.
(my smartphone Motorola Moto G and my tablet Galaxy note 8, both with Android 4.4)
It's impossible for me make tests on all devices, but I believe the problem will occur on all Android physical devices.

This is other question about the problem.
Why Do the same code works fine on Simulator?
Why Do RuntimeException occurs only on real devices?  

In this app I simply used the principles from Codenameone documentation:

Today, I think , if you try to execute the examples ilustrated there. 
They will fail (On Android devices, not on Sumulator) with the same Runtime Exception that occurs in my app.

From 2 weeks ago, this problem began.
Before that , my app worked fine even on physical devices.

Steve Hannah

unread,
Dec 7, 2014, 7:56:33 PM12/7/14
to codenameone...@googlegroups.com

My guess is that the fix hasn't been posted to the build server yet.  When Chen said that I fixed it that probably just meant svn.  Ie it will be included the next time they push changes to the server.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.

Shai Almog

unread,
Dec 8, 2014, 1:40:53 AM12/8/14
to codenameone...@googlegroups.com
Hi,
indeed we haven't updated the build server.

hru...@gmail.com

unread,
Dec 8, 2014, 7:37:31 AM12/8/14
to codenameone...@googlegroups.com
Hi Shai,

Do You know for when the server's update is scheduled?

Shai Almog

unread,
Dec 8, 2014, 10:44:14 AM12/8/14
to codenameone...@googlegroups.com, hru...@gmail.com
Hi,
sometime during the week.

hru...@gmail.com

unread,
Dec 11, 2014, 12:21:23 AM12/11/14
to codenameone...@googlegroups.com, hru...@gmail.com
The builder behavior has changed,
So, I believe new version is already published.

The RuntimeException doesn't occur now.

But, there is something wrong yet.

Now, the 3 lines bellow in onLoad() method are executed without exceptions:

BrowserComponent c = (BrowserComponent)this.getInternal(); 
c.setPinchToZoomEnabled(true); 
jsCtx = new JavascriptContext(c);

After these lines I put a "Dialog.show" and I can see the instance ID of JavaScriptContext Objeto using  jsCtx.toString() in message.
I suppose that JavaScriptContext Object was created successfully.

Now, the problem occurs in the next instruction (immediately after):

JSObject jsWin = (JSObject) jsCtx.get("window");

This line fails silently and lines after it aren't executed.  
Weirdly, I put a "Try/Catch structure" in this line but the exceptions weren't throwed.

Shai Almog

unread,
Dec 11, 2014, 1:42:39 AM12/11/14
to codenameone...@googlegroups.com, hru...@gmail.com
I'm not sure about this but we have another fix for the Android port and its landing a bit later today.

hru...@gmail.com

unread,
Dec 11, 2014, 7:20:37 AM12/11/14
to codenameone...@googlegroups.com, hru...@gmail.com
Hi Shai,
Thank you for information.
Please, let me know as soon as possible when the new fix will be  available. 
Reply all
Reply to author
Forward
0 new messages