# Qt application with FMOD audio library crashes on launch on Android

**URL:** <https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561>\
**Category:** FMOD Engine\
**Tags:** android, cpp\
**Created:** [August 18, 2023, 4:10am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561 "2023-08-18T04:10:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![8Observer8](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/8observer8/32/5439_2.png) [@8Observer8](https://qa.fmod.com/u/8Observer8)\
**Post date:** [August 18, 2023, 4:10am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/1 "2023-08-18T04:10:28Z")

</div>

Hello. I made an example that works on desktop when I build it to EXE but crashes when I run APK on smartphone. I use 2.02.16 API version, JDK 17, NDK 22, Qt 6.2.4, and Redmi 4x (Android 7)

Settings:

```auto
QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17

INCLUDEPATH += $$PWD/libs/fmod-2.2.16/inc

contains(ANDROID_TARGET_ARCH, armeabi-v7a)
{
    ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libfmod.so
}

SOURCES += \
    main.cpp \
    widget.cpp

HEADERS += \
    widget.h

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
    assets.qrc

```

APK is created after 1-2 minutes without problems. This is a source code of my example:

widget.h

```cpp
#ifndef WIDGET_H
#define WIDGET_H

#include <QtWidgets/QWidget>
#include <fmod.h>

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    FMOD_SYSTEM *m_pSystem;
    FMOD_SOUND *m_pSound;
};
#endif // WIDGET_H

```

widget.cpp

```cpp
#include "widget.h"
#include <QtCore/QDebug>
#include <QtCore/QFile>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    FMOD_System_Create(&m_pSystem, FMOD_VERSION);
    FMOD_System_Init(m_pSystem, 32, FMOD_INIT_NORMAL, 0);

    QString soundPath(":/assets/audio/music.wav");
    QFile f(soundPath);
    if (!f.open(QIODevice::ReadOnly))
    {
        qDebug() << "Faild to open the file: " << soundPath;
        return;
    }
    QByteArray soundData = f.readAll();

    FMOD_CREATESOUNDEXINFO* exinfo = new FMOD_CREATESOUNDEXINFO();
    exinfo->length = static_cast<unsigned int>(soundData.length());
    exinfo->cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    FMOD_System_CreateSound(m_pSystem, soundData.data(), FMOD_OPENMEMORY, exinfo, &m_pSound);

    FMOD_Sound_SetMode(m_pSound, FMOD_LOOP_OFF);

    FMOD_System_PlaySound(m_pSystem, m_pSound, 0, false, 0);
}

Widget::~Widget()
{
}

```

main.cpp

```cpp
#include "widget.h"

#include <QtWidgets/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();
    return a.exec();
}

```

I use `armeabi-v7a` to build a release:

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/b/b51c6d8d7ed93961d988f7bf0099b1e7bebe3f85.png)

I tried without FMOD and it runs on smartphone without problems. But my example above crashes with this report:

