Android jumps around in some devices












-1














I get an error when I run my app on some device emulators that is due to the code jumping around. In Galaxy S9, (tracing) the code jumps from



ordering = ... (above the switch statement)
directly into the switch statement to case 1:incompleteSearch
and then back to case 0:databaseAccess.getCursor_anagrams(term, filters, ordering);



where it errors out because term=""



I've tried cleaning and rebuilding with no difference.



private Cursor getCursor(int searchType) {
EditText et = findViewById(R.id.etEntry);
String term = et.getText().toString();

Spinner beginnings = findViewById(R.id.BeginsWith);
String begins = beginnings.getSelectedItem().toString();

Spinner endings = findViewById(R.id.EndsWith);
String ends = endings.getSelectedItem().toString();

Spinner sp = findViewById(R.id.MinLength);

if (!(searchType == 3)) {
term = term.replaceAll("[cv*0123456789.,^+-]", "");
et.setText(term);
}

String filters = makefilters(searchType);
ordering = getSortOrder();

// todo get from control, method
databaseAccess.open();
switch (searchType) {
case 0:
if (term != "")
return databaseAccess.getCursor_anagrams(term, filters, ordering);
else
incompleteSearch();
break;
case 1:
int count = sp.getSelectedItemPosition() + 1;
etTerm.setText("");
if (count > 1)
return databaseAccess.getCursor_ByLetterCount(count, filters, ordering);
else
incompleteSearch();
break;









share|improve this question
























  • What makes you say that the "code is jumping around"? I seriously doubt that
    – Tim Castelijns
    Nov 19 '18 at 15:55










  • When I trace the code in debug mode it goes to those lines.
    – Dana Bell
    Nov 19 '18 at 15:57










  • what makes you think that going to those lines means it is skipping the rest?
    – Tim Castelijns
    Nov 19 '18 at 15:58










  • difficult to reproduce that. add verbose logging to gain a grasp what is actually going on.
    – Martin Zeitler
    Nov 19 '18 at 16:34










  • I'm stepping through the code in debug mode.
    – Dana Bell
    Nov 19 '18 at 16:48
















-1














I get an error when I run my app on some device emulators that is due to the code jumping around. In Galaxy S9, (tracing) the code jumps from



ordering = ... (above the switch statement)
directly into the switch statement to case 1:incompleteSearch
and then back to case 0:databaseAccess.getCursor_anagrams(term, filters, ordering);



where it errors out because term=""



I've tried cleaning and rebuilding with no difference.



private Cursor getCursor(int searchType) {
EditText et = findViewById(R.id.etEntry);
String term = et.getText().toString();

Spinner beginnings = findViewById(R.id.BeginsWith);
String begins = beginnings.getSelectedItem().toString();

Spinner endings = findViewById(R.id.EndsWith);
String ends = endings.getSelectedItem().toString();

Spinner sp = findViewById(R.id.MinLength);

if (!(searchType == 3)) {
term = term.replaceAll("[cv*0123456789.,^+-]", "");
et.setText(term);
}

String filters = makefilters(searchType);
ordering = getSortOrder();

// todo get from control, method
databaseAccess.open();
switch (searchType) {
case 0:
if (term != "")
return databaseAccess.getCursor_anagrams(term, filters, ordering);
else
incompleteSearch();
break;
case 1:
int count = sp.getSelectedItemPosition() + 1;
etTerm.setText("");
if (count > 1)
return databaseAccess.getCursor_ByLetterCount(count, filters, ordering);
else
incompleteSearch();
break;









share|improve this question
























  • What makes you say that the "code is jumping around"? I seriously doubt that
    – Tim Castelijns
    Nov 19 '18 at 15:55










  • When I trace the code in debug mode it goes to those lines.
    – Dana Bell
    Nov 19 '18 at 15:57










  • what makes you think that going to those lines means it is skipping the rest?
    – Tim Castelijns
    Nov 19 '18 at 15:58










  • difficult to reproduce that. add verbose logging to gain a grasp what is actually going on.
    – Martin Zeitler
    Nov 19 '18 at 16:34










  • I'm stepping through the code in debug mode.
    – Dana Bell
    Nov 19 '18 at 16:48














-1












-1








-1







I get an error when I run my app on some device emulators that is due to the code jumping around. In Galaxy S9, (tracing) the code jumps from



ordering = ... (above the switch statement)
directly into the switch statement to case 1:incompleteSearch
and then back to case 0:databaseAccess.getCursor_anagrams(term, filters, ordering);



where it errors out because term=""



I've tried cleaning and rebuilding with no difference.



private Cursor getCursor(int searchType) {
EditText et = findViewById(R.id.etEntry);
String term = et.getText().toString();

Spinner beginnings = findViewById(R.id.BeginsWith);
String begins = beginnings.getSelectedItem().toString();

Spinner endings = findViewById(R.id.EndsWith);
String ends = endings.getSelectedItem().toString();

Spinner sp = findViewById(R.id.MinLength);

if (!(searchType == 3)) {
term = term.replaceAll("[cv*0123456789.,^+-]", "");
et.setText(term);
}

String filters = makefilters(searchType);
ordering = getSortOrder();

// todo get from control, method
databaseAccess.open();
switch (searchType) {
case 0:
if (term != "")
return databaseAccess.getCursor_anagrams(term, filters, ordering);
else
incompleteSearch();
break;
case 1:
int count = sp.getSelectedItemPosition() + 1;
etTerm.setText("");
if (count > 1)
return databaseAccess.getCursor_ByLetterCount(count, filters, ordering);
else
incompleteSearch();
break;









share|improve this question















I get an error when I run my app on some device emulators that is due to the code jumping around. In Galaxy S9, (tracing) the code jumps from



ordering = ... (above the switch statement)
directly into the switch statement to case 1:incompleteSearch
and then back to case 0:databaseAccess.getCursor_anagrams(term, filters, ordering);



where it errors out because term=""



I've tried cleaning and rebuilding with no difference.



private Cursor getCursor(int searchType) {
EditText et = findViewById(R.id.etEntry);
String term = et.getText().toString();

Spinner beginnings = findViewById(R.id.BeginsWith);
String begins = beginnings.getSelectedItem().toString();

Spinner endings = findViewById(R.id.EndsWith);
String ends = endings.getSelectedItem().toString();

Spinner sp = findViewById(R.id.MinLength);

if (!(searchType == 3)) {
term = term.replaceAll("[cv*0123456789.,^+-]", "");
et.setText(term);
}

String filters = makefilters(searchType);
ordering = getSortOrder();

// todo get from control, method
databaseAccess.open();
switch (searchType) {
case 0:
if (term != "")
return databaseAccess.getCursor_anagrams(term, filters, ordering);
else
incompleteSearch();
break;
case 1:
int count = sp.getSelectedItemPosition() + 1;
etTerm.setText("");
if (count > 1)
return databaseAccess.getCursor_ByLetterCount(count, filters, ordering);
else
incompleteSearch();
break;






java android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 16:17









Tim Castelijns

30.8k1287109




30.8k1287109










asked Nov 19 '18 at 15:53









Dana Bell

246




246












  • What makes you say that the "code is jumping around"? I seriously doubt that
    – Tim Castelijns
    Nov 19 '18 at 15:55










  • When I trace the code in debug mode it goes to those lines.
    – Dana Bell
    Nov 19 '18 at 15:57










  • what makes you think that going to those lines means it is skipping the rest?
    – Tim Castelijns
    Nov 19 '18 at 15:58










  • difficult to reproduce that. add verbose logging to gain a grasp what is actually going on.
    – Martin Zeitler
    Nov 19 '18 at 16:34










  • I'm stepping through the code in debug mode.
    – Dana Bell
    Nov 19 '18 at 16:48


















  • What makes you say that the "code is jumping around"? I seriously doubt that
    – Tim Castelijns
    Nov 19 '18 at 15:55










  • When I trace the code in debug mode it goes to those lines.
    – Dana Bell
    Nov 19 '18 at 15:57










  • what makes you think that going to those lines means it is skipping the rest?
    – Tim Castelijns
    Nov 19 '18 at 15:58










  • difficult to reproduce that. add verbose logging to gain a grasp what is actually going on.
    – Martin Zeitler
    Nov 19 '18 at 16:34










  • I'm stepping through the code in debug mode.
    – Dana Bell
    Nov 19 '18 at 16:48
















What makes you say that the "code is jumping around"? I seriously doubt that
– Tim Castelijns
Nov 19 '18 at 15:55




What makes you say that the "code is jumping around"? I seriously doubt that
– Tim Castelijns
Nov 19 '18 at 15:55












When I trace the code in debug mode it goes to those lines.
– Dana Bell
Nov 19 '18 at 15:57




When I trace the code in debug mode it goes to those lines.
– Dana Bell
Nov 19 '18 at 15:57












what makes you think that going to those lines means it is skipping the rest?
– Tim Castelijns
Nov 19 '18 at 15:58




what makes you think that going to those lines means it is skipping the rest?
– Tim Castelijns
Nov 19 '18 at 15:58












difficult to reproduce that. add verbose logging to gain a grasp what is actually going on.
– Martin Zeitler
Nov 19 '18 at 16:34




difficult to reproduce that. add verbose logging to gain a grasp what is actually going on.
– Martin Zeitler
Nov 19 '18 at 16:34












I'm stepping through the code in debug mode.
– Dana Bell
Nov 19 '18 at 16:48




I'm stepping through the code in debug mode.
– Dana Bell
Nov 19 '18 at 16:48












2 Answers
2






active

oldest

votes


















0














The app had two build variants and the only difference was the database source file and the app name.
The first variant worked fine, but I started having this problem when I tried the other build variant.



I got it to work (and trace) correctly by Rebuilding the Project (Build > Rebuild Project).






share|improve this answer





























    0














    When compiling java bytecode to dex bytecode, Android Studio dexer may apply some optimizations and mangle all the return statements into one, and when you debug the code, it may look like it is randomly jumping between your case statements. It is not and you should not worry about it.



    You say your "term" variable is "", so Android Studio is probably adding a return statement in incompleteSearch().



    If the code installed on the device were to be somehow outdated when compared to the one you see on Android Studio, for example when you modify the code, attach the debugger to the old version you already installed, and step into that function, a popup will show saying "Source code does not match bytecode"






    share|improve this answer





















    • At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
      – Dana Bell
      Nov 21 '18 at 15:30











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378295%2fandroid-jumps-around-in-some-devices%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The app had two build variants and the only difference was the database source file and the app name.
    The first variant worked fine, but I started having this problem when I tried the other build variant.



    I got it to work (and trace) correctly by Rebuilding the Project (Build > Rebuild Project).






    share|improve this answer


























      0














      The app had two build variants and the only difference was the database source file and the app name.
      The first variant worked fine, but I started having this problem when I tried the other build variant.



      I got it to work (and trace) correctly by Rebuilding the Project (Build > Rebuild Project).






      share|improve this answer
























        0












        0








        0






        The app had two build variants and the only difference was the database source file and the app name.
        The first variant worked fine, but I started having this problem when I tried the other build variant.



        I got it to work (and trace) correctly by Rebuilding the Project (Build > Rebuild Project).






        share|improve this answer












        The app had two build variants and the only difference was the database source file and the app name.
        The first variant worked fine, but I started having this problem when I tried the other build variant.



        I got it to work (and trace) correctly by Rebuilding the Project (Build > Rebuild Project).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 17:34









        Dana Bell

        246




        246

























            0














            When compiling java bytecode to dex bytecode, Android Studio dexer may apply some optimizations and mangle all the return statements into one, and when you debug the code, it may look like it is randomly jumping between your case statements. It is not and you should not worry about it.



            You say your "term" variable is "", so Android Studio is probably adding a return statement in incompleteSearch().



            If the code installed on the device were to be somehow outdated when compared to the one you see on Android Studio, for example when you modify the code, attach the debugger to the old version you already installed, and step into that function, a popup will show saying "Source code does not match bytecode"






            share|improve this answer





















            • At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
              – Dana Bell
              Nov 21 '18 at 15:30
















            0














            When compiling java bytecode to dex bytecode, Android Studio dexer may apply some optimizations and mangle all the return statements into one, and when you debug the code, it may look like it is randomly jumping between your case statements. It is not and you should not worry about it.



            You say your "term" variable is "", so Android Studio is probably adding a return statement in incompleteSearch().



            If the code installed on the device were to be somehow outdated when compared to the one you see on Android Studio, for example when you modify the code, attach the debugger to the old version you already installed, and step into that function, a popup will show saying "Source code does not match bytecode"






            share|improve this answer





















            • At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
              – Dana Bell
              Nov 21 '18 at 15:30














            0












            0








            0






            When compiling java bytecode to dex bytecode, Android Studio dexer may apply some optimizations and mangle all the return statements into one, and when you debug the code, it may look like it is randomly jumping between your case statements. It is not and you should not worry about it.



            You say your "term" variable is "", so Android Studio is probably adding a return statement in incompleteSearch().



            If the code installed on the device were to be somehow outdated when compared to the one you see on Android Studio, for example when you modify the code, attach the debugger to the old version you already installed, and step into that function, a popup will show saying "Source code does not match bytecode"






            share|improve this answer












            When compiling java bytecode to dex bytecode, Android Studio dexer may apply some optimizations and mangle all the return statements into one, and when you debug the code, it may look like it is randomly jumping between your case statements. It is not and you should not worry about it.



            You say your "term" variable is "", so Android Studio is probably adding a return statement in incompleteSearch().



            If the code installed on the device were to be somehow outdated when compared to the one you see on Android Studio, for example when you modify the code, attach the debugger to the old version you already installed, and step into that function, a popup will show saying "Source code does not match bytecode"







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 19 '18 at 17:47









            Reaper

            488




            488












            • At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
              – Dana Bell
              Nov 21 '18 at 15:30


















            • At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
              – Dana Bell
              Nov 21 '18 at 15:30
















            At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
            – Dana Bell
            Nov 21 '18 at 15:30




            At the point of the "jumping" that message was not displayed, but tracing elsewhere I did get that warning so I suspected that was the problem.
            – Dana Bell
            Nov 21 '18 at 15:30


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378295%2fandroid-jumps-around-in-some-devices%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter