"CocosDenshion/android/SimpleAudioEngine" make error - android

I am trying to create a cocos2d-x-android demo and I got these errors.
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml "
"Android NDK: WARNING:/Users/linyou/Documents/cocos2d-x/F10Attack/proj.android/../../cocos2dx""/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
"Compile++ thumb : cocosdenshion_static <= SimpleAudioEngine.cpp"
"/Users/linyou/Documents/cocos2d-x/F10Attack/proj.android/../../CocosDenshion/android/SimpleAudioEngine.cpp: In constructor 'CocosDenshion::SimpleAudioEngine::SimpleAudioEngine()':
/Users/linyou/Documents/cocos2d-x/F10Attack/proj.android/../../CocosDenshion/android/SimpleAudioEngine.cpp:77:2: error: format not a string literal and no format arguments [-Werror=format-security]"
"cc1plus: some warnings being treated as errors"
"make: *** [obj/local/armeabi/objs/cocosdenshion_static/SimpleAudioEngine.o] Error 1
Can you help me? thanks!

haha,Nobody know the solution.Today,I have getten the solution. NDK r9 is the builder,the makelog code will be ERRORs. Maybe the cocos2dx team don't take notice of it.Want to fix it, Just delete it.

You can avoid this editing your configuration file
$PROJECT_HOME/proj.android/jni/Application.mk
adding this to the compiler flags
APP_CFLAGS += -Wno-error=format-security
So you will not get errors caused by that kind of warnings.

Related

android ndk project having error when loading the library

i am very new to the android ndk and opencv
but i have already run some samples/tutorials of opencv projects in Eclipse
therefore the opencv library should not be a problem
Here i want to run this camera project from github, i think it should work
After I downloaded it and import it into the Eclipse,
I encountered a problem :
When I run it it stops and finishes because the library cannot be loaded in the CameraActivity.
-> System.loadLibrary("PanoHDR");
I have tried to search the web for solutions but they either didn't work or I didn't understand them.
Do I need to do something like "ndk-build" at somewhere to make it work?
Could someone please help me? I cannot find any solution.
here is the default android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Tegra optimized OpenCV.mk
include /Users/milmil/Documents/NVPACK/OpenCV-2.4.5-Tegra-sdk-r2/sdk/native/jni/OpenCV-tegra3.mk
# Linker
LOCAL_LDLIBS += -llog
# Our module sources
LOCAL_MODULE := PanoHDR
LOCAL_SRC_FILES := PanoHDR.cpp Panorama.cpp HDR.cpp NativeLogging.cpp
include $(BUILD_SHARED_LIBRARY)
when i try to use ndk-build in cmd in the main dir of the project
it fails
jni/Android.mk:6: /sdk/native/jni/OpenCV.mk: No such file or directory
make: *** No rule to make target `/sdk/native/jni/OpenCV-tegra3'. Stop.
and it should be caused by this line in the Andriod.mk
include /Users/milmil/Documents/NVPACK/OpenCV-2.4.5-Tegra-sdk-r2/sdk/native/jni/OpenCV-tegra3.mk
I try to use the path of my opencv sdk
include /Android/OpenCV-3.1.0-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
and it returns this in the cmd
Android NDK: WARNING:jni/Android.mk:PanoHDR: non-system libraries in linker flag
s: -lopencv_java3
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_S
TATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependenc
ies of the
Android NDK: current module
[armeabi-v7a] "Compile++ thumb": "PanoHDR <= PanoHDR.cpp"
The system cannot find the path specified.
make: *** [obj/local/armeabi-v7a/objs/PanoHDR/PanoHDR.o] Error 1
Thank you
=========================================================================
WARNING:jni/Android.mk:PanoHDR: non-system libraries in linker flag
s: -lopencv_java3
the above problem is solved by adding "OPENCV_LIB_TYPE=STATIC" in the android.mk, but still has this error "
[armeabi-v7a] "Compile++ thumb": "PanoHDR <= PanoHDR.cpp"
The system cannot find the path specified.
make: *** [obj/local/armeabi-v7a/objs/PanoHDR/PanoHDR.o] Error 1"

Android NDK and functional (std::function) support

I tried to use std::function in my project, having read here and there that C++ 11 is quite well supported. However simply using std::function makes the build fail:
[armeabi] Compile++ thumb: MyAppNative <= MyAppNative.cpp
jni/MyAppNative.cpp: In function 'jint JNI_OnLoad(JavaVM*, void*)':
jni/MyAppNative.cpp:7:2: error: 'function' is not a member of 'std'
std::function<void()> func;
^
jni/MyAppNative.cpp:7:24: error: 'func' was not declared in this scope
std::function<void()> func;
^
make: *** [obj/local/armeabi/objs/MyAppNative/MyAppNative.o] Error 1
My question is: is std::function supposed to be supported? I've seen it conditionally defined in the header, depending on _STLP_USE_BOOST_SUPPORT. Is that normal? I have attached a sample project if anyone is interested in testing.
http://www.filedropper.com/cpp11-functional-issue
Cheers
STLport, which you seem to be using, has never had C++11 support.
See developer.android.com/ndk/guides/cpp-support.html at "How to set your runtime" and choose a different one (gnustl_static or c++_static).
Ok so thanks to Christian and Alex, the answer is indeed to change your Application.mk so that it references gnustl_static.
APP_STL := gnustl_static
Thank you all!

Undefined Reference to android::LPAPlayer::*

I am having great difficulty with a step in compiling CyanogenMod 11(Android 4.4) for an unsupported device based on an MSM7x27A/Snapdragon S1 platform. When I attempt to build libstagefright, I come up with an undefined reference error to functions in android::LPAPlayer::*, including the constructor. The error I get is:
Copying: /home/dyngar-f/android/android/out/target/common/obj/JAVA_LIBRARIES/mms-common_intermediates/noproguard.classes.jar
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1282: error: undefined reference to 'android::LPAPlayer::LPAPlayer(android::sp<android::MediaPlayerBase::AudioSink> const&, bool&, android::AwesomePlayer*)'
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1306: error: undefined reference to 'android::LPAPlayer::mObjectsAlive'
frameworks/av/media/libstagefright/AwesomePlayer.cpp:1882: error: undefined reference to 'android::LPAPlayer::mObjectsAlive'
collect2: error: ld returned 1 exit statusbuild/core/shared_library.mk:81: recipe for target '/home/dyngar-f/android/android/out/target/product/schS738c/obj/SHARED_LIBRARIES/libstagefright_intermediates/LINKED/libstagefright.so' failed
make: *** [/home/dyngar-f/android/android/out/target/product/schS738c/obj/SHARED_LIBRARIES/libstagefright_intermediates/LINKED/libstagefright.so] Error 1make: *** Waiting for unfinished jobs....
I have searched high and low and I found no mention of this error that leads me to a solution to this problem, and I haven't arrived at a solution myself. Here are the references to this issue I have found from others:
Gist from CMartinBaughman
Mentioned in XDA Thread on this page there is also an answer that doesn't seem to work.
Can anyone guide me to a solution for this issue?
The error is coming from the linker which is unable to find the reference to LPAPlayer which is actually a customization in CyanogenMod sources. From the latest tree, Android.mk for libstagefright is not including LPAPlayer.cpp for all platforms.
To resolve your issue, please try by adding the following files in Android.mk between lines 114-117
#New lines included
ifeq ($(call is-chipset-in-board-platform,msm7x27),true)
LOCAL_SRC_FILES += LPAPlayer.cpp
LOCAL_CFLAGS += -DLEGACY_LPA -DUSE_LPA_MODE
endif
ifeq ($(call is-chipset-in-board-platform,msm7x30),true)
LOCAL_SRC_FILES += LPAPlayer.cpp
LOCAL_CFLAGS += -DLEGACY_LPA -DUSE_LPA_MODE
endif
The platform name may need to be modified to suit the actual name (Please refer to BoardConfig.mk).

I am unable to ndk-build

aison#jaison-virtual-machine:~/Downloads/pjproject-2.2.1/pjsip-apps/src/pjsua/android$ ndk-build -fexceptions
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 15 in ./AndroidManifest.xml
Android NDK: WARNING:jni/Android.mk:pjsua: non-system libraries in linker flags: -lpjsua-arm-unknown-linux-androideabi -lpjsip-ua-arm-unknown-linux-androideabi -lpjsip-simple-arm-unknown-linux-androideabi -lpjsip-arm-unknown-linux-androideabi -lpjmedia-codec-arm-unknown-linux-androideabi -lpjmedia-arm-unknown-linux-androideabi -lpjmedia-videodev-arm-unknown-linux-androideabi -lpjmedia-audiodev-arm-unknown-linux-androideabi -lpjmedia-arm-unknown-linux-androideabi -lpjnath-arm-unknown-linux-androideabi -lpjlib-util-arm-unknown-linux-androideabi -lsrtp-arm-unknown-linux-androideabi -lresample-arm-unknown-linux-androideabi -lgsmcodec-arm-unknown-linux-androideabi -lspeex-arm-unknown-linux-androideabi -lilbccodec-arm-unknown-linux-androideabi -lg7221codec-arm-unknown-linux-androideabi -lpj-arm-unknown-linux-androideabi -lgnustl_static -lgcc
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
make: exceptions: No such file or directory
make: *** No rule to make target `exceptions'. Stop.
I am getting that error while doing ndk-build in Ubuntu.
Please help me.
Thanks in advance.
Use ndk-build APP_CPPFLAGS=-fexceptions, or better set this flag in file Application.mk.

