diff --git a/templates/android/src/jni.cpp b/templates/android/src/jni.cpp index 169ad63..510d4ad 100644 --- a/templates/android/src/jni.cpp +++ b/templates/android/src/jni.cpp @@ -267,14 +267,13 @@ JNIEXPORT void JNICALL JNI_FUNC(nativeAudioStop)(JNIEnv* env, jobject thiz) { (void)env; (void)thiz; - - if (mem != NULL) - free(mem); - plugin_fini(&instance); #if NUM_CHANNELS_IN + NUM_CHANNELS_OUT > 0 ma_device_stop(&device); ma_device_uninit(&device); #endif + if (mem != NULL) + free(mem); + plugin_fini(&instance); } extern "C"