1

I'm under Android Studio, and I'm trying to debug my app.

So I put 4 breakpoints in different places (see my code below), number 1 and 4 are called but not 2 and 3. It's been a day I search why but I have no clue. (It actually happens to a lot of other breakpoints).

I tried to delete the line at breakpoint 3 (which call later breakpoint 4) to see if it was actually called, and yes if I delete it nothing happens (breakpoint 4 is never called). Does anybody knows why ? Am I missing something ?

Here is my code :

AuthenticationActivity.java

checkAccount(){
    tokenGetter = new TokenGetter();
    tokenGetter.setParameter(accountManagerFuture, accounts[0]);
    tokenGetter.execute(); //BREAKPOINT 1
}

private class TokenGetter extends AsyncTask{

        AccountManagerFuture<Bundle> accountManagerFuture;
        Account account;

        public void setParameter(AccountManagerFuture<Bundle> accountManagerFuture, Account account) {
            this.accountManagerFuture = accountManagerFuture;
            this.account = account;
        }

        @Override
        protected Object doInBackground(Object[] objects) {
            Bundle b = null;
            try {
                b = accountManagerFuture.getResult(2000, TimeUnit.MILLISECONDS); //BREAKPOINT 2
            } catch (Exception e) {
                //e.printStackTrace();
            }
            return b;
        }

        @Override
        protected void onPostExecute(Object b) {
            if(b != null)
            {
                TOKEN = ((Bundle)b).get(AccountManager.KEY_AUTHTOKEN).toString();
                accountManager.setAuthToken(account, accountType,TOKEN);
            }
            profileDataFactory = new ProfileDataFactory();
            profileDataFactory.setParameters(getApplicationContext(), "users/me", ReceiveDataService.PROFILE); //BREAKPOINT 3
        }
    }

ReceiveDataService.java

int responseCode = urlConnection.getResponseCode(); //BREAKPOINT 4
if (responseCode != 200) {
    if(responseCode == 401) {
         throw new Exception(TOKEN_EXPIRED);
    } else {
         if (BuildConfig.DEBUG) Log.e(TAG,"Status Error CODE : " + responseCode);
         throw new Exception(REQUEST_FAILED);
    }
}
ilansas
  • 5,899
  • 6
  • 21
  • 27
  • I'm adding some new infos just in case. The debugger is not working in other points in the app (so I can't use debugger anymore), the debugger doesn't stop at breakpoints... I tried do debug my app on a different computer and it's the same. I was so wondering if it wasn't a parameter or a property that I activated by accident and stays in a property file in the project and that could prevent it from working ? – ilansas Feb 03 '15 at 15:03
  • Ok, the bug is on Galaxy S5 under Lollipop. The bug has been reported here : http://stackoverflow.com/questions/27940583/galaxy-s5-lollipop-not-all-breakpoints-stop-execution-under-android-studio-deb and here : https://code.google.com/p/android/issues/detail?id=97748 – ilansas Feb 05 '15 at 18:39

0 Answers0