PDA

View Full Version : SDK Unity Android Build Example



Mytiope
December 13th, 2018, 08:52 PM
I'm trying to get the basic TeamSpeak SDK examples to run in Android. They seem to work fine in the Unity Editor, and as a Windows build. But there are issues with Android that I don't understand. Hopefully somebody can verify things work for them and give me some pointers on what I may be missing.

Here's my basic setup:
Windows 10 Pro
Unity 2018.2.19f1
TeamSpeak SDK 2018 2.11 (SDK 3.0.4.4) Unity Package

I've got the SDK Server running locally, and can connect to it fine in the Editor and from standalone Windows builds. All the example scenes (3D Sound Unity, Lobby_Example, and Minimal_Mobile) seem to work great.

However when I switch platform and build it for Android, something with the native plugin isn't wired up correctly. I leave the defaults in Player Settings -> Target Architectures set to ARMv7 and x86. So there should be 4 libraries included, I think:

Assets/Plugins/android/armeabi-v7a/libopensles_ts_soundbackend.so
Assets/Plugins/android/armeabi-v7a/libts3client.so
Assets/Plugins/android/x86/libopensles_ts_soundbackend.so
Assets/Plugins/android/x86/libts3client.so

But when I build, the resulting .apk file only has one of those libraries in it: lib/x86/libts3client.so

When I run the .apk on an android device, it understandably fails the first time it tries to access the library with this:


I/Unity (17795): SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 1815mb
I/Unity (17795): SystemInfo ARM big.LITTLE configuration: 2 big (mask: 0xc), 2 little (mask: 0x3)
I/Unity (17795): ApplicationInfo com.Test.TeamSpeak version 0.1 build f7fb1229-eed8-4f90-9909-3bd448c626a5
I/Unity (17795): Built from '2018.2/staging' branch, Version '2018.2.19f1 (06990f28ba00)', Build type 'Release', Scripting Backend 'mono'
E/Unity (17795): Unable to find ts3client_android
E/Unity (17795): AndroidJavaException: java.lang.ClassNotFoundException: com.teamspeak.unity.TeamSpeakWrapper
E/Unity (17795): java.lang.ClassNotFoundException: com.teamspeak.unity.TeamSpeakWrapper
E/Unity (17795): at java.lang.Class.classForName(Native Method)
E/Unity (17795): at java.lang.Class.forName(Class.java:306)
E/Unity (17795): at java.lang.Class.forName(Class.java:270)
E/Unity (17795): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/Unity (17795): at com.unity3d.player.UnityPlayer.c(Unknown Source)
E/Unity (17795): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unkno wn Source)
E/Unity (17795): at android.os.MessageQueue.next(MessageQueue.java:211 )
E/Unity (17795): at android.os.Looper.loop(Looper.java:122)
E/Unity (17795): at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
E/Unity (17795): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.teamspeak.unity.TeamSpeakWrapper" on path: DexPathList[[zip file "/data/app/com.Test.TeamSpeak-1/base.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/data/app/com.Test.TeamSpeak-1/lib/arm, /vendor/lib,


I also tried copying the two libraries from the armeabi-v7a folder up one folder and setting their platform info in the inspector to Android and ARMv7. That ends up getting them included in the .apk file under lib/armeabi-v7a. But I still get the same error, I think since it's looking for "ts3client_android" instead of "ts3client".

So I rename /Assets/Plugins/android/libts3client.so to libts3client_android.so. It then seems to at least stop complaining about finding ts3client_android, but still cannot find com.teamspeak.unity.TeamSpeakWrapper.



I/Unity (20122): SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 1815mb
I/Unity (20122): SystemInfo ARM big.LITTLE configuration: 2 big (mask: 0xc), 2 little (mask: 0x3)
I/Unity (20122): ApplicationInfo com.Test.TeamSpeak version 0.1 build 06ef6193-0366-496f-a71b-32ff0263c641
I/Unity (20122): Built from '2018.2/staging' branch, Version '2018.2.19f1 (06990f28ba00)', Build type 'Release', Scripting Backend 'mono'
E/Unity (20122): AndroidJavaException: java.lang.ClassNotFoundException: com.teamspeak.unity.TeamSpeakWrapper
E/Unity (20122): java.lang.ClassNotFoundException: com.teamspeak.unity.TeamSpeakWrapper
E/Unity (20122): at java.lang.Class.classForName(Native Method)
E/Unity (20122): at java.lang.Class.forName(Class.java:306)
E/Unity (20122): at java.lang.Class.forName(Class.java:270)
E/Unity (20122): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/Unity (20122): at com.unity3d.player.UnityPlayer.c(Unknown Source)
E/Unity (20122): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unkno wn Source)
E/Unity (20122): at android.os.MessageQueue.next(MessageQueue.java:211 )
E/Unity (20122): at android.os.Looper.loop(Looper.java:122)
E/Unity (20122): at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
E/Unity (20122): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.teamspeak.unity.TeamSpeakWrapper" on path: DexPathList[[zip file "/data/app/com.Test.TeamSpeak-2/base.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/data/app/com.Test.TeamSpeak-2/lib/arm, /vendor/lib,


Any ideas? Are the android libraries included in the unity package maybe not the right ones? Can anyone else get this to build for Android, and if so, care to share how you did it?

Notes:
I've tried on a couple different Android devices (all ARMv7), and they act the same... so I don't think it's device specific.
I've also tried using Unity 5.5.6f1 and the TeamSpeak SDK for Unity 5.5 and get the same results... so I don't think it's Unity version specific.

Alex_G
December 14th, 2018, 03:44 PM
Hi Mytiope,

I can reproduce your problem and I'm working now on a new version for Unity.
I will add a link to this thread when i finished it ;)

Kind Regards,
Alex

Ereona
June 11th, 2019, 01:46 PM
Hello, I have the same problem. Could you give an advice how to solve it? I use Unity 2018.3.12f1 and TeamSpeak_SDK_3.0.4.4_2018_10_12_Unity3D_2018_2_f1 1.unitypackage.

Ereona
July 3rd, 2019, 11:26 AM
It seems that the last version does not have .jar file. The older version 3.0.3.2 works for me.

Patrick The Master
October 7th, 2019, 08:05 PM
so, what is the result?

Filimindji
November 1st, 2019, 01:16 PM
Hello,

It's impossible to use the SDK on Unity Android because of this error.

Is it possible to get any news on this thread ?

I'm using Unity 2019.2.9f1

To contribute, I managed to include the libs into the apk only when the .so are placed into this folder and with this configuration for both files :

18537

I also had to perform theses steps :

- Uncheck all the checkbox
- Apply
- Check Android
- Select ARMv7
- Check Load on startup

After the build, I got my libs into \lib\armeabi-v7a inside the apk :

18538

I also change the code from TeamSpeakInterface.cs, line 110, to match the .so filename and to prevent the lib not found.

18539

But it still not work (from logcat) :



11-01 14:12:06.940 11019 11041 I Unity : 192.168.0.32
11-01 14:12:06.940 11019 11041 I Unity : UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
11-01 14:12:06.940 11019 11041 I Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
11-01 14:12:06.940 11019 11041 I Unity : UnityEngine.Logger:Log(LogType, Object)
11-01 14:12:06.940 11019 11041 I Unity : UnityEngine.Debug:Log(Object)
11-01 14:12:06.940 11019 11041 I Unity : TS3_Minimal_Mobile_Example:OnGUI() (at C:\Sources\EnkiRemote\EnkiRemote\Assets\TeamSpeak\ Example\TS3_Minimal_Mobile_Example.cs:97)
11-01 14:12:06.940 11019 11041 I Unity :
11-01 14:12:06.940 11019 11041 I Unity : (Filename: C Line: 0)
11-01 14:12:06.940 11019 11041 I Unity :
11-01 14:12:06.995 11019 11041 E Unity : AndroidJavaException: java.lang.ClassNotFoundException: Didn't find class "com/teamspeak/unity/TeamSpeakWrapper" on path: DexPathList[[zip file "/data/app/com.BiggerInside.EnkiRemote-z3rhVEWijxElI0dfcgAaZQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.BiggerInside.EnkiRemote-z3rhVEWijxElI0dfcgAaZQ==/lib/arm, /data/app/com.BiggerInside.EnkiRemote-z3rhVEWijxElI0dfcgAaZQ==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
11-01 14:12:06.995 11019 11041 E Unity : java.lang.ClassNotFoundException: Didn't find class "com/teamspeak/unity/TeamSpeakWrapper" on path: DexPathList[[zip file "/data/app/com.BiggerInside.EnkiRemote-z3rhVEWijxElI0dfcgAaZQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.BiggerInside.EnkiRemote-z3rhVEWijxElI0dfcgAaZQ==/lib/arm, /data/app/com.BiggerInside.EnkiRemote-z3rhVEWijxElI0dfcgAaZQ==/base.apk!/lib/armeabi-v7a, /system/lib, /product/lib]]
11-01 14:12:06.995 11019 11041 E Unity : at dalvik.system.BaseDexClassLoader.findClass(BaseDex ClassLoader.java:134)
11-01 14:12:06.995 11019 11041 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
11-01 14:12:06.995 11019 11041 E Unity : at com.unity3d.player.UnityPlayer.c


@Ereona mentionned it works with and old sdk version.

I manage to find a download link here :
http://dl.4players.de/ts/releases/3.0.3.2/

I succesfully connect to a 3.0.4.4 server once, but it was not stable, and app crashed.
I also tried to import the jar from 3.0.3.2 to 3.0.4.4, but I had no luck.

Please help !

Thank you