Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. NFC on QT using JNI
QtWS25 Last Chance

NFC on QT using JNI

Scheduled Pinned Locked Moved Mobile and Embedded
androidnfcjni
7 Posts 2 Posters 3.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Atr0n
    wrote on 21 Mar 2015, 21:29 last edited by Atr0n
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Mar 2015, 21:48 last edited by
      #2

      Hi and welcome to devnet,

      The patch is currently in the dev branch so unless it gets reverted it should be in 5.5. If you would like to base your code on it then you can build Qt yourself using that branch.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Atr0n
        wrote on 21 Mar 2015, 22:07 last edited by Atr0n
        #3

        Hi SGaist,
        I've read a lot of your post since I started with Qt one and a half year ago. I'll try to compiled on ubuntu.
        I'll post again me results.
        Thanks,

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Atr0n
          wrote on 22 Mar 2015, 12:09 last edited by
          #4

          While compiling there are too many errors... So I think I'm gonna wait until Qt 5.5 is released.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Atr0n
            wrote on 18 Apr 2015, 14:38 last edited by Atr0n
            #5

            Well, just installed the new 5.5 beta version and still no luck... Now my app crash.
            If anyone has some advice to make this run, it will be appreciated!
            Regards,

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 18 Apr 2015, 23:07 last edited by
              #6

              Do you have a backtrace of the crash ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Atr0n
                wrote on 20 Apr 2015, 21:02 last edited by
                #7

                Hi, sorry for the delay!
                Here they are the first lines from the debugger:

                Starting remote process.I/art     ( 2684): Late-enabling -Xcheck:jni
                I/LoadedApk( 2684): No resource references to update in package common
                I/LoadedApk( 2684): No resource references to update in package com.cyngn.hexo
                W/ResourceType( 2684): For resource 0x01030224, entry index(548) is beyond type entryCount(9)
                W/ResourceType( 2684): For resource 0x01030224, entry index(548) is beyond type entryCount(9)
                I/Qt      ( 2684): qt start
                D/        ( 2684): (null):0 ((null)): QML debugging is enabled. Only use this in a safe environment.
                W/Qt A11Y ( 2684): Could not activate platform accessibility.
                D/OpenGLRenderer( 2684): Render dirty regions requested: true
                D/Atlas   ( 2684): Validating map...
                I/Adreno-EGL( 2684): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.1.C2.05.00.00.046.002_msm8974_LA.BF.1.1.1.C2__release_AU ()
                I/Adreno-EGL( 2684): OpenGL ES Shader Compiler Version: E031.25.03.00
                I/Adreno-EGL( 2684): Build Date: 01/06/15 Tue
                I/Adreno-EGL( 2684): Local Branch: mybranch6793908
                I/Adreno-EGL( 2684): Remote Branch: quic/LA.BF.1.1.1.c2
                I/Adreno-EGL( 2684): Local Patches: NONE
                I/Adreno-EGL( 2684): Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.1.C2.05.00.00.046.002 +  NOTHING
                I/OpenGLRenderer( 2684): Initialized EGL, version 1.4
                D/OpenGLRenderer( 2684): Enabling debug mode 0
                D/libNFCtest.so( 2684): ../NFCtest/nfcintent.cpp:20 (void NFCIntent::init()): false
                I/Timeline( 2684): Timeline: Activity_idle id: android.os.BinderProxy@31a9db3f time:25527170
                F/art     ( 2684): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception 'java.lang.RuntimeException' thrown in unknown throw location
                F/art     ( 2684): art/runtime/check_jni.cc:65]     in call to NewGlobalRef
                F/art     ( 2684): art/runtime/check_jni.cc:65] "QtThread" prio=5 tid=15 Runnable
                F/art     ( 2684): art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x12d2f0e0 self=0xa172f400
                F/art     ( 2684): art/runtime/check_jni.cc:65]   | sysTid=2704 nice=0 cgrp=apps sched=0/0 handle=0xa24ed480
                F/art     ( 2684): art/runtime/check_jni.cc:65]   | state=R schedstat=( 46736358 42323642 107 ) utm=4 stm=0 core=0 HZ=100
                F/art     ( 2684): art/runtime/check_jni.cc:65]   | stack=0xa1b55000-0xa1b57000 stackSize=1012KB
                F/art     ( 2684): art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #00 pc 00004640  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #01 pc 00002e8d  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #02 pc 0023ee95  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #03 pc 0022432f  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #04 pc 000af913  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #05 pc 000b004d  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #06 pc 000b315d  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1284)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #07 pc 000b43c5  /system/lib/libart.so (art::CheckJNI::NewGlobalRef(_JNIEnv*, _jobject*)+20)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #08 pc 001b38ff  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Core.so (QJNIObjectPrivate::QJNIObjectPrivate(_jobject*)+82)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #09 pc 001b3ef5  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Core.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #10 pc 001b5fb1  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Core.so (QJNIObjectPrivate::getStaticObjectField(char const*, char const*, char const*)+48)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #11 pc 000194d1  /data/data/org.qtproject.nfc/qt-reserved-files/plugins/platforms/android/libqtforandroid.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #12 pc 0001ce53  /data/data/org.qtproject.nfc/qt-reserved-files/plugins/platforms/android/libqtforandroid.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #13 pc 000bfc55  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Quick.so (QSGRenderLoop::instance()+76)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #14 pc 000d6343  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Quick.so (QQuickWindowPrivate::init(QQuickWindow*, QQuickRenderControl*)+162)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #15 pc 000d6523  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Quick.so (QQuickWindow::QQuickWindow(QQuickWindowPrivate&, QWindow*)+30)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #16 pc 00136023  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Quick.so (QQuickWindowQmlImpl::QQuickWindowQmlImpl(QWindow*)+66)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #17 pc 00136115  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Quick.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #18 pc 00123c39  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (QQmlType::create() const+34)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #19 pc 0014b407  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #20 pc 0014bbfb  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #21 pc 0011b657  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (QQmlComponentPrivate::beginCreate(QQmlContextData*)+342)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #22 pc 0011a29d  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (QQmlComponent::create(QQmlContext*)+56)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #23 pc 001458eb  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (QQmlApplicationEnginePrivate::_q_finishLoad(QObject*)+194)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #24 pc 00145e97  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool)+74)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #25 pc 00145eed  /data/app/org.qtproject.nfc-2/lib/arm/libQt5Qml.so (QQmlApplicationEngine::load(QUrl const&)+20)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #26 pc 00001a50  /data/app/org.qtproject.nfc-2/lib/arm/libNFCtest.so (main+156)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #27 pc 00019a79  /data/data/org.qtproject.nfc/qt-reserved-files/plugins/platforms/android/libqtforandroid.so (???)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #28 pc 00013a1b  /system/lib/libc.so (__pthread_start(void*)+30)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   native: #29 pc 00011a0f  /system/lib/libc.so (__start_thread+6)
                F/art     ( 2684): art/runtime/check_jni.cc:65]   (no managed stack frames)
                F/art     ( 2684): art/runtime/check_jni.cc:65] 
                F/art     ( 2684): art/runtime/runtime.cc:284] Runtime aborting...
                

                I'm not sure why Qt if complaining with this: JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception 'java.lang.RuntimeException' thrown in unknown throw location.

                Maybe I'm not creating the JNI object as it should. Here is my code:

                main.cpp

                int main(int argc, char *argv[])
                {
                QGuiApplication app(argc, argv);
                
                QQmlApplicationEngine engine;
                NFCIntent mynfc;
                mynfc.init();
                engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                
                return app.exec();
                

                }
                init function

                void NFCIntent::init()
                {
                    QAndroidJniObject* nfc = new QAndroidJniObject("org/atron/nfc/MainActivity");
                    qDebug() << nfc->isValid();
                }
                
                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved