1

please i get this errror on logcat when i use restclient to get a list. it works on desktop just after deploymnet to android

java.lang.NoSuchMethodException: ...dto.Meeting.()

its pops up more than the number of record i have in my list

WARNING: Failed to create object of type class .Meeting from the following json object {"id":1,"topic":"leksyde","description":"123e4","location":"7623","longitude":"45","latitude":"10","category":null,"datetime":"9839823"}

    primary.setShowTransitionFactory(BounceInRightTransition::new);

          RestClient restClient = RestClient.create()
                    .method("GET")
                    .host(LISTOFMEETINGS);

            // create a custom Converter that is able to parse the response into a list of objects
            InputStreamIterableInputConverter<Meeting> converter = new ItemsIterableInputConverter<>(Meeting.class);
            // retrieve a list from the DataProvider
          GluonObservableList<Meeting>    data = DataProvider.retrieveList(restClient.createListDataReader(converter));
            
          
              data.initializedProperty().addListener((obs, ov, nv) -> {
                  if (nv) {
                      for (Meeting meet: data) {
                          meetingslv.setItems(meet);
                      }
                  }
              });

meeting.java

public class Meeting {

    private  IntegerProperty id = new SimpleIntegerProperty();
    private  StringProperty topic = new SimpleStringProperty();
    private  StringProperty description = new SimpleStringProperty();
    private  StringProperty location = new SimpleStringProperty();
    private  StringProperty longitude = new SimpleStringProperty();
    private  StringProperty latitude = new SimpleStringProperty();
    private  StringProperty datetime = new SimpleStringProperty();
    private  StringProperty category = new SimpleStringProperty();

    

     public Meeting() {
    }
     
      public Meeting(int id, String topic, String description, String location, String longitude, String latitude, String datetime, String category) {
        this.id = new SimpleIntegerProperty(id);;
        this.topic = new SimpleStringProperty(topic);
        this.description = new SimpleStringProperty(description);
        this.location = new SimpleStringProperty(location) ;
        this.longitude = new SimpleStringProperty(longitude);
        this.latitude = new SimpleStringProperty(latitude);
        this.datetime = new SimpleStringProperty(datetime);
        this.category = new SimpleStringProperty(category);
    }
     
     
    
    
    public int getId() {
        return id.get();
    }

    public IntegerProperty IdProperty() {
        return id;
    }

    public void setId(int id) {
        this.id.set(id);
    }

    public String getTopic() {
        return topic.get();
    }

    public StringProperty TopicProperty() {
        return topic;
    }

    public void setTopic(String id) {
        this.topic.set(id);
    }

    public String getDescription() {
        return description.get();
    }

    public StringProperty DescriptionProperty() {
        return description;
    }

    public void setDescription(String id) {
        this.description.set(id);
    }

    public String getLocation() {
        return location.get();
    }

    public StringProperty LocationProperty() {
        return location;
    }

    public void setLocation(String id) {
        this.location.set(id);
    }

    public String getLongitude() {
        return longitude.get();
    }

    public StringProperty LongitudeProperty() {
        return longitude;
    }

    public void setLongitude(String id) {
        this.longitude.set(id);
    }

    public String getLatitude() {
        return latitude.get();
    }

    public StringProperty LatitudeProperty() {
        return latitude;
    }

    public void setLatitude(String id) {
        this.latitude.set(id);
    }

    public String getDatetime() {
        return datetime.get();
    }

    public StringProperty DatetimeProperty() {
        return datetime;
    }

    public void setDatetime(String id) {
        this.datetime.set(id);
    }

    public String getCategory() {
        return category.get();
    }

    public StringProperty CategoryProperty() {
        return category;
    }

    public void setCategory(String id) {
        this.category.set(id);
    }

   

}

this is the list i am trying to parse to the listview [enter link description here]1

leksyde
  • 45
  • 6
  • 1
    Did you run `mvn gluonfx:runagent` before building the native image? – José Pereda Jun 04 '22 at 20:32
  • No i did not. do i have to run it everytime i add a new class? also does this matter if i run with '-Pandroid' since i have the problem on android. – leksyde Jun 04 '22 at 21:04
  • @JoséPereda i ran runagent as suggesting still getting the same error com.gluonhq.connect.converter.JsonConverter readFromJson – leksyde Jun 04 '22 at 21:27
  • You can run it once on Linux. Later on only if you add or modify classes that would be used with reflection. – José Pereda Jun 04 '22 at 21:27
  • Note that widen running `runagent ` you have to explore all scenarios , so all possible uses of reflection are discovered. – José Pereda Jun 04 '22 at 21:30
  • this worked after running `runagent` thanks @JoséPereda – leksyde Jun 08 '22 at 17:49
  • @JoséPereda please help look at this issue i have packaging for ios [link] (https://stackoverflow.com/questions/72675365/error-occurred-during-initialization-of-vm-agent-library-failed-to-init-native )[link] – leksyde Jun 19 '22 at 08:45

0 Answers0