BlackBerry Build Issue

203 views
Skip to first unread message

Vinay Gurram

unread,
Apr 23, 2013, 7:51:35 AM4/23/13
to codenameone...@googlegroups.com
Hi 
I am getting this error. I created 2 new class files in src and userclasses packages. Do I have to do something like Util.register() for these files? .

Warning: com.justdial.search.NewAutoSuggest$1$1: can't find enclosing method 'void resp(java.util.Hashtable)' in class com.justdial.search.NewAutoSuggest$1
Warning: com.justdial.search.NewAutoSuggest$2$1: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class com.justdial.search.NewAutoSuggest$2
Warning: com.justdial.search.NewAutoSuggest$3$1: can't find enclosing method 'void resp(java.util.Hashtable)' in class com.justdial.search.NewAutoSuggest$3
Warning: com.justdial.search.NewAutoSuggest$4$1: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class com.justdial.search.NewAutoSuggest$4
Warning: com.justdial.search.NewAutoSuggest$5$1: can't find enclosing method 'void resp(java.util.Hashtable)' in class com.justdial.search.NewAutoSuggest$5
Warning: userclasses.StateMachine$14$1: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$14
Warning: userclasses.StateMachine$14$2: can't find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$14
Warning: userclasses.StateMachine$14$3: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$14
Warning: userclasses.StateMachine$15$1: can't find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$15
Warning: userclasses.StateMachine$15$2: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$15
Warning: userclasses.StateMachine$15$3: can't find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$15
Warning: userclasses.StateMachine$15$4: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$15
Warning: userclasses.StateMachine$23$1: can't find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$23
Warning: userclasses.StateMachine$32$1: can'
t find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$32
Warning: userclasses.StateMachine$32$2: can't find enclosing method 'void resp(java.util.Hashtable)' in class userclasses.StateMachine$32
Warning: userclasses.StateMachine$48: can'
t find enclosing method 'java.util.Vector fetchfrnsList(java.lang.String)' in class userclasses.StateMachine
Warning: there were 16 unresolved references to program class members.

Shai Almog

unread,
Apr 23, 2013, 2:26:01 PM4/23/13
to codenameone...@googlegroups.com
This can sometimes happen when inner classes reference generic parent methods.
Generally our Java 5 compatibility code converts resp(java.util.Hashtable) to resp(codenameOneInternal.Hashtable) but fails to do this for some unique cases of anonymous inner classes bridge methods (special hidden methods generated to access the argument).

So if you have:
void resp(final Hashtable x) {
   new ActionListener() {
       public void actionPerformed(ActionEvent e) {
             x.doSomething();
       }
   }
}

Turn it to:
void resp(Hashtable x) {
   final Object temp = x;
   new ActionListener() {
       public void actionPerformed(ActionEvent e) {
             Hashtable x = (Hashtable)temp;
             x.doSomething();
       }
   }
}

Vinay Gurram

unread,
Apr 24, 2013, 1:57:43 AM4/24/13
to codenameone...@googlegroups.com
I am getting these errors only in Blackberry build not in Android build.  I tried changing that but no changes in the errors.
My network file is below here

