Author Topic: BASS for Android Studio - How to???  (Read 1054 times)

francis57

  • Posts: 22
BASS for Android Studio - How to???
« on: 7 Sep '16 - 00:20 »
Hello everybody,

I succeeded in getting the BASS.java & BASSmix.java into the correct dirtree of my application, so I can call functions without compiler error like BASS.BASS_SAMPL etc
Then I've got the *.so files in dir-hierarchy in  folders /main/jniLibs/libs/armeabi, /main/jniLibs/libs/armeabi-v7a && /main/jniLibs/libs/x86
in build.gradle I added the line "compile fileTree(include: ['*.jar'], dir: 'libs')"
In onCreate-function I call
"if (!BASS.BASS_Init(-1, 44100, 0)) " and the app crashes  at that point.
is there any - even small documentation-  about how to get BASS for Android Studio working? I could not find any here in this forum.
Can anyone please please please help me?
Thanks a lot in advance
Francis

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android Studio - How to???
« Reply #1 on: 7 Sep '16 - 17:21 »
Then I've got the *.so files in dir-hierarchy in  folders /main/jniLibs/libs/armeabi, /main/jniLibs/libs/armeabi-v7a && /main/jniLibs/libs/x86

I think that should be without the "libs/" part, ie. /main/jniLibs/armeabi, /main/jniLibs/armeabi-v7a && /main/jniLibs/x86

If your app still crashes, what is the error message when that happens?

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #2 on: 7 Sep '16 - 18:36 »
Thank you Ian, here's the console output:

No implementation found for boolean com.flamenco_compas_builder.compasbuilder.com.un4seen.bass.BASS.BASS_Init(int, int, int) (tried Java_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_bass_BASS_BASS_1Init and Java_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_bass_BASS_BASS_1Init__III)
09-07 19:34:28.335 20408-20408/com.flamenco_compas_builder.compasbuilder D/AndroidRuntime: Shutting down VM
09-07 19:34:28.340 20408-20408/com.flamenco_compas_builder.compasbuilder E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                           Process: com.flamenco_compas_builder.compasbuilder, PID: 20408
                                                                                           java.lang.UnsatisfiedLinkError: No implementation found for boolean com.flamenco_compas_builder.compasbuilder.com.un4seen.bass.BASS.BASS_Init(int, int, int) (tried Java_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_bass_BASS_BASS_1Init and Java_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_bass_BASS_BASS_1Init__III)
                                                                                               at com.flamenco_compas_builder.compasbuilder.com.un4seen.bass.BASS.BASS_Init(Native Method)
                                                                                               at com.flamenco_compas_builder.compasbuilder.MainActivity.onCreate(MainActivity.java:420)
                                                                                               at android.app.Activity.performCreate(Activity.java:5990)
                                                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)
                                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)
                                                                                               at android.app.ActivityThread.access$900(ActivityThread.java:154)
                                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
                                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                               at android.os.Looper.loop(Looper.java:135)
                                                                                               at android.app.ActivityThread.main(ActivityThread.java:5289)
                                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                                               at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
                                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #3 on: 7 Sep '16 - 22:24 »
Hi,
although I got this project structure
src/main/jniLibs/libs/armeabi, src/main/jniLibs/libs/armeabi-v7a,src/main/jniLibs/libs/x86
or
src/main/jniLibs/armeabi, src/main/jniLibs/armeabi-v7a,src/main/jniLibs/x86
I get the error:
...[/vendor/lib, /system/lib]]] couldn't find "libbass.so"

Next trial: I only created ONE folder (armeabi) to /jniLibs,so I get the structure src/main/jniLibs/armeabi/libbass.so

Then the error message changes to :
...No implementation found for boolean com.flamenco_compas_builder.compasbuilder.com.un4seen.BASS.BASS.BASS_Init(int, int, int) (tried Java_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_BASS_BASS_BASS_1Init and Java_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_BASS_BASS_BASS_1Init__III)
09-08 00:36:09.150 11358-11358/com.flamenco_compas_builder.compasbuilder D/AndroidRuntime: Shutting down VM...

Seems if then the libbass.so is being copied to the apk, but the function of BASS_Init is not been found in the library??

Tested with Android Studio 2.1.3

I used the same library libbass.so very successfully with Firmonkey Delphi Seattle for a Firemonkey Android App on Windows IDE.
Regards Francis
« Last Edit: 8 Sep '16 - 07:30 by francis57 »

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #4 on: 8 Sep '16 - 07:40 »
and further more:
In Android Studio, when I open BASS.java all the functions from BASS_SetConfig down to BASS_FXSetPriority are marked as red, with mouse hover comment:
Can not resolve corresponding JNI function Jaca_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_BASS_BASS_BASS_1FXSetParameters -  reports native declarations in Java where no corresponding JNI function is found in the project
Francis

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android Studio - How to???
« Reply #5 on: 8 Sep '16 - 13:39 »
Seems if then the libbass.so is being copied to the apk, but the function of BASS_Init is not been found in the library??

To confirm whether the BASS libraries are being included in your app, you can open the app's APK file in ZIP software to have a look inside it. The libraries should in a "lib" folder inside the APK, eg. "lib/armeabi/libbass.so".

Please also confirm where you have put the BASS.java file. It should be in "src/main/java/com/un4seen/bass/".

and further more:
In Android Studio, when I open BASS.java all the functions from BASS_SetConfig down to BASS_FXSetPriority are marked as red, with mouse hover comment:
Can not resolve corresponding JNI function Jaca_com_flamenco_1compas_1builder_compasbuilder_com_un4seen_BASS_BASS_BASS_1FXSetParameters -  reports native declarations in Java where no corresponding JNI function is found in the project

It appears that the only way to avoid that is to disable the "Missing JNI function" checking. Here's a previous post on the subject:

   www.un4seen.com/forum/?topic=17045.msg119530#msg119530

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #6 on: 8 Sep '16 - 18:43 »
Hello Ian,
as you can see in the attached 3 pngs everything seems to be well confgurated The APK has got a lib folder with the *.so files, except the red warning does not disappear by checkin off "Missing JNI function". Initial code is:
//Does not crash in following line:
System.loadLibrary("bass");

       //I Tried, but it crashes whil easking for the version:
        int version = BASS.BASS_GetVersion();
        Log.d("BassVersion", Integer.toString(version));

//Tried, but itcrashes, too:
       if (!BASS.BASS_Init(-1, 44100, 0))  {
            Log.d("Estrella-BASS", "Init Error!");
return;
        }

Debug console prints:

No implementation found for int com.un4seen.bass.BASS.BASS_GetVersion() (tried Java_com_un4seen_bass_BASS_BASS_1GetVersion and Java_com_un4seen_bass_BASS_BASS_1GetVersion__)

or

No implementation found for boolean com.un4seen.bass.BASS.BASS_Init(int, int, int) (tried Java_com_un4seen_bass_BASS_BASS_1Init and Java_com_un4seen_bass_BASS_BASS_1Init__III)



francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #7 on: 9 Sep '16 - 12:47 »
..
Another console output:
9 13:45:48.290 1039-1039/com.flamenco_compas_builder.compasbuilder W/linker: libbass.so: unused DT entry: type 0x6ffffffe arg 0x28c
09-09 13:45:48.290 1039-1039/com.flamenco_compas_builder.compasbuilder W/linker: libbass.so: unused DT entry: type 0x6fffffff arg 0x1

Regards Francis

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android Studio - How to???
« Reply #8 on: 9 Sep '16 - 16:43 »
as you can see in the attached 3 pngs everything seems to be well confgurated The APK has got a lib folder with the *.so files

Yep, that stuff looks fine to me.

//Does not crash in following line:
System.loadLibrary("bass");

You shouldn't need to call that yourself; it's done automatically in the BASS.java file. Are you importing BASS in your source code?

Code: [Select]
import com.un4seen.bass.BASS;

If it's still not working, please upload your project to have a look at here:

   ftp.un4seen.com/incoming/

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #9 on: 9 Sep '16 - 17:55 »
Thank you, Ian, I just uploaded it.

Ian @ un4seen

  • Administrator
  • Posts: 21370
Re: BASS for Android Studio - How to???
« Reply #10 on: 12 Sep '16 - 17:24 »
The problem seems to be that you don't have proper libbass.so files in jniLibs (they are only 5KB). If you replace them with the files from the BASS package, then your app should start to work.

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #11 on: 12 Sep '16 - 22:58 »
Oh Ian, what a fool I am ;-)
Thank you so very much. Now it's working very very very cool!

Mehmood

  • Guest
Re: BASS for Android Studio - How to???
« Reply #12 on: 24 Nov '18 - 13:17 »
sir i also need proper libbass.so file can you give me

francis57

  • Posts: 22
Re: BASS for Android Studio - How to???
« Reply #13 on: 24 Nov '18 - 19:06 »
Here you are, hope it works for you