3 Replies Latest reply on Feb 24, 2015 10:56 AM by Jon Tara

    App error: uninitialized constant Rho::Log

    Tran Tho

      Hi guys,

       

      Below is my application.rb, Im trying to test Log API and Application Init

       

      require 'rho'
      require 'rho/rhoapplication'
      
      class AppApplication < Rho::RhoApplication
        def initialize
          # Tab items are loaded left->right, @tabs[0] is leftmost tab in the tab-bar
          # Super must be called *after* settings @tabs!
          @tabs = nil
          #To remove default toolbar uncomment next line:
          #@@toolbar = nil
          super
      
      
          # Uncomment to set sync notification callback to /app/Settings/sync_notify.
          # SyncEngine::set_objectnotify_url("/app/Settings/sync_notify")
          SyncEngine.set_notification(-1, "/app/Settings/sync_notify", '')
      
      
          Rho::Log.info("App initialized", "Initial")
        end
      end
      

       

       

      But I got this in rholog.txt:

      I/APP     (  821): I 02/23/2015 20:58:31:381 0000034a                  APP| Application initialize failed: #<NameError: uninitialized constant Rho::Log>;Trace: lib/rho/rho.rb:1383:in `const_missing'

      I/APP     (  821): apps/app/application.rb:17:in `initialize'

        • Re: App error: uninitialized constant Rho::Log
          Jon Tara

          Try taking out line 1, since it's not needed. Otherwise, I see nothing wrong with your code.

           

          What version of Rhodes are you using?

           

          I happen to be working on a new project, and so my application.rb is still very small. Here it is below in it's entirety, and the logging works just fine.

           

          If it isn't due to line 1, you have a problem somewhere else. Maybe your build.yml. Do you get any error messages when you build?

           

          Parenthesis for parameter lists are optional in Ruby. So, the only reason I don't use them below is because I don't like them.

           

          require 'rho/rhoapplication'
          class AppApplication < Rho::RhoApplication
            def initialize
              class_name = self.class.name
              Rho::Log.info "--> #{__method__}", class_name
              Rho::Log.info "Ruby version: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}", class_name
              Rho::Log.info "$: = #{$:}", class_name
              # Tab items are loaded left->right, @tabs[0] is leftmost tab in the tab-bar
              # Super must be called *after* settings @tabs!
              @tabs = nil
              @@toolbar = nil    # remove the default native toolbar
              super
            end
          end
          
            • Re: App error: uninitialized constant Rho::Log
              Tran Tho

              Everything is fine when I tried to install rhodes 5.0.2 on Mac (virtualbox), but it still error when run on Linux Ubuntu, cus' its just rhodes 3.5

              I also tried to install rhodes 5 on Ubuntu by build gem from github, but no luck

               

              Is there anybody installed successfully rhodes 5 on Linux?

                • Re: App error: uninitialized constant Rho::Log
                  Jon Tara

                  Rho::Log is a 4.x+ API. For older Rhodes you have to use old RhoLog API.

                   

                  Use the documentation that matches the Rhodes you are using - there is a drop-down in the upper right-hand corner.

                   

                  But I wouldn't recommend using Rhodes 3.5 at this time!

                   

                  If you are creating a new project, I would Use 5.0.25. I'm using "5.0.30" myself (or whatever SP3 is going to be called). It's the only thing you can create 64-bit iOS with.

                   

                  If you need to build for iOS anyway (do you?) just build on Mac. Mac is a great platform for building Android as well. You will need a Windows machine or VM if you are building for Microsoft platforms.