Android-NDK build system (building hello-gl2)

I downloaded and installed Android-NDK on my Archlinux, using this package.
Got no issues building (and running) the sample hello-jni following the guide on this page, but if I try to do the same with hello-gl2 I get some errors; it looks like it cannot find some header files:
$ ../../ndk-build
/usr/bin/make -f /opt/android-ndk/build/core/build-local.mk
Compile++ thumb : gl2jni <= gl_code.cpp
/opt/android-ndk/samples/hello-gl2/jni/gl_code.cpp:22:23: error: GLES2/gl2.h: No such file or directory
/opt/android-ndk/samples/hello-gl2/jni/gl_code.cpp:23:26: error: GLES2/gl2ext.h: No such file or directory
--- SNIP ---
GLES2/gl2.h and GLES2/gl2ext.h are however present in $(NDK)/platforms/android-4/arch-arm/usr/include/, and it looks like$(NDK)/build/core/setup-toolchain.mk should set such include path.
Has anybody encountered the same issue? How can I compile this sample?
And then, are there other options to easily build Android-NDK applications? This build system seems quite complicated to me, and I'd prefer using cmake to build my applications.
make sure that APP_ABI and APP_PLATFORM is defined in your Application.mk and your APP_PLATFORM should be higher than android-5... check: gl.h & glext.h not found
for example, in Application.mk define:
APP_ABI := armeabi #armeabi-v7a
APP_STL := stlport_static
APP_PLATFORM := android-8
In my case it was missing the file default.properties with such content:
target=android-5
Put this file into the root project directory. It may help.
You need to use a higher SDK. Level 5 is the minimum to build OpenGL ES 2 code.

Categories

Resources