Error compiling Android NDK
NDK in cygwin :
$ /cygdrive/e/UDK/nvpack/android-ndk-r10b/ndk-build
Android NDK: ERROR:jni/Android.mk:photon-cpp-static-prebuilt: LOCAL_SRC_FILES points to a missing file Android NDK: Check that jni/../../Photon-cpp/obj/local/armeabi-v7a/libphoton-cpp-static.a exists or that its path is correct/cygdrive/e/UDK/nvpack/android-ndk-r10b/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Alto.
VisualStudio2010: Configured with the java and android sdks, and the ndk paths, everything set, even the project properties, in release configuration...
Error 13 error MSB3073: The command ""W:\CodingSoftware\VisualGDB\\VisualGDB.exe" /build "E:\PhotonCloud\SDK\android\LoadBalancing-cpp\AndroidLoadBalancing-cpp.vcxproj" "/solution:E:\PhotonCloud\SDK\android\LoadBalancing-cpp\AndroidLoadBalancing-cpp.sln" "/config:Release" "/platform:Win32"" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets 38 6 AndroidLoadBalancing-cpp
Error 8 error : jni/Android.mk:photon-cpp-static-prebuilt: LOCAL_SRC_FILES points to a missing file E:\PhotonCloud\SDK\android\LoadBalancing-cpp\Android NDK AndroidLoadBalancing-cpp
Error 10 error : Command-line action failed E:\PhotonCloud\SDK\android\LoadBalancing-cpp\VisualGDB AndroidLoadBalancing-cpp
Error 9 error : Android NDK: Aborting . Stop. E:\UDK\nvpack\android-ndk-r10b\build\core\prebuilt-library.mk 45 1 AndroidLoadBalancing-cpp
Message 6 Could not find schema information for the attribute 'Condition'. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets 60 18 Miscellaneous Files
Error 7 [Clang IntelliSense] Error: 'sys/time.h' file not found e:\photoncloud\sdk\android\common-cpp\inc\defines.h 79 12
is there anywhere a guide to compile this project properly?
I was able to compile the Windows version of LoadBalancing with Visual Studio 2015, but this is giving me headaches, so,
Thanks!.
Comments
-
Hi @juaxix.
This is likely caused by the fact that you are using NDK r10b.
Please update to r12b and download the latest Photon Client SDK (4.1.3.3).
4.1.3.2, which is what you probably work with right now, was the last release that required the NDK version to be either r10d or r10e.1 -
Sorry man, but it wont compile 4.1.3.3 with NDK r12b, just tested. What am i doing wrong?
VS Config:
VGBD Config:
Error:Warning 4 warning : Your Android NDK contains a bug that prevents it from running 32-bit executables on 64-bit systems. G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp\VisualGDB AndroidLoadBalancing-cpp Warning 5 warning : See this page for instructions how to fix: http://visualgdb.com/KB/?ProblemID=host64 G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp\VisualGDB AndroidLoadBalancing-cpp Error 6 error MSB3073: The command ""W:\CodingSoftware\VisualGDB\\VisualGDB.exe" /clean "G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp\AndroidLoadBalancing-cpp.vcxproj" "/solution:G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp\AndroidLoadBalancing-cpp.sln" "/config:Release" "/platform:Win32"" exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets 33 6 AndroidLoadBalancing-cpp Error 1 error : jni/Android.mk:photon-cpp-static-prebuilt: LOCAL_SRC_FILES points to a missing file G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp\Android NDK AndroidLoadBalancing-cpp Error 3 error : Command-line action failed G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp\VisualGDB AndroidLoadBalancing-cpp Error 2 error : Android NDK: Aborting . Stop. G:\UDK\nvpack\android-ndk-r10b\build\core\prebuilt-library.mk AndroidLoadBalancing-cpp
I would prefer to compile using a command line than VS2010.
In this case, can you provide the commands to do it please?
This is what i'm doing:cd Libs\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp E:\UDK\nvpack\android-ndk-r12b\ndk-build.cmd NDK_APPLICATION_MK=jni\Application.mk
And this is the result:Android NDK: ERROR:jni/Android.mk:photon-cpp-static-prebuilt: LOCAL_SRC_FILES points to a missing file Android NDK: Check that jni/../../Photon-cpp/obj/local/arm64-v8a/libphoton-cpp-static.a exists or that its path is correct E:/UDK/nvpack/android-ndk-r12b/build//../build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
Thanks for your time0 -
(edited)0
-
(edited)0
-
(edited)0
-
ERROR!:
G:\ShivaProjects\PhotonCloud\Plugins\com.xixgames.photoncloudapi\Libs\Photon-And
roidNDK-Sdk_v4-1-3-3>E:\UDK\nvpack\android-ndk-r12b\ndk-build.cmd NDK_APPLICATIO
N_MK=LoadBalancing-cpp/jni/Application.mk NDK_PROJECT_PATH=./LoadBalancing-cpp
Android NDK: ERROR:LoadBalancing-cpp/jni/Android.mk:photon-cpp-static-prebuilt:
LOCAL_SRC_FILES points to a missing file
Android NDK: Check that LoadBalancing-cpp/jni/../../Photon-cpp/obj/local/arm64-v
8a/libphoton-cpp-static.a exists or that its path is correct
E:/UDK/nvpack/android-ndk-r12b/build//../build/core/prebuilt-library.mk:45: ***
Android NDK: Aborting . Stop.
Please help @Kaiserludi0 -
no success yet, i tried this:
1) in Application.mk i set the APP_ABI := armeabi-v7a
2) then i copied all the .a from Photon-AndroidNDK-Sdk_v4-1-3-3\Photon-cpp\lib\photon-cpp-prebuilt to a folder in the same jni folder (there is an error in the mk files because there is no OBJ files for Photon-cpp)
3)so i can set in Android.mk:
LOCAL_SRC_FILES := libs/libphoton-cpp-static_release_android_$(TARGET_ARCH_ABI).a
4) then i call from a cygwin shell the command to build
/cygdrive/g/ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/Libs/P
hoton-AndroidNDK-Sdk_v4-1-3-3/LoadBalancing-cpp/jni
$ /cygdrive/e/UDK/nvpack/android-ndk-r12b/ndk-build.cmd NDK_PROJECT_DIR=./ NDK_
APPLICATION_MK=Application.mk
I got a "Access Denied", why?cloudapi/Libs/Photon-AndroidNDK-Sdk_v4-1-3-3/LoadBalancing-cpp/jni $ /cygdrive/e/UDK/nvpack/android-ndk-r12b/ndk-build.cmd NDK_PROJECT_DIR=./ NDK_ APPLICATION_MK=Application.mk [armeabi-v7a] "Compile++ thumb": "loadbalancing-cpp-static <= AuthenticationValu es.cpp" process_begin: CreateProcess(NULL, E:/UDK/nvpack/android-ndk-r12b/build//../tool chains/arm-linux-androideabi-4.9/prebuilt/windows /bin/arm-linux-androideabi-g++ -MMD -MP -MF G:/ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/L ibs/Photon-AndroidNDK-Sdk_v4-1-3-3/LoadBalancing-cpp/obj/local/armeabi-v7a/objs/ loadbalancing-cpp-static/__/src/AuthenticationValues.o.d -fpic -ffunction-sectio ns -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -march=arm v7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fno-exceptions -fno-rtti -mthumb -Os -D NDEBUG -I.. -IE:/UDK/nvpack/android-ndk-r12b/build//../sources/cxx-stl/llvm-libc ++/libcxx/include -IE:/UDK/nvpack/android-ndk-r12b/build//../sources/cxx-stl/llv m-libc++/../../android/support/include -IE:/UDK/nvpack/android-ndk-r12b/build//. ./sources/cxx-stl/llvm-libc++abi/libcxxabi/include -IE:/UDK/nvpack/android-ndk-r 12b/build//../sources/cxx-stl/llvm-libc++abi/libcxxabi/include -IE:/UDK/nvpack/a ndroid-ndk-r12b/build//../sources/android/support/include -IG:/ShivaProjects/Pho tonCloud/Plugins/com.xixgames.photoncloudapi/Libs/Photon-AndroidNDK-Sdk_v4-1-3-3 /LoadBalancing-cpp/jni -DANDROID -Wa,--noexecstack -Wformat -Werror=format-secur ity -std=c++11 -fno-strict-aliasing -D_EG_ANDROID_PLATFORM -frtti -isystem E:/UD K/nvpack/android-ndk-r12b/build//../platforms/android-9/arch-arm/usr/include -c G:/ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/Libs/Photon-And roidNDK-Sdk_v4-1-3-3/LoadBalancing-cpp/jni/../src/AuthenticationValues.cpp -o G: /ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/Libs/Photon-Andro idNDK-Sdk_v4-1-3-3/LoadBalancing-cpp/obj/local/armeabi-v7a/objs/loadbalancing-cp p-static/__/src/AuthenticationValues.o, ...) failed. make (e=5): Acceso denegado. make: *** [G:/ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/Libs /Photon-AndroidNDK-Sdk_v4-1-3-3/LoadBalancing-cpp/obj/local/armeabi-v7a/objs/loa dbalancing-cpp-static/__/src/AuthenticationValues.o] Error 5
0 -
(edited)0
-
(edited)0
-
(edited)0
-
(edited)0
-
(edited)0
-
(edited)0
-
Another thing i have tried is to change the line 20 in the Android.mk (Photon-AndroidNDK-Sdk-4-1-3-3/LoadBalancing/jni/Android.mk):
---
LOCAL_SRC_FILES := ../../Photon-cpp/lib/photon-cpp-prebuilt/libphoton-cpp-static_debug_android_$(TARGET_ARCH_ABI).a
---
so, they actually point to the prebuild libs.
Result:C:\Users\Usuario\Downloads\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp>e:\U DK\nvpack\android-ndk-r12b\ndk-build.cmd jni\Application.mk all make: Nothing to be done for `jni\Application.mk'. [arm64-v8a] "Compile++ ": "loadbalancing-cpp-static <= AuthenticationValues .cpp" process_begin: CreateProcess(NULL, e:/UDK/nvpack/android-ndk-r12b/build//../tool chains/aarch64-linux-android-4.9/prebuilt/windows /bin/aarch64-linux-android-g++ -MMD -MP -MF ./obj/local/arm64-v8a/objs/loadbalancing-cpp-static/__/src/Authent icationValues.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector-st rong -no-canonical-prefixes -g -fno-exceptions -fno-rtti -O2 -DNDEBUG -I.. -Ie:/ UDK/nvpack/android-ndk-r12b/build//../sources/cxx-stl/llvm-libc++/libcxx/include -Ie:/UDK/nvpack/android-ndk-r12b/build//../sources/cxx-stl/llvm-libc++/../../an droid/support/include -Ie:/UDK/nvpack/android-ndk-r12b/build//../sources/cxx-stl /llvm-libc++abi/libcxxabi/include -Ie:/UDK/nvpack/android-ndk-r12b/build//../sou rces/android/support/include -Ijni -DANDROID -Wa,--noexecstack -Wformat -Werror= format-security -std=c++11 -fno-strict-aliasing -D_EG_ANDROID_PLATFORM -frtti -i system e:/UDK/nvpack/android-ndk-r12b/build//../platforms/android-21/arch-arm64/ usr/include -c jni/../src/AuthenticationValues.cpp -o ./obj/local/arm64-v8a/objs /loadbalancing-cpp-static/__/src/AuthenticationValues.o, ...) failed. make (e=5): Acceso denegado. make: *** [obj/local/arm64-v8a/objs/loadbalancing-cpp-static/__/src/Authenticati onValues.o] Error 5 C:\Users\Usuario\Downloads\Photon-AndroidNDK-Sdk_v4-1-3-3\LoadBalancing-cpp>e:\U DK\nvpack\android-ndk-r12b\ndk-build.cmd jni\Application.mk all
0 -
Ok , I was able to compile it using OSX and changing the line of the Android.mk:
LOCAL_SRC_FILES := ../../Photon-cpp/lib/photon-cpp-prebuilt/libphoton-cpp-static_release_android_$(TARGET_ARCH_ABI).a LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)../../../Photon-cpp/inc
Result:LoadBalancing-cpp juaxix$ /Users/juaxix/Downloads/Android/android-ndk-r12b/build/ndk-build NDK_APPLICATION_MK=jni/Application.mk [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= AuthenticationValues.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= Client.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= FriendInfo.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= AuthenticationValuesSecretSetter.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= MutablePlayerFactory.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= MutableRoomFactory.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= PlayerFactory.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= PlayerMovementInformant.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= PlayerMutableRoomPointerSetter.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= PlayerPropertiesCacher.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= PlayerPropertiesUpdateInformant.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= RoomFactory.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= RoomPropertiesCacher.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= Utils.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= LobbyStatsRequest.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= LobbyStatsResponse.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= MutablePlayer.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= MutableRoom.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= Peer.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= Player.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= RaiseEventOptions.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= Room.cpp [armeabi-v7a] Compile++ thumb: loadbalancing-cpp-static <= RoomOptions.cpp [armeabi-v7a] StaticLibrary : libloadbalancing-cpp-static.a cp obj/local/arm64-v8a/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_arm64-v8a.a cp obj/local/x86_64/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_x86_64.a cp obj/local/mips64/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_mips64.a cp obj/local/armeabi-v7a/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_armeabi-v7a.a cp obj/local/armeabi/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_armeabi.a cp obj/local/x86/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_x86.a cp obj/local/mips/libloadbalancing-cpp-static.a lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_release_android_mips.a
0 -
Hi @juaxix.
The "access denied" error might come from unzipping the downloaded folder with Windows itself, which blocks all unzipped files from a downloaded zip-archive, so that you need to manually unblock them. This can be prevented by using a 3rd party program to unzip the archive, for example 7zip.
I can reproduce the obj folder issue when trying to build the LoadBalancing-cpp solution. We will fix this for the next release
However it is not necessary at all to rebuild LoadBalaning-cpp yourself, when you do not modify its source. You can just use the prebuilt libraries that ship with the SDK.
Note that LoadBalancing-cpp is not a demo or example project, but part of the Photon Client libraries and can normally just be used as is. For demo projects on how to use the libraries please look inside the "Demos" folder.0 -
ok, i see that if i use 7zip this problem is gone.Kaiserludi said:Hi @juaxix.
The "access denied" error might come from unzipping the downloaded folder with Windows itself, which blocks all unzipped files from a downloaded zip-archive, so that you need to manually unblock them. This can be prevented by using a 3rd party program to unzip the archive, for example 7zip.
I can't use the compiled lib, everything works in iOS but not in Android.Kaiserludi said:
I can reproduce the obj folder issue when trying to build the LoadBalancing-cpp solution. We will fix this for the next release
However it is not necessary at all to rebuild LoadBalaning-cpp yourself, when you do not modify its source. You can just use the prebuilt libraries that ship with the SDK.
I have this error when i try to use the compiled .a with the loadbalancing+common-cpp+photon-cpp libs (.a) inside a plugin.a for my game:C:/Games/sdks/android-ndk-r12b/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libS3DClient.so -shared --sysroot=C:/Games/sdks/android-ndk-r12b/build//../platforms/android-9/arch-arm ./obj/local/armeabi-v7a/objs/S3DClient/S3DClient.o -Wl,--whole-archive jni/prebuilt/plugins/armeabi-v7a/PhotonCloudAPI.a -Wl,--no-whole-archive jni/prebuilt/engine/armeabi-v7a/libS3DClient_Android.a C:/Games/sdks/android-ndk-r12b/build//../sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a -lgcc ./obj/local/armeabi-v7a/libopenal.so ./obj/local/armeabi-v7a/libssl.so ./obj/local/armeabi-v7a/libcrypto.so -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -LC:/Games/sdks/android-ndk-r12b/build//../platforms/android-9/arch-arm/usr/lib -lGLESv2 -lEGL -ldl -llog -lc -lm -o ./obj/local/armeabi-v7a/libS3DClient.so C:/Games/sdks/android-ndk-r12b/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.exe: error: jni/prebuilt/plugins/armeabi-v7a/PhotonCloudAPI.a: member at 246202 is not an ELF object C:/Games/sdks/android-ndk-r12b/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.exe: error: jni/prebuilt/plugins/armeabi-v7a/PhotonCloudAPI.a: member at 2934242 is not an ELF object C:/Games/sdks/android-ndk-r12b/build//../toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.exe: error: jni/prebuilt/plugins/armeabi-v7a/PhotonCloudAPI.a: member at 4720214 is not an ELF object jni/prebuilt/plugins/armeabi-v7a/PhotonCloudAPI.a(PhotonCloudAPI.o):PhotonCloudAPI.cpp:function Callback_PhotonCloudAPI_setNumberOfPingsPerRegion(int, S3DX::AIVariable const*, S3DX::AIVariable*): error: undefined reference to 'ExitGames::LoadBalancing::Client::M_PINGS_PER_REGION'
looks like the Photon libs are not a valid elf format, why is that?0 -
Hi @juaxix.
Yes, of course it is not a valid elf file. If it was, then the file ending would be .so. It is a static library, not a dynamic one, so you must link against it statically.0 -
Ok ,thanks, I've achieved to compile it statically, but i have a new error once i run the apk:Kaiserludi said:Hi @juaxix.
Yes, of course it is not a valid elf file. If it was, then the file ending would be .so. It is a static library, not a dynamic one, so you must link against it statically./dalvikvm(17802): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/xixgames/photondemo/PhotonCloud_Demo;
W/dalvikvm(17802): Class init failed in newInstance call (Lcom/xixgames/photondemo/PhotonCloud_Demo;)
D/AndroidRuntime(17802): Shutting down VM
W/dalvikvm(17802): threadid=1: thread exiting with uncaught exception (group=0x41724e48)
E/AndroidRuntime(17802): FATAL EXCEPTION: main
E/AndroidRuntime(17802): Process: com.xixgames.photondemo, PID: 17802
E/AndroidRuntime(17802): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSsC1EPKcRKSaIcE" referenced by "libS3DClient.so"...
E/AndroidRuntime(17802): at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime(17802): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime(17802): at com.xixgames.photondemo.PhotonCloud_Demo.(PhotonCloud_Demo.java:1638)
E/AndroidRuntime(17802): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime(17802): at java.lang.Class.newInstance(Class.java:1208)
E/AndroidRuntime(17802): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
E/AndroidRuntime(17802): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2119)
E/AndroidRuntime(17802): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
E/AndroidRuntime(17802): at android.app.ActivityThread.access$800(ActivityThread.java:139)
E/AndroidRuntime(17802): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
E/AndroidRuntime(17802): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(17802): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(17802): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(17802): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17802): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(17802): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
E/AndroidRuntime(17802): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
E/AndroidRuntime(17802): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 825): Force finishing activity com.xixgames.photondemo/.PhotonCloud_Demo
any idea of what's going on now?0 -
Hi @juaxix.
Sorry, but I am afraid I have never seen this error before.
My suggestion is to compare your Android.mk and Application.mk with the ones from the demos inside the SDK to see what you are doing differently.0 -
Ok, I can do that.
Ah, how can compile the .a as .so?0 -
how can compile the .a as .so?
You can't, at least when it comes to Common-cpp and Photon-cpp. What you could do is writing your own wrapper .so lib that exports all public functions of the .a, which it wraps, in its own interface.
You could rebuild LoadBalancing-cpp and Chat-cpp as .so, as they are open source, but o course you would need to export all public functions then, so you would need to do quite a bit of merging when updating the libs later.
My recommendation is to just let your app link the .a files directly, as I can't see any advantage in using .so files instead, that would be big enough to justify the additional work involved.0 -
Ok, I'm creating the .so now, but when i try to build ,if i use the android-ndk build for r12b and 4-1-3-3 android sdk, this error appears:"C:\\Games\\sdks\\android-ndk-r12b\\ndk-build.cmd"
[armeabi-v7a] SharedLibrary : libnative.so/android-ndk/build//../sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base:85: error: undefined reference to 'std::__ndk1::mutex::lock()'
/android-ndk/build//../sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base:90: error: undefined reference to 'std::__ndk1::mutex::unlock()'
/android-ndk/build//../sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base:85: error: undefined reference to 'std::__ndk1::mutex::lock()'
/android-ndk/build//../sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base:90: error: undefined reference to 'std::__ndk1::mutex::unlock()'
jni/../src/Internal/PeerBase.cpp:936: error: undefined reference to 'std::__ndk1::mutex::~mutex()'
I think this is an error from the oldest versions...here it is my application.mk and android.mk for this .so and .apk
Android.mkLOCAL_PATH := $(call my-dir)
PHOTON_SDK_ROOT := G:/ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/Libs/Photon-AndroidNDK-Sdk_v4-1-3-3
include $(CLEAR_VARS)
LOCAL_MODULE := loadbalancing-cpp-static-prebuilt
LOCAL_SRC_FILES := $(PHOTON_SDK_ROOT)/LoadBalancing-cpp/lib/loadbalancing-cpp-prebuilt/libloadbalancing-cpp-static_${APP_OPTIM}_android_$(TARGET_ARCH_ABI)$(MY_APP_NORTTI_SUFFIX).a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := photon-cpp-static-prebuilt
LOCAL_SRC_FILES := $(PHOTON_SDK_ROOT)/Photon-cpp/lib/photon-cpp-prebuilt/libphoton-cpp-static_${APP_OPTIM}_android_$(TARGET_ARCH_ABI)$(MY_APP_NORTTI_SUFFIX).a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := common-cpp-static-prebuilt
LOCAL_SRC_FILES := $(PHOTON_SDK_ROOT)/Common-cpp/lib/common-cpp-prebuilt/libcommon-cpp-static_${APP_OPTIM}_android_$(TARGET_ARCH_ABI)$(MY_APP_NORTTI_SUFFIX).a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := G:/ShivaProjects/PhotonCloud/Plugins/com.xixgames.photoncloudapi/Libs/Photon-AndroidNDK-Sdk_v4-1-3-3 ../inc/ ./
LOCAL_CFLAGS := -DEG_DEBUGGER -D__STDINT_LIMITS -D_EG_ANDROID_PLATFORM -DANDROID_NDK -Wno-psabi -fno-rtti -lstdc++ -std=c++11 -lgnustl_static -lsupc++
LOCAL_STATIC_LIBRARIES := loadbalancing-cpp-static-prebuilt photon-cpp-static-prebuilt common-cpp-static-prebuilt
LOCAL_MODULE := native
LOCAL_SRC_FILES := native.cpp
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -ldl -lstdc++ -std=c++11
include $(BUILD_SHARED_LIBRARY)
Application.mkAPP_OPTIM := release
APP_CFLAGS += -O3
APP_ABI := armeabi-v7a
APP_PLATFORM := android-14
APP_MODULES := S3DClient
APP_PROJECT_PATH :=
APP_STL := gnuport_static
do you see something wrong over there @Kaiserludi ?
Thanks for your time and help0 -
Hi @juaxix.
Please changeAPP_STL := gnuport_static
in your Application.mk intoAPP_STL :=c++_static
4.1.3.3 requires the use of libc++.
Please note that this is about to change. Starting with 4.1.4.0 we will require the following 2 settings in Application.mk:APP_STL := gnustl_static APP_CPPFLAGS := -std=c++11
instead.
You can have a look at the Application.mk and Android.mk file of any of the demos inside the SDK for an example of a working configuration.
0 -
Oh, thanks @Kaiserludi ,it compiles now, and the next error is really large and weird. (line 1917)
http://pastebin.com/7Mt5cUKR
for this code in C++ used as a wrapper in Java:
#include "jni.h"
#include "stdio.h"
#include "LoadBalancing-cpp/inc/Client.h"
#include "LoadBalancing-cpp/inc/Listener.h"
extern "C"
{
class myListener : private ExitGames::LoadBalancing::Listener {
public:
ExitGames::LoadBalancing::Client mLoadBalancingClient;
//Constructor
myListener(): mLoadBalancingClient(*this, "--myid--", "0.1", 0,true,0)
{
}
void connect(){
mLoadBalancingClient.connect(
ExitGames::LoadBalancing::AuthenticationValues()
.setUserID(
ExitGames::Common::JString() + GETTIMEMS()
).setType(
0
).setParameters("username=yes&token=yes")
);
}
};
static myListener* listen2;
JNIEXPORT void JNICALL Java_com_example_photontest_MainActivity_sayHello ( JNIEnv *_pEnv, jobject obj )
{
static myListener* listen;
printf("Connecting!\n");
listen->connect();
return;
}
JNIEXPORT jdouble JNICALL Java_com_example_photontest_MainActivity_average
(JNIEnv *env, jobject thisObj, jint n1, jint n2) {
jdouble result;
printf("In C, the numbers are %d and %d\n", n1, n2);
result = ((jdouble)n1 + n2) / 2.0;
// jint is mapped to int, jdouble is mapped to double
return result;
}
}
used from this java
package com.example.photontest;
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.view.Menu;
public class MainActivity extends Activity {
// Declare a native method sayHello() that receives nothing and returns void
public static native void sayHello();
public static native double average(int n1, int n2);
// load the library - name matches jni/Android.mk
static
{
System.loadLibrary("native");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String str = new String("In Java, the average is " + average(3, 2));
System.out.println(str);
new AlertDialog.Builder(this).setMessage(str).show();
sayHello();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
i just want to test if i can load the .a from a java using a c++ jni wrapper0 -
extern "C" { class
That extern "C" has no effect on the class inside the {}.
A C language linkage is ignored in determining the language linkage of the names of class
members and the function type of class member functions
Source: https://isocpp.org/files/papers/N3690.pdf
Regarding your error:
I don't see any obvious problems in your code that could cause this.
My suggestion is to track down what exactly is causing the problem.
DoesmyListener::connect()
crash when being called from one of the provided demos? If not, then you need to find out, what your testapp does differently from our demos.0 -
Thanks for the correction @Kaiserludi .
Well, finally i got it to compile your demoLoadbalancing project, the problem was that the directory was too deep in the hard-drive and it could not successfully copy files, I moved all to E:\.
Testing your demo it appears: received error 1030 from client and then 1040 and disconnect. Something wrong?, before I go forward and try to integrate my changes into loadbalancing for android again and recompile,...0 -
I think i'm very close to achieve it @Kaiserludi ! . A little more help
I was able to run with my code and test the game with your android demo and my loadbalancing code, as you see in the screenshots:
http://imgur.com/a/yAtDv
http://imgur.com/a/hDzHM
i've built the final plugin .a with my libs, everything compiled for debug, and now i dont know how to fix this compile error using the plugin.a in a game project for android
http://pastebin.com/PLXaSsDj
this is the Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := S3DClient_Android
LOCAL_SRC_FILES := prebuilt/engine/$(TARGET_ARCH_ABI)/libS3DClient_Android.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := openal
LOCAL_SRC_FILES := prebuilt/thirdparty/$(TARGET_ARCH_ABI)/libopenal.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ssl
LOCAL_SRC_FILES := prebuilt/thirdparty/$(TARGET_ARCH_ABI)/libssl.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := crypto
LOCAL_SRC_FILES := prebuilt/thirdparty/$(TARGET_ARCH_ABI)/libcrypto.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := PhotonCloudAPI
LOCAL_SRC_FILES := prebuilt/plugins/$(TARGET_ARCH_ABI)/PhotonCloudAPI.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
NDK_DEBUG_IMPORTS := 1
NDK_DEBUG_MODULES := 1
LOCAL_CFLAGS := -DANDROID_NDK -Wno-psabi -fno-rtti -std=c++11 -lstdc++ -lgnustl_static -lsupc++ -DEG_DEBUGGER -D__STDINT_LIMITS -D_EG_ANDROID_PLATFORM
LOCAL_ARM_MODE := arm
LOCAL_MODULE := S3DClient
LOCAL_MODULE_FILENAME := libS3DClient
LOCAL_SRC_FILES := S3DClient.cpp
LOCAL_STATIC_LIBRARIES := S3DClient_Android
LOCAL_SHARED_LIBRARIES := openal ssl crypto
LOCAL_WHOLE_STATIC_LIBRARIES += PhotonCloudAPI photon-cpp-static-prebuilt libcommon-cpp-static-prebuilt loadbalancing-cpp-static
LOCAL_LDLIBS += -lGLESv2 -lEGL -ldl -llog -latomic
include $(BUILD_SHARED_LIBRARY)
and application .mk
APP_OPTIM := debug
APP_CFLAGS += -O3
APP_ABI := armeabi-v7a
APP_PLATFORM := android-14
APP_MODULES := S3DClient
APP_PROJECT_PATH :=
APP_STL := c++_static
I'm following the demoBalancing project as example to build this but it fails...0 -
Hi @juaxix.
Testing your demo it appears: received error 1030 from client and then 1040 and disconnect. Something wrong?,
It seems you have solved that by now?
Getting these errors on trying to connect usually means the socket can't reach the server at all, which is usually caused by having no internet connecting, getting blocked by a firewall or trying to connect to an incorrect address, at which no Photon server is running.
Regarding the undefined references to the stdlib:
Well, from your log it looks like not the app, but the PhotonCloudAPI lib fails to build, but the .mk files that you show seem to be the ones for the app.0 -
Yes, I added my code to the loadbalancing in the demo project, recompiled and it workedKaiserludi said:Hi @juaxix.
It seems you have solved that by now?
Yeah, what I was showing is the built of the app (apk of the game), with the already built plugin PhotonCloudAPI.a, but now that you mention it, i think i'm not doing it rightKaiserludi said:
Regarding the undefined references to the stdlib:
Well, from your log it looks like not the app, but the PhotonCloudAPI lib fails to build, but the .mk files that you show seem to be the ones for the app.
I'm using a script to extract all the .o and then add the objects in the .a (I can't use the ar rcs option because the photon .a are not elf files).
C:\Games\sdks\android-ndk-r12b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar -x libcommon-cpp-static_debug_android_armeabi-v7a.a
C:\Games\sdks\android-ndk-r12b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar -x libloadbalancing-cpp-static_debug_android_armeabi-v7a.a
C:\Games\sdks\android-ndk-r12b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar -x libphoton-cpp-static_debug_android_armeabi-v7a.a
And this is the Makefile for the engine plugin + photon libs:
http://pastebin.com/RgpUMj1F
You know, originally, the engine generates an android project with that Makefile and with only the option of rcs ( $(AR) -rcs $(TARGET) $(OBJECTS)) ,so i changed it to be able to compile, with no success yet.
Ok, I'm compiling only for the arm-v7a with:make ../../Contents/Android/PhotonCloudAPI_Android_arm_v7a.a
these are the instructions of the makefile:
http://pastebin.com/f1V1guHs
Thanks @Kaiserludi0