I am trying to compile flac extensions to use with Android Studio, ExoPlayer in my project. I tried following the instructions in the ExoPlayer README however, I get the following error:
cd ExoPlayer
EXOPLAYER_ROOT="$(pwd)"
FLAC_EXT_PATH="${EXOPLAYER_ROOT}/extensions/flac/src/main"
NDK_PATH="~/Downloads/android-ndk-r17c"
cd "${FLAC_EXT_PATH}/jni"
mv ~/Downloads/flac-1.3.2 flac
${NDK_PATH}/ndk-build APP_ABI=all -j4
...:~/Downloads/ExoPlayer/extensions/flac/src/main/jni$
NDK_PATH=.../Downloads/android-ndk-r17c
...:~/Downloads/ExoPlayer/extensions/flac/src/main/jni$ ${NDK_PATH}/ndk-build APP_ABI=all -j4
Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in .../Downloads/ExoPlayer/extensions/flac/src/main/AndroidManifest.xml. NDK binaries will *not* be compatible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information.
[arm64-v8a] Compile : flacJNI <= format.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_framing.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_intrin_avx2.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_intrin_sse2.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_intrin_ssse3.c
[arm64-v8a] Compile : flacJNI <= window.c
.../Downloads/ExoPlayer/extensions/flac/src/main/jni/flac/src/libFLAC/format.c:47:45: error:
use of undeclared identifier 'VERSION'
FLAC_API const char *FLAC__VERSION_STRING = VERSION;
^
.../Downloads/ExoPlayer/extensions/flac/src/main/jni/flac/src/libFLAC/format.c:49:64: error:
expected ';' after top level declarator
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION ...
^
;
2 errors generated.
make: *** [/home/philip/Downloads/ExoPlayer/extensions/flac/src/main/obj/local/arm64-v8a/objs/flacJNI/flac/src/libFLAC/format.o] Error 1
make: *** Waiting for unfinished jobs....
How do I get this to work? Thanks.
To get the flac extensions to compile in Android Studio I needed to go to:
Tools | SDKManager | SDKTools and checked Cmake
Related
I'm trying to build the .so file from available NDK project. But I encounter the
undefined reference to 'jniRegisterNativeMethods' error when I try to compile the code using cmd with ndk-build
Here I'm posting the block of that execution
Android NDK: WARNING:jni/Android.mk:gba: non-system libraries in linker flags: -lnativehelper
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi] Compile++ arm : gba <= emulator.cpp
[armeabi] SharedLibrary : libgba.so
C:/sdk/android-ndk-r10e-windows-x86_64/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lnativehelper
jni/gbalib/nativehelper/JNIHelp.h:108: error: undefined reference to 'jniRegisterNativeMethods'
collect2.exe: error: ld returned 1 exit status
make.exe: *** [obj/local/armeabi/libgba.so] Error 1
E:\Android-Projects-Archieve\Library-Archives\gameboid>
I expect it to build an .so file called libgba.so Let me know in the comments if you need more info to look into this issue. Thanks in advance.
I got this error on the last version of the telegram.
telegram source code version: 4.9.0
envirement :
ubuntu 17.10.0
android studio:3.2 canary 9
ndk version: 14.1.3816874
[armeabi-v7a] Compile++ arm : tmessages.28 <= TgNetWrapper.cpp
/home/joker/telegram490/TMessagesProj/jni/./jni.c: In function
'listdir':
/home/joker/telegram490/TMessagesProj/jni/./jni.c:193:31: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec != 0) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:194:35: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec < time) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:198:35: error:
'struct stat' has no member named 'st_mtim'
if (attrib.st_mtim.tv_sec < time) {
^make: ***
[/home/joker/telegram490/TMessagesProj/build/intermediates
/ndkBuild/afat/
debug/obj/local/armeabi-v7a/objs-debug/tmessages.28/./jni.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/TLObject.h:13:0,
from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/ApiScheme.h:15,
from
/home/joker/telegram490/TMessagesProj/jni/./TgNetWrapper.cpp:2:
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h: In
function 'std::string to_string_uint64(uint64_t)':
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h:184:32:
error: expected ')' before 'PRIu64'
int len = sprintf(buf, "%" PRIu64, value);
Edit:
thanks to #anubhav-gupta, Through SDK Manager, I can only upgrade to version r18-beta1.
after the upgrade I face up with this error:
Android NDK: APP_STL gnustl_static is no longer supported. Please switch to either c++_static or c++_shared
Edit:
update NDK to r15 and The problem was solved.
The main problem is in this line 'struct stat' has no member named 'st_atim'
If you're using a modern version of the NDK, you'll have a modern struct stat: https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/stat.h
Note that you need to be using the NDK's unified headers to get the up to date headers. This is the default in r15, but opt-in for r14.
When I run the command
cocos compile -p android --ap android-15 --app-abi x86
I get the error
/audio/android/cutils/bitops.h: In function 'int bitmask_ffz(unsigned int*, int)':
/audio/android/cutils/bitops.h:65:30: error: 'ffs' was not declared in this scope
bit = ffs(~bitmask[i]);
^
[x86] Compile++ : audioengine_static <= AudioDecoderProvider.cpp
make: ** [obj/local/x86/objs-debug/audioengine_static/AudioDecoder.o] Error 1
make: ** Waiting for unfinished jobs....
make: Leaving directory `/DeneOyun/proj.android'
**Error running command, return code: 2.**
You probably upgraded NDK to version 15.
Add the following to your Android.mk:
APP_DEPRECATED_HEADERS := true
for more details: link
I have been following this tutorial http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI, however I dont seem to get it to compile when it comes to Compilation with NDK section. The following is the error that I get
Android NDK: WARNING: APP_PLATFORM android-17 is larger than android:minSdkVersion 7 in ./AndroidManifest.xml
[armeabi] Compile thumb : mp3lame <= bitstream.c
jni/./libmp3lame/bitstream.c:33:18: fatal error: lame.h: No such file or directory
compilation terminated.
make.exe: * [obj/local/armeabi/objs/mp3lame/./libmp3lame/bitstream.o] Error 1
I have added
LOCAL_C_INCLUDES += jni/include
to Android.mk, so it can find the ".h" needed.
I'm using android-ndk-r9b and cocos2d-x-2.1.4 under MacOs Mavericks. I was able to create the android application for cocos2d-x, but when I tried to compile the C++ code using ./build_native.sh script, the compiler get me some warnings and at the end failed.
These warnings are:
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING:/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
[armeabi] Compile thumb : cocos2dx_static <= quaternion.c
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/quaternion.c: In function 'kmQuaternionAssign':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/quaternion.c:478:5: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
[armeabi] Compile thumb : cocos2dx_static <= vec4.c
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/vec4.c: In function 'kmVec4Assign':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/vec4.c:150:5: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
[armeabi] Compile++ thumb: cocos2dx_static <= CCCommon.cpp
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLog(char const*, ...)':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp:54:77: error: format not a string literal and no format arguments [-Werror=format-security]
cc1plus: some warnings being treated as errors
I'm wondering if someone has encounter similar errors, how how to revolve it?
Thanks!
Same problem here (Cocos2DX 2.1.1)
http://www.cocos2d-x.org/forums/6/topics/32437?r=39742#message-39742
You can shut down the compiler error:
in Application.mk:
APP_CFLAGS += -Wno-error=format-security
or better, solve the problem of string format, in 4 points of cocos code (as you can see in the link above):
1 - CCCommon.cpp - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf); -> __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);
2 - SimpleAudioEngine.cpp - LOGD(deviceModel); -> LOGD("%s",deviceModel);
3 - OpenSLEngine.cpp - LOGD(errorInfo); -> LOGD("%s",errorInfo);
4 - SimpleAudioEngineOpenSL.cpp - LOGD(errorInfo); -> LOGD("%s",errorInfo);