Build fingerprint: ‘Xiaomi/santoni/santoni:7.1.2/N2G47H/9.6.27:user/release-keys’  
Revision: ‘0’  
ABI: ‘arm’  
pid: 11662, tid: 11682, name: qtMainLoopThrea \>\>\> org.qtproject.example.fmode\_2d\_qt6\_cpp \<\<\<  
signal 6 (SIGABRT), code -6 (SI\_TKILL), fault addr --------  
Abort message: ‘art/runtime/java\_vm\_ext.cc:475] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn’t find class “org.fmod.AudioDevice” on path: DexPathList[[zip file “/data/app/org.qtproject.example.fmode\_2d\_qt6\_cpp-1/base.apk”],nativeLibraryDirectories=[/data/app/org.qtproject.example.fmode\_2d\_qt6\_cpp-1/lib/arm, /data/app/org.qtproject.example.fmode\_2d\_qt6\_cpp-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]’  
r0 00000000 r1 00002da2 r2 00000006 r3 00000008  
r4 c7780978 r5 00000006 r6 c7780920 r7 0000010c  
r8 00000000 r9 0000000a sl 00000fbd fp da07b900  
ip 0000000b sp c777f610 lr e843f2d7 pc e8441b58 cpsr 200f0010

backtrace:  
#00 pc 00049b58 /system/lib/libc.so (tgkill+12)  
#01 pc 000472d3 /system/lib/libc.so (pthread\_kill+34)  
#02 pc 0001d575 /system/lib/libc.so (raise+10)  
#03 pc 000190c1 /system/lib/libc.so (\_\_libc\_android\_abort+34)  
#04 pc 00017124 /system/lib/libc.so (abort+4)  
#05 pc 0031c3d9 /system/lib/libart.so (\_ZN3art7Runtime5AbortEPKc+328)  
#06 pc 000b569d /system/lib/libart.so (\_ZN3art10LogMessageD2Ev+1132)  
#07 pc 0023ab55 /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1664)  
#08 pc 0023ad47 /system/lib/libart.so (\_ZN3art9JavaVMExt9JniAbortVEPKcS2\_St9\_\_va\_list+58)  
#09 pc 000cb09b /system/lib/libart.so (\_ZN3art11ScopedCheck6AbortFEPKcz+46)  
#10 pc 000cac87 /system/lib/libart.so (\_ZN3art11ScopedCheck11CheckThreadEP7\_JNIEnv+362)  
#11 pc 000c9c9f /system/lib/libart.so (\_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS\_18ScopedObjectAccessEcNS\_12JniValueTypeE+26)  
#12 pc 000c917b /system/lib/libart.so (\_ZN3art11ScopedCheck5CheckERNS\_18ScopedObjectAccessEbPKcPNS\_12JniValueTypeE+802)  
#13 pc 000cbe49 /system/lib/libart.so (\_ZN3art8CheckJNI6NewRefEPKcP7\_JNIEnvP8\_jobjectNS\_15IndirectRefKindE+452)  
#14 pc 003382fd /system/lib/libart.so (\_ZN3art6Thread22SetClassLoaderOverrideEP8\_jobject+32)  
#15 pc 0023c857 /system/lib/libart.so (_ZN3art9JavaVMExt17LoadNativeLibraryEP7\_JNIEnvRKNSt3\_\_112basic\_stringIcNS3\_11char\_traitsIcEENS3\_9allocatorIcEEEEP8\_jobjectP8\_jstringPS9_+1878)  
#16 pc 00003167 /system/lib/libopenjdkjvm.so (JVM\_NativeLoad+178)  
#17 pc 00584c6d /system/framework/arm/boot.oat (offset 0x51c000) (java.lang.Runtime.nativeLoad+144)  
#18 pc 005848ad /system/framework/arm/boot.oat (offset 0x51c000) (java.lang.Runtime.doLoad+136)  
#19 pc 005859dd /system/framework/arm/boot.oat (offset 0x51c000) (java.lang.Runtime.load0+368)  
#20 pc 0059e383 /system/framework/arm/boot.oat (offset 0x51c000) (java.lang.System.load+78)  
#21 pc 000a9b41 /system/lib/libart.so (art\_quick\_invoke\_stub\_internal+64)  
#22 pc 00406ff5 /system/lib/libart.so (art\_quick\_invoke\_static\_stub+228)  
#23 pc 000b0dff /system/lib/libart.so (\_ZN3art9ArtMethod6InvokeEPNS\_6ThreadEPjjPNS\_6JValueEPKc+178)  
#24 pc 001edfed /system/lib/libart.so (\_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS\_6ThreadEPNS\_9ArtMethodEPKNS\_7DexFile8CodeItemEPNS\_11ShadowFrameEPNS\_6JValueE+200)  
#25 pc 001e859d /system/lib/libart.so (\_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS\_9ArtMethodEPNS\_6ThreadERNS\_11ShadowFrameEPKNS\_11InstructionEtPNS\_6JValueE+492)  
#26 pc 003ffaf9 /system/lib/libart.so (MterpInvokeStatic+236)  
#27 pc 0009cb14 /system/lib/libart.so (ExecuteMterpImpl+14612)  
#28 pc 001cb8c7 /system/lib/libart.so (\_ZN3art11interpreterL7ExecuteEPNS\_6ThreadEPKNS\_7DexFile8CodeItemERNS\_11ShadowFrameENS\_6JValueEb+286)  
#29 pc 001d042f /system/lib/libart.so (\_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS\_6ThreadEPKNS\_7DexFile8CodeItemEPNS\_11ShadowFrameEPNS\_6JValueE+114)  
#30 pc 001e8583 /system/lib/libart.so (\_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS\_9ArtMethodEPNS\_6ThreadERNS\_11ShadowFrameEPKNS\_11InstructionEtPNS\_6JValueE+466)  
#31 pc 003ff61b /system/lib/libart.so (MterpInvokeInterface+834)  
#32 pc 0009cb94 /system/lib/libart.so (ExecuteMterpImpl+14740)  
#33 pc 001cb8c7 /system/lib/libart.so (\_ZN3art11interpreterL7ExecuteEPNS\_6ThreadEPKNS\_7DexFile8CodeItemERNS\_11ShadowFrameENS\_6JValueEb+286)  
#34 pc 001d042f /system/lib/libart.so (\_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS\_6ThreadEPKNS\_7DexFile8CodeItemEPNS\_11ShadowFrameEPNS\_6JValueE+114)  
#35 pc 001e8583 /system/lib/libart.so (\_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS\_9ArtMethodEPNS\_6ThreadERNS\_11ShadowFrameEPKNS\_11InstructionEtPNS\_6JValueE+466)  
#36 pc 003ff61b /system/lib/libart.so (MterpInvokeInterface+834)  
#37 pc 0009cb94 /system/lib/libart.so (ExecuteMterpImpl+14740)  
#38 pc 001cb8c7 /system/lib/libart.so (\_ZN3art11interpreterL7ExecuteEPNS\_6ThreadEPKNS\_7DexFile8CodeItemERNS\_11ShadowFrameENS\_6JValueEb+286)  
#39 pc 001d0399 /system/lib/libart.so (\_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS\_6ThreadEPKNS\_7DexFile8CodeItemEPNS\_11ShadowFrameE+92)  
#40 pc 003f63e7 /system/lib/libart.so (artQuickToInterpreterBridge+706)  
#41 pc 000ae593 /system/lib/libart.so (art\_quick\_to\_interpreter\_bridge+34)  
#42 pc 005a22e9 /system/framework/arm/boot.oat (offset 0x51c000) (java.lang.Thread.run+52)  
#43 pc 000a9b41 /system/lib/libart.so (art\_quick\_invoke\_stub\_internal+64)  
#44 pc 00406eed /system/lib/libart.so (art\_quick\_invoke\_stub+232)  
#45 pc 000b0dd5 /system/lib/libart.so (\_ZN3art9ArtMethod6InvokeEPNS\_6ThreadEPjjPNS\_6JValueEPKc+136)  
#46 pc 00317349 /system/lib/libart.so (\_ZN3artL18InvokeWithArgArrayERKNS\_33ScopedObjectAccessAlreadyRunnableEPNS\_9ArtMethodEPNS\_8ArgArrayEPNS\_6JValueEPKc+56)  
#47 pc 00318115 /system/lib/libart.so (\_ZN3art35InvokeVirtualOrInterfaceWithJValuesERKNS\_33ScopedObjectAccessAlreadyRunnableEP8\_jobjectP10\_jmethodIDP6jvalue+256)  
#48 pc 0032f29d /system/lib/libart.so (\_ZN3art6Thread14CreateCallbackEPv+848)  
#49 pc 00046da3 /system/lib/libc.so (\_ZL15\_\_pthread\_startPv+22)  
#50 pc 00019b0d /system/lib/libc.so (\_\_start\_thread+6)

---

<div class="post-metadata">

**Author:** ![8Observer8](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/8observer8/32/5439_2.png) [@8Observer8](https://qa.fmod.com/u/8Observer8)\
**Post date:** [August 18, 2023, 2:27pm UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/2 "2023-08-18T14:27:33Z")

</div>

This is a comment form [Stack Overflow](https://stackoverflow.com/questions/76928386/qt-application-with-fmod-audio-library-crashes-on-launch-on-android):

> The error seems pretty clear to me: “java.lang.ClassNotFoundException: Didn’t find class “org.fmod.AudioDevice”. You did not include the FMOD SDK in your APK. [Quick documentation link](https://www.fmod.com/docs/2.01/api/platforms-android.html#java)

Is he right? Or only Java developers must include `fmod.jar` in their projects?

---

<div class="post-metadata">

**Author:** ![8Observer8](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/8observer8/32/5439_2.png) [@8Observer8](https://qa.fmod.com/u/8Observer8)\
**Post date:** [August 18, 2023, 5:22pm UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/3 "2023-08-18T17:22:01Z")

</div>

This is the APK file: [android-build-with-fmod-for-forums.apk](https://www.dropbox.com/scl/fi/m7hk76cia49451mhsoiny/android-build-with-fmod-for-forums.apk?rlkey=h2cnav1e6bl7s3ixidqi4nnsf&dl=1)

Could someone run it? Music must play. Maybe my device is too old and FMOD doesn’t support it.

I tried to unzip the APK. How to make sure that the `libfmod.so` with the correct path?

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/c8d50a990832c14aea50f36629df32f81f636510.png)

---

<div class="post-metadata">

**Author:** ![8Observer8](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/8observer8/32/5439_2.png) [@8Observer8](https://qa.fmod.com/u/8Observer8)\
**Post date:** [August 20, 2023, 11:52am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/4 "2023-08-20T11:52:17Z")

</div>

> [@8Observer8](#):
>
> How to make sure that the `libfmod.so` with the correct path?

Path is correct. I think I need to load `fmod.jar` like is written in the documentation: [https://www.fmod.com/docs/2.01/api/platforms-android.html#java](https://www.fmod.com/docs/2.01/api/platforms-android.html#java)

> FMOD is primarily a native C/C++ library implementation but does have a Java component that is invoked from native code. To ensure the Java component is properly operating please make sure you reference the _fmod.jar_ in your project. This means telling the IDE or build system where to find the _fmod.jar_ file so it’s included in the application.

I need to find how to load jar-files and how to call Java code from Qt C++.

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 22, 2023, 5:22am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/5 "2023-08-22T05:22:08Z")

</div>

Loading a jar inside a QT android application should just be a matter of placing it in the android/libs directory: [Third-party Android Libraries | Qt 6.5](https://doc.qt.io/qt-6/android-3rdparty-libs.html).  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/3/30b462e54b39580bb2b63edb74100a8df6de6784.png)

Everything else looks like it should be correct- make sure you also add your “audio” directory to your project’s `INSTALLS` to ensure they are bundled into your assets directory: [Porting to Android | Qt 5.15](https://doc.qt.io/qt-5/porting-to-android.html).

```auto
android {
...
    deploy.files = $$PWD/android/audio/*
    deploy.files += $$PWD/android/audio/music.wav
    deploy.path = /assets
    INSTALLS += deploy
}

```

This way, as long as your main activity calls `org.fmod.FMOD.init` you should be able to lookup assets using `"file:///audio_assets/{NAME OF AUDIO FAILE}.wav"`:

MainActivity.java

```auto
 public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        org.fmod.FMOD.init(this);
    }

    @Override
    protected void onDestroy()
    {
        org.fmod.FMOD.close();
    }

    static
    {
        System.loadLibrary("fmod");
    }
}

```

Widget.cpp

```auto
FMOD_System_CreateSound(m_pSystem, "file:///android_asset/music.wav", FMOD_DEFAULT, 0, &sound);

```

---

<div class="post-metadata">

**Author:** ![8Observer8](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/8observer8/32/5439_2.png) [@8Observer8](https://qa.fmod.com/u/8Observer8)\
**Post date:** [August 22, 2023, 1:30pm UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/6 "2023-08-22T13:30:26Z")

</div>

I have the `fmod.jar` inside of the `jniLibs` folder:

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/2/21c031326e13dcd09ec76d0944da6617b5ed36ba.png)

But I don’t see this file inside of the final APK file:

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/1/14ec1513b35eaab4d3d7d2680ce0f34f94971dea.png)

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/c/cee84510f955e81a935fc10dd3ee60c5ef1e9461.png)

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/9/927ca18ad5a53a5bec58776a0cb12f3061bd5500.png)

Maybe is it because I don’t call anything from the `fmod.jar` library?

> MainActivity.java

What should I do with this file? How to include it to my project? Should I call `System.loadLibrary("fmod")`, `onCreate`, `onDestroy`? How to do it from Qt C++ code?

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 23, 2023, 12:03am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/7 "2023-08-23T00:03:36Z")

</div>

> [@8Observer8](#):
>
> I have the `fmod.jar` inside of the `jniLibs` folder:  
> But I don’t see this file inside of the final APK file:

You won’t see a jar file in a built apk. jar files are compiled to dex files, which I can see you have a couple of. You can verify fmod.jar has been included successfully by using dexdump to view the dex contents, and search for occurrences of “FMOD”. On Windows, you can do this using powershell with the following command:

```js
dexdump.exe classes.dex | Select-String "FMOD" | Select-String "Class descriptor"

  Class descriptor : 'Lorg/fmod/AudioDevice;'
  Class descriptor : 'Lorg/fmod/FMOD$PluginBroadcastReceiver;'
  Class descriptor : 'Lorg/fmod/FMOD;'
  Class descriptor : 'Lorg/fmod/FMODAudioDevice;'
  Class descriptor : 'Lorg/fmod/MediaCodec$1DataSource;'
  Class descriptor : 'Lorg/fmod/MediaCodec$2DataSource;'
  Class descriptor : 'Lorg/fmod/MediaCodec;'
  Class descriptor : 'Lorg/fmod/a;'

```

> [@8Observer8](#):
>
> What should I do with this file? How to include it to my project? Should I call `System.loadLibrary("fmod")`, `onCreate`, `onDestroy`?

Please refer to the [Java](https://fmod.com/docs/2.02/api/platforms-android.html#java) section of our Android platform docs for an understanding of how to initialize the Java component of FMOD.

> [@8Observer8](#):
>
> How to do it from Qt C++ code?

These calls must be made inside Java- Java Activities/Services inherit from [Context](https://developer.android.com/reference/android/content/Context), which we need to initialize FMOD, and there is no way to get access to this from C++ code.

It might be worth running one of our Android examples from Android Studio before trying to get the same thing working in Qt. This will give you an understanding of the expected way to use FMOD in an Android application using Java, and how to call into C++ code via the Java native interface. The 3D example can be found in “ **api\core\examples\androidstudio\cmake\3d** ”.

After that, you can get the equivalent running in a Qt example, which will give you the C++ and Java parts to start working with. Most of the Qt Android examples will give you a Java activity or Service that you can pass to `org.fmod.FMOD.init`.

---

<div class="post-metadata">

**Author:** ![8Observer8](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/8observer8/32/5439_2.png) [@8Observer8](https://qa.fmod.com/u/8Observer8)\
**Post date:** [August 23, 2023, 4:47am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/8 "2023-08-23T04:47:38Z")

</div>

> [@jeff\_fmod](#):
>
> Please refer to the [Java](https://fmod.com/docs/2.02/api/platforms-android.html#java) section of our Android platform docs for an understanding of how to initialize the Java component of FMOD.

Where should I create the `MainActivity.java` file? Is the `MainActivity.java` predefined name? Is this file run automatically by Android?

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/9/98803811619f2f206589ee8af52a7316c74ccd83.png)

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 25, 2023, 1:47am UTC](https://qa.fmod.com/t/qt-application-with-fmod-audio-library-crashes-on-launch-on-android/20561/9 "2023-08-25T01:47:51Z")

</div>

> [@jeff\_fmod](#):
>
> It might be worth running one of our Android examples from Android Studio before trying to get the same thing working in Qt.

If you are unfamiliar with how to setup an Android application, I strongly recommend you take a look at our Android examples. It isn’t really in the scope of our forums to show you how to setup an Android application- for that you should refer to the [Application fundamentals](https://developer.android.com/guide/components/fundamentals?hl=en) section of the official Android documentation.

I know it is not very intuitive and there is a lot of information out there, so I will try to point you in the right direction.

> [@8Observer8](#):
>
> Where should I create the `MainActivity.java` file?

The [Qt Android examples](https://doc.qt.io/qt-6/examples-android.html) provide a good template for how to setup a Qt Android project. In their examples, activities are placed in “ **Other files/android/src/org/qtproject/example/activityhandler** ”  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/4/45c1845be319bd09839b429dd4f91d2f649e680d.png)

> [@8Observer8](#):
>
> Is the `MainActivity.java` predefined name? Is this file run automatically by Android?

You can call your activity whatever you like, and there are many ways to run it, but it does not run by default. The simplest thing to do would be to declare it as your [main action](https://developer.android.com/reference/android/content/Intent#intent-resolution) in your manifest.

```auto
<application android:label="My App" android:extractNativeLibs="true">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

```
