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. JNI Problem: Can't find my Java Class (worked pre 5.2)
Forum Updated to NodeBB v4.3 + New Features

JNI Problem: Can't find my Java Class (worked pre 5.2)

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 4.1k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Laroh
    wrote on last edited by
    #1

    Hey,

    I got a Problem with my custom java class i added to my android app.
    As I said it worked previously but after updating to Qt 5.2 I dont get the class when calling FindClass on my JNIEnv.

    calling:
    env->FindClass("org/qtproject/qt5/android/QGooglePlayManager")
    returns nothing.

    app crashes with:
    D/AndroidRuntime(19137): Shutting down VM
    W/dalvikvm(19137): threadid=1: thread exiting with uncaught exception (group=0x415cf700)
    E/AndroidRuntime(19137): FATAL EXCEPTION: main
    E/AndroidRuntime(19137): java.lang.NoClassDefFoundError: org/qtproject/qt5/android/QGooglePlayManager
    E/AndroidRuntime(19137): at java.lang.Runtime.nativeLoad(Native Method)
    E/AndroidRuntime(19137): at java.lang.Runtime.doLoad(Runtime.java:418)
    E/AndroidRuntime(19137): at java.lang.Runtime.loadLibrary(Runtime.java:359)
    E/AndroidRuntime(19137): at java.lang.System.loadLibrary(System.java:525)
    E/AndroidRuntime(19137): at org.qtproject.qt5.android.bindings.QtActivity.loadApplication(QtActivity.java:209)
    ......

    I am not very experienced with setting up any build processes so i hope i just have to add the java file or class somewhere?!

    Thanks,
    Laroh

    1 Reply Last reply
    0
    • L Offline
      L Offline
      litlington
      wrote on last edited by
      #2

      Your need to use ANDROID_PACKAGE_SOURCE_DIR.

      In your <project>.pro file, you might have:

      ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources

      Then in your project directory, you would have a sub-directory called android-sources. The manifest file, if you need a special one, would go in this sub-directory and your java files would go under this in android-sources/src.

      In fact, in the end we copied the complete 5.1.1 android\src sub-directory tree from the 5.1.1 into android-sources/src and deleted the java files that were not our own from the android-sources/src tree.

      In the end it was simple, but finding out how to do it took ages!!

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Laroh
        wrote on last edited by
        #3

        Thank you!!!

        so all user-modified files to be included in the apk now go into the ANDROID_PACKAGE_SOURCE_DIR!?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          litlington
          wrote on last edited by
          #4

          There are some more details here:

          http://doc-snapshot.qt-project.org/qdoc/deployment-android.html

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sanchir Kartiev
            wrote on last edited by
            #5

            After adding ANDROID_PACKAGE_SOURCE_DIR. Deployment is failed

            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