public class netWork {
 
 
 
public interface ResponseObject{
       
public void resp(Hashtable data);
   
}
 
 
public static NetworkManager networkManager = NetworkManager.getInstance();
 
public static JSONParser JsonParser= new JSONParser();
 
 
public static void init(){    

   
/* createing a newtwork manager for all network related events */
    networkManager
.start();
   
    networkManager
.addErrorListener(new ActionListener() {
           
public void actionPerformed(ActionEvent evt) {
               
NetworkEvent n = (NetworkEvent) evt;
                 n
.getError().printStackTrace();
           
}
   
});      
   
}
 
 
public static  ConnectionRequest myNetwork(String uriString,final ResponseObject myresponse) {
   
String URL = uriString;
   
ConnectionRequest request = new ConnectionRequest(){
               
protected void readResponse(InputStream input) throws IOException {
                       myresponse
.resp(JsonParser.parse(new InputStreamReader(input)));
 
}
 
               
protected void postResponse(){
                       
Display.getInstance().getCurrent().refreshTheme();
     
       
}
 
};
 
InfiniteProgress ip = new InfiniteProgress();
 
Dialog d = new Dialog();
 d
.setDialogUIID("infiniteLoader");
 d
.setLayout(new BorderLayout());
 
Container cnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
 
Container ccc = new Container(new FlowLayout(Container.CENTER));
 ccc
.addComponent(ip);
 ip
.setUIID("Container");
 cnt
.addComponent(ccc);
 
Label ll = new Label("Loading...");
 ll
.setUIID("loaderLabel");
 cnt
.addComponent(ll);
 d
.addComponent(BorderLayout.CENTER, cnt);
 d
.setTransitionInAnimator(CommonTransitions.createEmpty());
 d
.setTransitionOutAnimator(CommonTransitions.createEmpty());
 d
.showPacked(BorderLayout.CENTER, false);
 request
.setHttpMethod("GET");
 request
.setUrl(URL);
 
NetworkManager.getInstance().addToQueue(request);
 
System.out.println(URL);
 
return request;
 
}

and One implementation of the request is 

ConnectionRequest request = netWork.myNetwork3(myUrl, new ResponseObject() {
       
public void resp(Hashtable data) {
               
final Object xx = data;
               
Hashtable lHash = (Hashtable) xx;
               
final Vector tempresults = (Vector) lHash.get("results");
               
System.out.println("The results are " + tempresults);
       
}
   
});


Shai Almog

unread,
Apr 24, 2013, 2:04:41 AM4/24/13
to codenameone...@googlegroups.com
Are you sure you applied both in the build arguments?
If the error log is identical then these weren't applied, you should get a slightly different error log.
What I'm interested in is file sizes and types within the project jar. E.g. if you have a REALLY large class file or a really large file in general.

Vinay Gurram

unread,
Apr 24, 2013, 3:16:38 AM4/24/13
to codenameone...@googlegroups.com
I added both the arguments  rim.obfuscation = true and rim.ignor_legacy=true. The first argument changed the error log from 10k lines to 1k lines :-) . I am attaching the error.log file.There is just one big file , "arial.ttf". StateMachine and StateMachineBase both are large files. (11k and  16k lines). Theme has 32 forms, so it's large too. Other user class files are small. However the interesting thing is, I used viod resp() method 21 times in StateMachine, only 10 of them were in the error warning. But in other class file, I used it 5 times, and all of them were in the error warnings.
error (19).txt

Vinay Gurram

unread,
Apr 24, 2013, 8:20:38 AM4/24/13
to codenameone...@googlegroups.com
Hi 
I debugged some of my code. Adding actionListener in the public void myresp(Hashtable) function is giving me the bug . If I just comment the actionListener , the  bug is disappeared. 

Vinay Gurram

unread,
Apr 24, 2013, 11:57:28 AM4/24/13
to codenameone...@googlegroups.com
is this bug in CodenameOne? How to add action listeners without getting that error?

Shai Almog

unread,
Apr 24, 2013, 12:46:00 PM4/24/13
to codenameone...@googlegroups.com
I explained that to you in the response I gave to you exactly 22 hours ago on a different thread. Pasted below:

       }
   }
}

Message has been deleted

Vinay Gurram

unread,
Apr 24, 2013, 2:19:44 PM4/24/13
to codenameone...@googlegroups.com
Doing that did not solve my problem.  Adding the syntax of ActionListener() is giving me an error. For example  ::
code 1 :  gives  1 error
void resp(final Hashtable x) {
   new ActionListener() {
       public void actionPerformed(ActionEvent e) {
       }
   }
    //some code here
}

code 2 : No error
void resp(final Hashtable x) {
  //some code here
- hide quoted text -

}

Shai Almog

unread,
Apr 25, 2013, 1:12:40 AM4/25/13
to codenameone...@googlegroups.com
You should have no reference to the hashtable but it seems to still be final. If you can list the code of this method and how you tried to fix that I might be able to help this specific case.
As a rule do not keep a final reference to a java.util class that references an inner class within a method. Other cases such as class based inner classes work just fine.
Message has been deleted

Vinay Gurram

unread,
Apr 25, 2013, 1:37:30 AM4/25/13
to codenameone...@googlegroups.com
This is my function. This function is giving me an error. Network.java is posted above. I am stuck on it for 2 days now. In the below code, If I just comment the actionListener error disappears. But I need the actionLIstener.
public static Container result_whereSuggest(String url){
   
   
final Container wherereturn = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    wherereturn
.setUIID("autosuggest_dropdown");
   
String myUrl = url;

   
System.out.println("result_where auto suggest is called");

   
   
ConnectionRequest request = netWork.myNetwork3(myUrl, new ResponseObject() {    
       
       
public void resp(Hashtable data) {

           
// TODO Auto-generated method stub

           
final Object xx = data;

           
Hashtable lol1 = (Hashtable) xx;
           
final Vector tempresults = (Vector) lol1.get("results");
           
Vector<Hashtable> listofcities = new Vector<Hashtable>();
       
//ystem.out.println("results size ="+results.size());
           
           
if(!tempresults.isEmpty())
           
{
                whereresults
= tempresults;
           
}
//            else {
//                return;
//            }
           
try {
               
if (!whereresults.isEmpty()) {
                   
                    wherecontainers
= new Container[whereresults.size()];
                   
for (int i = 0; i < whereresults.size(); i++) {
                        wherecontainers
[i]= new Container(new LayeredLayout());
                        wherecontainers
[i].setUIID("Container");
                       
//wherecontainers[i].removeAll();
                       
}
                   
                   
for(int i=0;i<whereresults.size();i++){
                       
final Hashtable myhash = (Hashtable) whereresults.elementAt(i);
                       
Button wheretbn = new Button();
                       
TextArea wheretxt = new TextArea();
                        wheretbn
.setUIID("autosuggest1");
                        wheretxt
.setUIID("autosuggest1");
                        wheretxt
.setAlignment(Component.LEFT);
                        wheretxt
.setEditable(false);
                        wheretxt
.setEnabled(false);
                       
//wheretbn.setText((String) myhash.get("area"));
                        wheretxt
.setText((String) myhash.get("area"));
                       
//returnContainer.addComponent(wheretbn);
                        wherecontainers
[i].addComponent(wheretbn);
                        wherecontainers
[i].addComponent(wheretxt);
                        whatvalue
=HelloWorld.myState.findResultWhat().getText();
                        wheretbn
.addActionListener(new ActionListener() {
                           
                           
public void actionPerformed(ActionEvent evt) {
                               
// TODO Auto-generated method stub
                               
                               
System.out.println("you clicked "+myhash.get("area")+" Button.");
                           
                                wherevalue
= (String) myhash.get("area");
                               
System.out.println("You have selected ->" + wherevalue);
                               
//HelloWorld.myState.findResultWhere().setText(wherevalue);
                               
//System.out.println("this is lentgh of whatvalue "+ whatvalue.length());
                               
if (whatvalue.toString().length()>1) {
                                   
//String search = HelloWorld.myState.findWhat().getText().toString();
                                   
String search =whatvalue;
                                   
HelloWorld.myState.setSearch(search);
                                   
HelloWorld.myState.Main_Search_where_Text="1";
                                   
HelloWorld.myState.Main_Search_Area_Text=wherevalue;
                                   
//System.out.println("atline 507 " +HelloWorld.myState.Main_Search_Area_Text);
                                   
//System.out.println("at line 508 "+HelloWorld.myState.Main_Search_where_Text);
                                   
//HelloWorld.myState.TopTabResults();
                                   
HelloWorld.myState.showForm("resultpage", null);
                                   
HelloWorld.myState.findResultWhere().setText(wherevalue);
                                   
HelloWorld.myState.findResultWhat().setText(whatvalue);
                               
}
                               
                               
else {
                                   
//HelloWorld.myState.findResultWhere().setText(wherevalue);
                                   
HelloWorld.myState.Main_Search_Area_Text=wherevalue;
                               
}
                               
try {
                                   
HelloWorld.myState.findResultWheresearchcontainer().removeAll();
                               
} catch (Exception e) {
                                   
// TODO: handle exception
                               
}
                               
                               
//HelloWorld.myState.findMain().refreshTheme();
                               
Display.getInstance().getCurrent().refreshTheme();

                           
}
                       
});
                        wherereturn
.addComponent(wherecontainers[i]);                                
                   
}
                   
               
}
           
} catch (Exception e) {
               
// TODO: handle exception
           
}


       
}
   
});
   

   
return wherereturn;

   
}
}


Shai Almog

unread,
Apr 25, 2013, 1:57:15 AM4/25/13
to codenameone...@googlegroups.com
I'm guessing that this is failing because of the myhash reference. Are you getting the same error message?

Vinay Gurram

unread,
Apr 25, 2013, 2:07:13 AM4/25/13
to codenameone...@googlegroups.com
But myhash is not final. How to solve that or is there any workaround? 

error line is : Warning: com.justdial.search.NewAutoSuggest$5$1: can't find enclosing method 'void resp(java.util.Hashtable)' in class com.justdial.search.NewAutoSuggest$5 I am also attaching the error file. 
error (36).txt

Vinay Gurram

unread,
Apr 25, 2013, 2:10:15 AM4/25/13
to codenameone...@googlegroups.com
I commented the myhash variable and it's related objects. I am still gettting the same error.

Shai Almog

unread,
Apr 25, 2013, 2:38:40 AM4/25/13
to codenameone...@googlegroups.com
Are you sure its the same code?
In the listing above the code is final. If you comment out the entire addActionListener section does it compile then?
I'm assuming its some small reference to the enclosing method that is escaping my eyes right now. Can you just move the whole action listener code to a class scope inner class (e.g.: class MyClass implements ActionListener) this will probably workaround the issue regardless of its cause.

Vinay Gurram

unread,
Apr 25, 2013, 3:49:10 AM4/25/13
to codenameone...@googlegroups.com
I have commented out the actionListener and it works fine. To be sure, I commented out the actionListener and just added a new Actionlistener syntax and no code in it, I am still getting the error.  

Vinay Gurram

