Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Operation Progress Listener #1787

Merged
merged 4 commits into from
Dec 24, 2018
Merged

Conversation

farnabaz
Copy link
Contributor

@farnabaz farnabaz commented Oct 4, 2018

Its good to have progressListener on every IMAPOperationOperation, but its sad to see this feature is not functioning and using setProgressListener cause app crash
After digging inside mailcore2, Finally I could fix this issue

Fix #1586

@dinhvh dinhvh merged commit c4a2e84 into MailCore:master Dec 24, 2018
babbage pushed a commit to babbage/mailcore2 that referenced this pull request Jan 7, 2019
* feat(IMAPSession): add support for moveMessagesOpeation to java library
* feat: support fieldClass in getObjectField
* fix: use global reference of progress listener
pass progress values to callback function
@2h4u
Copy link

2h4u commented Oct 19, 2020

@farnabaz Hey, I just compiled a new .aar of the current master branch (commit: 694dd49) but unfortunately my android app still crashes as soon as I try to set a connection logger with the following error:

    JNI DETECTED ERROR IN APPLICATION: fid == null
    java_vm_ext.cc:542]     in call to GetObjectField
    java_vm_ext.cc:542]     from void com.libmailcore.IMAPSession.setupNativeConnectionLogger()
(...)
    thread.cc:2166] No pending exception expected: java.lang.NoSuchFieldError: no "J" field "connectionLogger" in class "Lcom/libmailcore/IMAPSession;" or its superclasses
    thread.cc:2166]   at void com.libmailcore.IMAPSession.setupNativeConnectionLogger() (IMAPSession.java:-2)
    thread.cc:2166]   at void com.libmailcore.IMAPSession.setConnectionLogger(com.libmailcore.ConnectionLogger) (IMAPSession.java:95)

I know it is a long time ago but can you remember how you compiled your .aar ? Like which NDK version, which SDK version, any modifications to the build.sh file and so on?

Any help would be greatly appreciated.

@farnabaz
Copy link
Contributor Author

farnabaz commented Nov 3, 2020

@2h4u Hey, Sorry for the late response. I was compiling this using my old laptop and as I remember it does not work with new NSK versions. I will check out NDK version and let you know

@2h4u
Copy link

2h4u commented Nov 4, 2020

@farnabaz Hey thanks for replying 😄
I was able to compile mailcore2 with this NDK: http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip
and the Android SDK with API level 16

Everything was working fine but as soon as I tried to set a connection logger I got the error I described in my first post (#1787 (comment))

I thank you in advance for looking into this again

@farnabaz
Copy link
Contributor Author

farnabaz commented Nov 4, 2020

@2h4u Sorry, I don't remeber much about it. Have you look at #1482? The main idea of this PR cames for this issue.

@2h4u
Copy link

2h4u commented Nov 4, 2020

@farnabaz no worries 😄
yeah i had a look at the issue, then I saw your PR and thought that it might work if i compile the current master into an .aar but unfortunately the new .aar still crashed. Have you actually managed to set a connection logger with your self compiled .aar?
If yes, would it be possible that you share the .aar with the community? I'm sure the community would appreciate it 😃

@farnabaz
Copy link
Contributor Author

farnabaz commented Nov 4, 2020

If yes, would it be possible that you share the .aar with the community? I'm sure the community would appreciate it 😃

Gladly 🙂

Here is the .aar that I used for my project.

https://drive.google.com/file/d/1giSDOqpm6dpJ5i1W-93mR76Y-7SKgUys/view?usp=sharing

The generation date was the exact date of this PR. Oct 5, 2018.

@2h4u
Copy link

2h4u commented Nov 4, 2020

Thanks for sharing!
Unfortunately your .aar produces on my android app the same crash-error as soon as I try to set the connection logger IMAPSession.setConnectionLogger():

 java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectField called with pending exception java.lang.NoSuchFieldError: no "J" field "connectionLogger" in class "Lcom/libmailcore/IMAPSession;" or its superclasses
 java_vm_ext.cc:570]   at void com.libmailcore.IMAPSession.setupNativeConnectionLogger() (IMAPSession.java:-2)
 java_vm_ext.cc:570]   at void com.libmailcore.IMAPSession.setConnectionLogger(com.libmailcore.ConnectionLogger) (IMAPSession.java:95)

Did you manage to set the connectionLogger of the IMAPSession or did you just use the .aar to set the progressListener ?

@farnabaz
Copy link
Contributor Author

farnabaz commented Nov 4, 2020

@2h4u If you are getting the same error that for sure I didn't use connectionLogger back then.

I was looking at changes of this PR and I just realized something that might help. Could you replace "J" with "Lcom/libmailcore/ConnectionLogger" in

     jobject javaLogger = getObjectField(env, obj, "connectionLogger", "J"); 

and check the result. You can find files in cahnges tab

@2h4u
Copy link

2h4u commented Nov 6, 2020

@farnabaz Thanks for the tipp!
I will try it out next week and report back, thanks again and have a nice weekend! 🙂

@2h4u
Copy link

2h4u commented Nov 10, 2020

@farnabaz I finally managed to try it out but unfortunately it still crashes, this time with the following error:

java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectField called with pending exception java.lang.NoSuchFieldError: no type "Lcom/libmailcore/ConnectionLogger" found and so no field "connectionLogger" could be found in class "Lcom/libmailcore/IMAPSession;" or its superclasses
java_vm_ext.cc:570]   at void com.libmailcore.IMAPSession.setupNativeConnectionLogger() (IMAPSession.java:-2)
java_vm_ext.cc:570]   at void com.libmailcore.IMAPSession.setConnectionLogger(com.libmailcore.ConnectionLogger) (IMAPSession.java:95)

I tried to investigate the problem but my JNI skills are pretty much non existent, so I'm having a hard time figuring out what the problem is. Nevertheless, thank you for you time and effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] NoSuchFieldError excpetion when setProgressListener()
3 participants