I took the source of AndEngine from their git repo, downloaded a fresh AndroidStudio, sdk and ndk,imported it, and tried to creat a simple new empty GameActivity extends BaseGameActivity.
But I could not start it, cause I get the following errors:
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:9: error: undefined reference to 'glVertexAttribPointer'
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glDrawElements:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:13: error: undefined reference to 'glDrawElements'
Error:Execution failed for task ':andEngine:compileReleaseNdk'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/uhu/android-ndk-r9d/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/Android.mk APP_PLATFORM=android-15 NDK_OUT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj NDK_LIBS_OUT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/lib APP_ABI=all
Error Code:
2
Output:
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:9: error: undefined reference to 'glVertexAttribPointer'
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glDrawElements:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:13: error: undefined reference to 'glDrawElements'
collect2: ld returned 1 exit status
make: * [/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/libandengine_shared.so] Error 1
Does anyone know how to fix this? Or if I'm just using the wrong tools, what can you recommend?
I managed to get my project to compile. The problem seems to me that AS and ndk dont work together well yet. Any case check my blog on setting up the project:-
AS and AndEngine setup
It seems to be easier using the official intellij version instead of android studio. And as both are very similar in use, it't doesn't really matter. Together with some ndk-build hints from the answer of lakshman5876, it finally worked very well. Thanks
http://www.jetbrains.com/idea/
Related
I'm building an app in ionic/Cordova in which I want my users to be able to log in using Facebook. So I'm trying to install the PhonegapFacebookPlugin that I found on ngCordova.com.
The first thing that I noticed was that the docs on the ngCordova.com website for installing the plugin on Android are different from the docs on the project's github docs. So I first tried using the (simpler) instructions on the github page first, which after installing and trying to use the following code:
facebookConnectPlugin.login(['email'],
function(data){ console.log(JSON.stringify(data));},
function(error){console.log(error);});
led to these errors:
file:///android_asset/www/lib/phonegap-facebook-plugin-master/facebookConnectPlugin.js: Line 181 : Uncaught ReferenceError: require is not defined
file:///android_asset/www/js/app.js: Line 23 : Uncaught TypeError: Cannot read property 'Keyboard' of undefined
file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 19387 : TypeError: Cannot call method 'login' of undefined
at Scope.$scope.fbLogin (file:///android_asset/www/js/controllers.js:10:31)
at $parseFunctionCall (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20124:18)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50863:9
at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22178:28)
at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22276:23)
at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:50862:13)
at HTMLButtonElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10823:21)
at triggerMouseEvent (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2811:7)
at tapClick (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2800:3)
at HTMLDocument.tapTouchEnd (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2918:5)
After running into these errors, I tried continuing with the more extensive installation instructions on the ngCordova website, but the following command:
android update project --subprojects --path "platforms/android" --target android-19 --library "com.phonegap.plugins.facebookconnect/FacebookLib"
led to the following error:
Resolved location of library project to: /Users/kramer65/repos/my-app/platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib
Error: Project folder '/Users/kramer65/repos/my-app/platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib' is not a valid directory.
Error: No Android Manifest at: /Users/kramer65/repos/my-app/platforms/android/com.phonegap.plugins.facebookconnect/FacebookLib
This makes sense, because there is no folder called com.phonegap.plugins.facebookconnect/ in the platforms/android/ folder. I don't really know why not though. Do I need to copy-paste it there? Or did something go wrong in a previous step?
I'm stuck here and I really need to get this working. Any help would be greatly appreciated!
I try to develop an Android app using Gstreamer. I use Fedora 20 with installed Eclipse with ADT and NDT, Android SDK and NDK, gstreamer SDK for Android. But something goes wrong, when I try to build tutorials.
Everything is OK, when I build NDK samples (like hello-jni), but building is not complited working with samples from gstreamer SDK (definitely it is android-tutorial-1 from [gstreamer sdk installation]/share/gst-sdk/tutorials/). Here is what i see in log:
13:13:10 **** Auto Build of configuration Default for project Tutorial1 ****
/home/staslatgttt/work/android-ndk-r10c/ndk-build all
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
GStreamer : [LINK] => gst-build/libgstreamer_android.so
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libgstreamer-0.10.a(libgstparse_la-lex.priv_gst_parse_yy.o): in function priv_gst_parse_yylex:lex.priv_gst_parse_yy.c:1598: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libglib-2.0.a(libcharset_la-localcharset.o): in function _g_locale_get_charset_aliases:localcharset.c:158: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libglib-2.0.a(libcharset_la-localcharset.o): in function _g_locale_get_charset_aliases:localcharset.c:167: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libintl.a(localcharset.o): in function locale_charset:./localcharset.c:195: error: undefined reference to '__srget'
/home/staslatgttt/work/android-ndk-r10c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: /home/staslatgttt/work/gstreamer-sdk-android-arm-debug-2013.6//lib/libintl.a(log.o): in function __sputc:/home/slomo/Projects/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.7/include-fixed/stdio.h:376: error: undefined reference to '__swbuf'
collect2: ld returned 1 exit status
make: *** [buildsharedlibrary] Error 1
13:13:11 Build Finished (took 972ms)
I tried to surf Internet, but I didn't find useful explanation how to solve this problem. All I understood is that problem is connected to Gold Linker. Only on this site http://docs.gstreamer.com/display/GstSDK/Installing+for+Android+development is a small tip about problems with Gold Linker on Windows, but I use Linux! Anyway, if I wanted to solve this problem on Windows, "this project" link mentioned there is not avaliable.
Can anyone help me with this? I don't know, what I do wrong, but I really need to solve this problem.
The NDK r10c wasn't support till 11-10-2014.
"The Android binaries are now built with the r10c NDK and as such binary compatible again with all NDK and Android releases" - http://gstreamer.freedesktop.org/
Try it again with the latest NDK and GStreamer Android SDK.
I encountered the same error... Google removed __srget starting from NDKr10c (check their official site in other fixed bugs). Downgrade to r10b or below and it should work.
I wanted to try out PocketSphinxAndroidDemo. I thought I meticulously followed the tutorial on how to get it running here: https://sites.google.com/site/opiatefuchs/home/pocketsphinxandroiddemo
But I must be missing something. I get the following error when I do a run as as an android application from eclipse:
jni/pocketsphinx_wrap.c:760:26: fatal error: pocketsphinx.h: No such file or directory
compilation terminated.
make: * [obj/local/armeabi/objs-debug/pocketsphinx_jni/pocketsphinx_wrap.c] Error 1
I'm leaning towards maybe I did the ndk-build wrong - but it all seemed to work properly in the cygwin terminal.
I'm hoping someone can point me in the right direction. Thanks.
I've reviewed this previous post and it does not seem to contain an answer for me:
http://sourceforge.net/p/cmusphinx/discussion/help/thread/8369b305/
I want to develop and android application which will help annotate the PDF files in android. Thus, I am using MuPDF to read and Parse the PDF files in android. I am trying to build it as specified in http://www.mupdf.com/doc/how-to-build-mupdf-for-android , but I have encountered the following error:
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:182: error: undefined reference to 'fz_unpack_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:193: error: undefined reference to 'fz_decode_indexed_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:200: error: undefined reference to 'fz_decode_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(load-tiff.o): in function fz_load_tiff:jni/../../../source/fitz/load-tiff.c:804: error: undefined reference to 'fz_unpack_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(load-png.o): in function fz_load_png:jni/../../../source/fitz/load-png.c:567: error: undefined reference to 'fz_unpack_tile'
On analyzing the first error, I understood that fz_unpack_tile, fz_decode_tile, fz_decode_indexed_tile are defined in fitz/draw-unpack.c
Now, I am not sure of how to continue from here
You asked this on irc yesterday, and I suggested that you do a complete clean, then rebuild from scratch capturing the logs and post them somewhere.
The code as supplied in git builds just fine in android for us. Without more information, no one is going to be able to help you.
I found a method for importing 3D models to Android's OpenGL on Stackoverflow here:
Is there a way to import a 3D model into Android?
Attempting to follow the instructions I copied the source and tried to compile the program. I got a massive number of errors, here is just a small sample:
/tmp/ccPavSpL.o:OFF-OpenGL_loader.cc:(.text+0xd): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::size() const'
I think the problem was I wasn't passing in arguments to the program, so I tried passing arguments like so:
$ gcc OFF-OpenGL_loader.cc circle.off output.xml
(My .off file was in the same directory as the other source files and the output.xml was also in the same file.)
I got these errors
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:circle.off: file format not recognized;
treating as linker script
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:circle.off:2: syntax error
collect2: ld returned 1 exit status
Anyway so I have a feeling I wasn't supposed to have an output.xml file but when I didn't have one then it gave me a file not found error.
The opensource files were not in actual files so I feel like I should show you all my files and I feel weird uploading someone else's source to a github repo, so here is a rapid share link to the source files:
http://d01.megashares.com/dl/2YylIbE/SourceCodeAnd.offFile.zip
I feel weird sharing files like this^^ but I don't really see any other option. It just contains my .off file and .xml file and the C and C++ files.
Any help would be greatly appreciated, I've spent the past few days stuck on this.
Thanks!
Edit
So I ran it with g++ and with no parameters and these were the results:
$ g++ OFF-OpenGL_loader.cc
/tmp/ccNFneYn.o:OFF-OpenGL_loader.cc:(.text+0x1aa): undefined reference to
`ReadFile::getExtension(char*)'/tmp/ccNFneYn.o:
OFF-OpenGL_loader.cc:(.text+0x2f8): undefined reference to
operator>>(std::basic_ifstream<char, std::
char_traits<char> >&, ReadFile&)'/tmp/ccNFneYn.o:OFF-
OpenGL_loader.cc:(.text+0x6de): undefined reference to `ReadFile::ReadFile()'/tmp/ccNFneYn.o:OFF-
OpenGL_loader.cc:(.text+0x6f9): undefined reference to `ReadFile::~ReadFile()'/usr/lib/gcc/i686-pc-
cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
/tmp/ccNFneYn.o: bad reloc address 0x1c in section
`.gcc_except_table'/usr/lib/gcc/i686-pc-cygwin/3.4.4/.
./../../../i686-pc-cygwin/bin/ld: final link failed:
Invalid operationcollect2: ld returned 1 exit status
What kind of errors am I looking for?
The problem was that when I ran my program in Visual Studio it would both compile and run the program, and because the source required parameters to be run, it would come up with runtime errors.
Then because I didn't know how to pass parameters to programs in visual studio, I tried using Cygwin which gave me errors, probably because it wasn't configured correctly. Not really sure why those errors happened.
So to solve this whole thing I just built my program with Visual Studio, navigated to the .exe file that it creates when it compiles, and then ran that .exe in the command line.
So the moral of the story is: always remember that when you hit that green play button, it both compiles and runs the program. So if your error has to do with the circumstances that you run your program in, you might get errors even if your code is perfectly fine.
Thanks Bo Persson for helping me get that idea!