unread,
Apr 25, 2013, 4:37:21 AM4/25/13
to codenameone...@googlegroups.com
Adding another class file like 

public  class ActionMyListener implements ActionListener {

public void actionPerformed(ActionEvent evt) {
// TODO Auto-generated method stub
System.out.println("This is second class file");
}
public static ActionMyListener getInstance(){
ActionMyListener abc = new ActionMyListener();
return abc;
}


}

and using it in the old class file like
ActionMyListener.getInstance().actionPerformed(new ActionEvent(wheretbn));

worked. But, I have 21 similar bugs. I guess its not a good idea to make 21 class files.  Can you please check the code of result_whereSuggest function and netWork function  that I posted earlier in this thread?.

Shai Almog

unread,
Apr 25, 2013, 12:17:56 PM4/25/13
to codenameone...@googlegroups.com
That is very odd. Having 21 class files will not cost in terms of size since an anonymous inner class effectively creates  another class file (without another source file). However it would be annoying.
If they don't give out an error you don't need to separate them to a separate file.

You can use classes that aren't public within the same class file or within the parent class rather than creating a separate file entirely.

I'm not exactly sure why a nested anonymous inner class will run into this issue.

Vinay Gurram

unread,
Apr 26, 2013, 5:33:07 AM4/26/13
to codenameone...@googlegroups.com
I wrote an actionListener for to handle the actionLIsteners . LIke this
public  class MyActionListener implements ActionListener {
   
   
private Hashtable localHashTable;
   
private int localInt;
   
public MyActionListener(int actionNumber, Hashtable myhash){
        localHashTable
= myhash;
        localInt
= actionNumber;
   
};

   
   
public void actionPerformed(ActionEvent evt) {
       
// TODO Auto-generated method stub

       
if (localInt==0) {
           
System.out.println("no action event becuase it is null");
       
} else {
           
switch (localInt) {
           
case 1:
           
{
               
System.out.println("you clicked "+localHashTable.get("citystate")+" Button.");
               
           
}
               
break;
           
           
default:
               
               
break;
           
}

       
}
       
System.out.println("Hey you");
       
   
}
   
   
public static MyActionListener getInstance(int avg,Hashtable abcd){
       
MyActionListener abc = new MyActionListener(avg,abcd);
       
       
return abc;
   
}


}

and added an actionListenere like this
citybtn.addActionListener(MyActionListener.getInstance(1,myhash));

That fixed my issue. I am getting a sign in error.

No errors.
Executing: java -jar SignatureTool.jar -a -C -s -p password MyApplication42.cod 2013-04-26 09:10:49:0276 : SignatureTool Started
Finding Files...
Loading Files: 0%
Loading Files: 100%
2013-04-26 09:10:50:0882 : SignatureTool Stopped
Executing: java -jar SignatureTool.jar -a -C -s -p password MyApplication42.cod 2013-04-26 09:12:49:0300 : SignatureTool Started
Finding Files...
Loading Files: 0%
Loading Files: 100%
2013-04-26 09:12:49:0549 : SignatureTool Stopped



error (2).txt

Shai Almog

unread,
Apr 26, 2013, 2:05:52 PM4/26/13
to codenameone...@googlegroups.com
You just have bad luck :-(

The signing issue is a bug with RIM where signing eventually times out after a while on their servers. Retry in an hour or so, the problem usually just fixes itself.

Vinay Gurram

unread,
Apr 27, 2013, 2:18:27 AM4/27/13
to codenameone...@googlegroups.com
"You just have bad luck :-(" are you referring to the ActionListener issue or constant errors?

After adding the sign in files, It completed building successfully. Thanks for the help.

Shai Almog

unread,
Apr 27, 2013, 3:07:39 AM4/27/13
to codenameone...@googlegroups.com
Good to hear. I was referring to the series of completely unrelated build issues.

fromyo...@gmail.com

unread,
Jun 1, 2014, 4:44:31 AM6/1/14
to codenameone...@googlegroups.com
Hi 
I'm using Netbeans with Codename One
I facing a problem when I'm using NativeInterface , The jar contains classes which is using Java 7, I placed the Jar inside of Android folder which is inside of Native folder..

But it is showing the warnings, when I change the Jar folder server Build says Cannot find Symbol so it is unable to see the file.. But when I place there 

The Error is attached Please let me know what are the ways to fix this, I tried to disable proguard but I didn't file right way, kindly let me know how to solve..

S.A.Arulvannan

Shai Almog

unread,
Jun 1, 2014, 12:50:24 PM6/1/14
to codenameone...@googlegroups.com, fromyo...@gmail.com
Hi,
pleas don't reopen old unrelated issues. Please create a new discussion.

Java 7 classes will not work on RIM. We translate RIM code to CLDC  which is a very small subset of Java 1.4.
Reply all
Reply to author
Forward
0 new messages