Skip to content

An efficient fluid simulation Android application optimized for smart devices using a compiled language, C++, and leveraging the OpenGL ES graphics API.

License

Notifications You must be signed in to change notification settings

MartinOpat/Lagrangian-fluid-simulation-for-Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Lagrangian-fluid-simulation-for-Android

Table of contents

  1. Build instructions
    1. SDK and NDK installation
    2. Building the app
  2. Installing the app
  3. 3rd party libraries

Build instructions

SDK and NDK installation

To build the application, Android SDK and NDK are required on the system. The best way to get the SDK and NDK is via AndroidStudio, as this ensures compatibility with the project structure.

The SDK and NDK can be installed either at the initial (one-time) setup for AndroidStudio or via File -> Settings -> Android SDK -> SDK tools. There, make sure (at least) the following list is selected:

  • Android SDK Build-tools
  • NDK (side by side)
  • Android SDK Platform-tools

After pressing apply, an installer should appear. Once everything is finished, you can leave the settings. However, make sure that Java 17+ is installed, if not you can install it via:

sudo apt-get install openjdk-17-jdk

Note that SDK 34.0.0 and NDK 25.1.8937393 were used during the development (see 3rd party applications for more detailed info)

Building the app

The app can be built via AndroidStudio or by running

./gradlew clean
./gradlew assembleDebug

inside the simulation folder. The apk can then be found at simulation/app/build/outputs/apk/debug/app-debug.apk. For a release version, you can run:

./gradlew assembleRelease

However, a valid .jks key has to first be generated. The apk will then be at simulation/app/build/outputs/apk/release/app-release.apk

Installing the app

First things first, make sure your Android device is connected. USB debugging from Developers options is recommended to be turned on.

If you connect your phone to AndroidStudio, you can install the apk simply by dragging it onto the screen. Alternatively, you can run

adb install -r ./app/build/outputs/apk/debug/app-debug.apk

from the simulation folder to install the apk.

3rd Party Libraries

The following list of 3rd party applications was used in this project:

The libraries above have already been compiled for Android into shader objects (.so) and included in the project. Thus, there is no need to recompile them. However, follow the simulation/third_party/ instructions if you need to recompile them anyway.

The following 3rd party C++ libraries were used in the native implementation:

For compiling and building the project for Android, the following list of tools was used:

Repository structure

All the code is located in the simulation folder.

To see third-party libraries and how to (re)compile them, see simulation/third_party. The precompiled (shared) third_party libraries files can be found at jniLibs.

The Java code is located at java.

The C++ code is located at cpp. The (pre-defined) project settings can be edited using config.txt

The app layout can be adjusted using activity_main.xml