Android Question Variable 'label_name' was not initialized. (warning #11)

Discussion in 'Android Questions' started by Alessandro71, Jan 1, 2019.

  1. Alessandro71

    Alessandro71 Member Licensed User

    I have several labels defined in the same .bal layout file.
    All of them are declared in the same activity, like:

    Code:
    Private Lbl_EOT_TemplateCont As Label
    Private Lbl_EOT_Logo As Label
    Private Lbl_EOT_DateCont As Label
    but only one of them, namely Lbl_EOT_Logo gets flagged in the above lines with the error:

    Variable 'Lbl_EOT_Logo' was not initialized. (warning #11)

    Project compiles fine and runs with no issues: label is perfectly working (in this case it's a BitmapDrawable)
     
  2. DonManfred

    DonManfred Expert Licensed User

    Hard to help without seeing your project or at least all relevant code.
    Try to reproduce it in a small project and upload this project.
     
  3. Alessandro71

    Alessandro71 Member Licensed User

    that's an interesting test
    since project is really big, i tried stripping everything to have a minimal project, and the error goes away...
    now the hard part: which seemingly unrelated code affects this one?
     
  4. Alessandro71

    Alessandro71 Member Licensed User

    No, I’m in release mode, and the error message is shown in the logs window, without even compiling
     
  5. stevel05

    stevel05 Expert Licensed User

    Do you have a second instance of Lbl_EOT_Logo anywhere in your code as a local Label variable, a sub or a module maybe?
     
  6. mangojack

    mangojack Well-Known Member Licensed User

    On the odd occasion , I have had a similar problem.

    Deleting the view from Designer and saving layout, and any global declaration and saving project .. then recreating the view
    seemed to solve this.
     
  7. klaus

    klaus Expert Licensed User

    This may happen when you add the declaration in the code before adding or naming the view in the Designer.
    Is the spelling OK?
    When you change the name in the Designer without pressing Return, this can happen too.
     
    mangojack likes this.
  8. Alessandro71

    Alessandro71 Member Licensed User

    negative
     
  9. Alessandro71

    Alessandro71 Member Licensed User

    negative
    i've even tried changing order of both declaration and views in designer
     
  10. Alessandro71

    Alessandro71 Member Licensed User

    negative
    i've renamed it, recreated it, without any different outcome
    if i find all references (F7) it's correctly found in the designer layout file

    same with 2 other labels in 2 different .bal files
     
  11. klaus

    klaus Expert Licensed User

    Can you post your project as a zip file, so we could have a look at it.
     
  12. malcolm_FM4E

    malcolm_FM4E New Member

    Hi I just resolved the same problem by using [Tools] - [Generate Members] in the Visual Designer and selecting the variables and clicking [Generate Members]. HTH.
     
  13. Alessandro71

    Alessandro71 Member Licensed User

    no luck for me...
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice