Acknowledged

bug: compilation fails because of code inside removed has block

I get a compilation error:

ERROR: fenix5: AppView.mc:38,4: Could not find method onTimerEvent on object $.AppView

I don't think I am supposed to get. SDK: 7.4.3, device: fenix5 that doesn't support ActivityRecording.Session.setTimerEventListener , and this is my relevant part of the code:

(Sorry for the unformatted code, can't post code! see: https://forums.garmin.com/developer/connect-iq/f/discussion/389914/meta-forum-returning-lots-of-errors-today-e-g-parens-links-and-images-cause-problems )

and monkey.jungle:

project.optimization = 3z
fenix5.excludeAnnotations=$(fenix5.excludeAnnotations);session_timer_event_listener
When I remove the (:session_timer_event_listener) then it compiles, but why do I need to have an empty function just to be able to compile something that can be never called?
Note that the block for the has is correctly removed ("never called is not logged"). This is my command line for compilation:
java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar ~/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-7.4.3-2024-12-11-90ec25e45/bin/monkeybrains.jar -o bin/App.prg -f App/monkey.jungle -y garmin/garmin_developer_key.der -d fenix5_sim -w
Parents
  • The recommendation that was given by development was to take the following block of code and put it into a separate function that can be eliminated.

    if (ActivityRecording.Session has :setTimerEventListener) {
          System.println("never called");
          session.setTimerEventListener(method(:onTimerEvent)); // error in this line
    }

Comment
  • The recommendation that was given by development was to take the following block of code and put it into a separate function that can be eliminated.

    if (ActivityRecording.Session has :setTimerEventListener) {
          System.println("never called");
          session.setTimerEventListener(method(:onTimerEvent)); // error in this line
    }

Children
No Data