-
Android Studio (Arctic Fox or later)
- Download from: https://developer.android.com/studio
- Install with default settings
-
Android SDK
- Minimum SDK: API 34 (Android 14)
- Target SDK: API 34 (Android 14)
- Install via Android Studio SDK Manager
-
NDK (Native Development Kit)
- Version: Latest stable (23.1.7779620 or later)
- Install via Android Studio SDK Manager:
- Tools → SDK Manager → SDK Tools → NDK (Side by side)
-
CMake
- Version: 3.22.1 or later
- Install via Android Studio SDK Manager:
- Tools → SDK Manager → SDK Tools → CMake
-
JDK (Java Development Kit)
- Version: Java 17
- Usually bundled with Android Studio
-
Open the Project
File → Open → Select /path/to/FFT/android/ -
Sync Gradle
- Android Studio will automatically prompt to sync
- Or manually: File → Sync Project with Gradle Files
- Wait for sync to complete (may take a few minutes for first build)
-
Build the Project
- Build → Make Project (Ctrl+F9 / Cmd+F9)
- Or use the toolbar hammer icon
-
Run on Device/Emulator
- Connect an Android device via USB (with USB debugging enabled)
- Or create an Android Virtual Device (AVD) via AVD Manager
- Run → Run 'app' (Shift+F10 / Ctrl+R)
-
Navigate to Android Directory
cd /path/to/FFT/android -
Build Debug APK
./gradlew assembleDebug
Output:
app/build/outputs/apk/debug/app-debug.apk -
Build Release APK
./gradlew assembleRelease
Output:
app/build/outputs/apk/release/app-release-unsigned.apk -
Install on Connected Device
./gradlew installDebug
-
Run Tests
./gradlew test ./gradlew connectedAndroidTest
-
Generate Signed AAB
./gradlew bundleRelease
-
Sign the AAB
-
Create a keystore (first time only):
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias
-
Sign with jarsigner:
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \ -keystore my-release-key.jks \ app/build/outputs/bundle/release/app-release.aab my-key-alias
-
-
Gradle Sync Failed
- Solution: File → Invalidate Caches / Restart
- Or delete
.gradleand.ideafolders, then reopen
-
NDK Not Found
- Solution: Install NDK via SDK Manager
- Verify path in local.properties:
ndk.dir=/path/to/ndk
-
CMake Error
- Solution: Install CMake via SDK Manager
- Or specify version in
android/app/build.gradle.kts
-
JNI/Native Library Issues
- Check that C++ source files are in correct location
- Verify CMakeLists.txt paths are correct
- Clean and rebuild: Build → Clean Project, then Build → Rebuild Project
-
Dependency Resolution Failed
- Check internet connection
- Clear Gradle cache:
./gradlew clean --refresh-dependencies - Check that jitpack.io is accessible (for MPAndroidChart)
-
Execution Failed for Task ':app:compileDebugKotlin'
- Ensure Kotlin plugin is updated
- Check that all imports are correct
- Sync Gradle files
-
App Crashes on Launch
- Check logcat for errors:
adb logcat | grep FFT - Verify microphone permission is granted
- Ensure device runs Android 14+ (API 34)
- Check logcat for errors:
-
C++ Library Not Loading
- Verify NDK ABI matches device architecture
- Check that native library is included in APK:
unzip -l app-debug.apk | grep libfft_native.so
-
Audio Capture Not Working
- Grant microphone permission in Settings
- Ensure device has a working microphone
- Check AudioRecord initialization in logs
-
Debug Build: Slower, includes debug symbols
./gradlew assembleDebug
-
Release Build: Optimized, ProGuard/R8 enabled
./gradlew assembleRelease
-
CPU Profiler
- Run → Profile 'app'
- Record FFT processing performance
- Identify bottlenecks
-
Memory Profiler
- Monitor memory allocation during audio capture
- Check for leaks with LeakCanary (if added)
-
Network Profiler
- Not applicable (app doesn't use network)
Create .github/workflows/android-build.yml:
name: Android CI
on:
push:
branches: [ main ]
paths:
- 'android/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x android/gradlew
- name: Build with Gradle
run: |
cd android
./gradlew assembleDebug
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-debug
path: android/app/build/outputs/apk/debug/app-debug.apk- Build signed AAB
- Upload to Play Console
- Create internal testing track
- Add testers via email
- Share test link
- Build debug APK:
./gradlew assembleDebug - Share APK file:
app/build/outputs/apk/debug/app-debug.apk - Recipients must enable "Install from Unknown Sources"
-
Use Gradle Daemon: Speeds up builds
echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties
-
Parallel Builds: Enable in gradle.properties
org.gradle.parallel=true -
Build Cache: Enable Gradle build cache
org.gradle.caching=true -
Use ADB Wireless: No USB cable needed (Android 11+)
adb pair <device-ip>:port adb connect <device-ip>:port
For issues:
- Check GitHub Issues: https://github.com/FlaccidFacade/FFT/issues
- Review Android documentation: https://developer.android.com
- Stack Overflow: Tag with
android,fft,android-ndk