Clone MNN repo

In this section, you will run the Qwen model in action using a demo application using a Android Package Kit (APK).

A fork of the upstream MNN repository is set up to enable building the app as an Android Studio project.

Run the following commands to clone the repository and checkout the source tree:

    

        
        
cd $HOME
git clone https://github.com/HenryDen/MNN.git
cd MNN
git checkout origin/llm_android_demo

    

Build the App Using Android Studio

You can use Android Studio to build the app and create an APK.

Open project and build

Open Android Studio.

Go to File > Open.

Navigate to the cloned MNN repository, expand the transformers/llm/engine/ directories, select the android directory, and click Open.

This triggers a build of the project, and you should see output similar to the following on completion:

    

        
        BUILD SUCCESSFUL in 1m 42s

        
    

Generate and Run the APK

Navigate to Build > Generate App Bundles or APKs. Select Generate APKs.

The build will be executed, and then the app will be copied and installed on the Android device.

After opening the app, you will see the splash screen:

Image Alt Text:Loading screenshot

Finally, you can use the UI to chat with the app. Try uploading an image and ask a question on it.

Image Alt Text:Loading screenshot

The final step is to examine how KleidiAI can improve the performance of the model. Continue to the next section to find out.

Back
Next