<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QApplication was not created in the main() thread. Android + calling java]]></title><description><![CDATA[<p dir="auto">I am getting that warning QApplication was not created in the main() thread.</p>
<p dir="auto">The app is C++ calling some java functions, all encapsulated in a class extending org.qtproject.qt5.android.bindings.QtActivity</p>
<p dir="auto">I am already creating the QApplication in the main() function so I see no way to fix that.</p>
<p dir="auto">Until now all was running fine anyway but with Android 5 the app does not start. The error is not explicitly there but later there's an exception</p>
<p dir="auto">bq. java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()</p>
<p dir="auto">when calling QAndroidJniEnvironment::RegisterNatives. that souns very likely to be related.</p>
<p dir="auto">Has anyone experienced something similar? (I've seen similar threads but not one related to android + calling java)</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/48322/qapplication-was-not-created-in-the-main-thread-android-calling-java</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 16:10:03 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/48322.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Nov 2014 13:29:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QApplication was not created in the main() thread. Android + calling java on Thu, 20 Nov 2014 17:03:11 GMT]]></title><description><![CDATA[<p dir="auto">I have written an example program that can call Java from C++ and C++ from Java's UI thread. You may take a look:</p>
<p dir="auto"><a href="https://github.com/benlau/qtandroidexamplecode/tree/master/qtandroidrunner" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/benlau/qtandroidexamplecode/tree/master/qtandroidrunner</a></p>
]]></description><link>https://forum.qt.io/post/251728</link><guid isPermaLink="true">https://forum.qt.io/post/251728</guid><dc:creator><![CDATA[benlau]]></dc:creator><pubDate>Thu, 20 Nov 2014 17:03:11 GMT</pubDate></item></channel></rss>