Page 1 of 1

Cannot build JCEF : Ident. GetJNIEnv()

PostPosted: Sun Nov 22, 2020 5:10 pm
by fmatz
Hi,

I cannot create JCEF https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding :

Severity Code Description Project Path File Line Suppression State
Error (active) E0020 identifier "GetJNIEnv" is undefined jcef ..\src\native ..\src\native\request_handler.cpp 67

JNIEnv* env = GetJNIEnv();
if (!env)
return false;


What can I do ?

Regards,
Friedhold

Re: Cannot build JCEF : Ident. GetJNIEnv()

PostPosted: Sun Nov 22, 2020 10:48 pm
by magreenblatt
You can apply this fix:

Code: Select all
 diff --git a/native/request_handler.cpp b/native/request_handler.cpp
index 5553662..a886338 100644
--- a/native/request_handler.cpp
+++ b/native/request_handler.cpp
@@ -64,7 +64,7 @@ bool RequestHandler::OnOpenURLFromTab(CefRefPtr<CefBrowser> browser,
                                       const CefString& target_url,
                                       WindowOpenDisposition target_disposition,
                                       bool user_gesture) {
-  JNIEnv* env = GetJNIEnv();
+  ScopedJNIEnv env;
   if (!env)
     return false;
 

Re: Cannot build JCEF : Ident. GetJNIEnv()

PostPosted: Mon Nov 23, 2020 4:37 am
by fmatz
Thank you and great,

this works now!

Best Greetings,
Friedhold

Re: Cannot build JCEF : Ident. GetJNIEnv()

PostPosted: Mon Nov 23, 2020 6:20 am
by pfrigge
I had the same problem. So thank you both, fmatz and magreenblatt!

I submitted a (not yet approved) post with basically the same question on a new thread some hours ago. Because yesterday when I searched for a solution this thread wasn't available yet or I overlooked it. Therefore my thread may be deleted or stay unapproved. Thanks again.

Re: Cannot build JCEF : Ident. GetJNIEnv()

PostPosted: Mon Nov 23, 2020 12:18 pm
by magreenblatt