简体   繁体   中英

Android - Evernote API getContent() GC_CONCURRENT

I try to get the content of a note from the Evernote Android API.

I have successfully authenticated with the service and I can perform "find" operations without any problems.

But when I try to run the following code, it never returns and LogCat floods with "GC_CONCURRENT freed 2032K, 15% free 20186K/23623K, paused 12ms+10ms, total 166ms".

I would be glad if someone could help me! I've searched this site and google but didn't find anything! Thank you for your help!

My Code:

EvernoteSession session = getEvernoteSession(ctx);

    try {
        session.getClientFactory().createNoteStoreClient().getNote(noteID, true, false, false, false, new OnClientCallback<Note>() {

            @Override
            public void onSuccess(Note data) {
                receiver.newData(data.getContent().toString());
                data = null;
                System.gc();
            }

            @Override
            public void onException(Exception exception) {
                receiver.newData(ctx.getString(R.string.error_while_receiving_note));
            } 
        });
    } catch (TTransportException e) {
        receiver.newData(ctx.getString(R.string.error_while_receiving_note));
    }

First, make sure that the GC messages are coming from your process. I like to use

adb logcat -v threadtime

to see the pid and tid associated with each message. Use

adb shell ps

to check that the GCing pid is your app.

Second, you'll want to see what exactly is allocating all that memory. The best tool for that is the DDMS Allocation Tracker , available standalone or integrated into Eclipse+ADT. It will show you the last 512 allocations performed by the selected application, so if you run it while the GC messages are flying you should be able to see what's being allocated and by which piece of code.

First I need to mention that I'm an Evernote employee. I recently developed the new version of the Android SDK and noticed a similar bug like you did. The reason was that there was an issue in the underlying byte store, which badges data and sends it out to the server.

This bug is fixed with the new version 2.0.0: https://github.com/evernote/evernote-sdk-android

Feel free to create an issue at Github, if the issue still exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM