-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use it in the Android APP? #53
Comments
Hi d9x2knv7, I've been using this library for some time now in Android. In order to build for Android, you have to have the NDK tools installed on your computer (a quick google search should help). I personally code a lot in C, so I use all of the functions natively in my C code (not in Java). Anyway, building native code for Android requires you to use an Android.mk makefile; I'll attach the one I use (I renamed it to Android.txt to make github happy). Now you have to put the source code in the folder app/src/main/jni (you can copy and paste the entire ffts project folder there). So you'll have something like app/src/main/jni/ffts now, with all of the source code and other stuff. Inside the Android.txt (which you should rename to Android.mk and place in the app/src/main/jni folder), make sure the LOCAL_PATH variable points to the correct directory where your ffts folder is. You shouldn't have to modify anything else. You'll also need a file called Application.mk inside your app/src/main/jni. I've attached mine (again with .txt). You might need to edit it if you're targeting a different CPU architecture. With those files, you should be able to run the command ndk-build from the app/src/main/jni folder and it'll build a file called either libffts.so or libffts-neon.so inside the folder app/src/main/libs/armeabi-v7a (or armeabi-somethingElse if you're building for a different architecture). Unfortunately, you're still not done. In order to use the library from Java, you have to use something called the JNI, the Java Native Interface. Take a look at the file ffts_jni.c inside the ffts folder for examples. That should help you get started. Good luck :) Hopefully this will help you and others avoid some of the frustration I faced when building this library. You'll probably have to do some more research on the JNI and NDK, but I'll leave that up to you. |
Thank you for you help! Thank you, I am working on it right now! Trying to study some basic way to make this happen! Thank you again! |
No worries :) glad I could help out--I know from experience how much of a hassle it can be. Hope you get it all figured out! |
Anyone can make it work with Android studio and NDK 13b? |
Hi, I am sorry to ask this basic question in here.
I am using the Android Studio to build an application (using Java language mainly), can some one tell me how to import FFTS to the application and test it? Which part I should import into?
Thank you.
The text was updated successfully, but these errors were encountered: