android-ndk

Android NDK app failed to load library

心不动则不痛 提交于 2020-01-14 14:14:50
问题 My native library code: #include <string.h> #include <jni.h> jstring Java_com_mindtherobot_samples_ndkfoo_NdkFooActivity_invokeNativeFunction(JNIEnv* env, jobject javaThis) { return env->NewStringUTF("Hello from native code!"); } Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libpacman LOCAL_SRC_FILES := main.cpp LOCAL_CFLAGS := -DANDROID_NDK LOCAL_LDLIBS := -llog include $(BUILD_SHARED_LIBRARY) MainActivity.java: public class MainActivity extends Activity {

Android NDK can't find stlport

痞子三分冷 提交于 2020-01-14 14:11:16
问题 I'm trying to compile a native library (derived from WebRTC) by using android NDK rev8b. I get the following error: android_ndk/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: cannot find -lstlport_static So it can't find the stl library. I have installed libmagic-dev . The version of the distribution (as returned by /proc/version ) is: Linux version 2.6.32-40-generic (buildd

Android NDK can't find stlport

主宰稳场 提交于 2020-01-14 14:09:44
问题 I'm trying to compile a native library (derived from WebRTC) by using android NDK rev8b. I get the following error: android_ndk/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: cannot find -lstlport_static So it can't find the stl library. I have installed libmagic-dev . The version of the distribution (as returned by /proc/version ) is: Linux version 2.6.32-40-generic (buildd

Crash when parsing protobuf message containing a string using C++ and Android NDK

北战南征 提交于 2020-01-14 13:27:09
问题 I have two programs, both running on an Android 2.3.4 platform - one is a C++ binary in a daemon form, compiled with cmake, the other is a apk with jni part compiled with ndk-build. I'm using android-ndk-r6. I'm using protobuf messages and local unix sockets to pass data between them. I'm using the SerializeAsString and ParseFromString methods. Here is a snippet AbstractMessage protobuff_msg; protobuff_msg.set_id ( 1 ); //TODO: for now hardcoded, later can be used for request-response pairs

hold in “Trying to load lib” and no return for ever

夙愿已清 提交于 2020-01-14 12:54:30
问题 I have a old app written by C++, I am trying to port it to android , and debug it with eclipse, but the project is stopping with an error message : 10-03 12:21:55.344: D/dalvikvm(15262): Trying to load lib /data/data/com.android.test/lib/libtest.so 0x40effa48 The application just stops without giving any other message. I don't know how to do continue. 回答1: I have the same problem but it is caused by this bug So simply remove NDK_TOOLCHAIN_VERSION=4.7 from your Application.mk i have this only

Android NDK: Function va_start / va_end could not be resolved

 ̄綄美尐妖づ 提交于 2020-01-14 12:53:30
问题 I trying to use va_start and va_end functions in my project, but eclipse don't want to resolve it as functions. gcc compiles whole project without errors... [myfile.cpp] #include <stdio.h> #include <stdarg.h> [...] inline void ShowDbgMsg( const char* str, ... ) { va_list argptr; va_start(argptr, str); vprintf(str, argptr); va_end(argptr); } [...] [Android.mk] [...] LOCAL_C_INCLUDES := jni/pvrTools/ jni/igel/ $(STLPORT_BASE)/stlport [...] Eclipse says: [...] Description Resource Path Location

How do I turn on RTTI with Cygwin?

柔情痞子 提交于 2020-01-14 12:37:27
问题 When my Android NDK C++ native code is compiled, the following error appears: error: 'dynamic_cast' not permitted with -fno-rtti Someone told me to turn on RTTI, but I didn't know how to do. Do I need to modify Application.mk or what? my Application.mk : # it is needed for ndk-r5 APP_STL := stlport_static APP_ABI := armeabi armeabi-v7a APP_MODULES := cocos2d cocosdenshion chipmunk box2d tempestkeep When I add APP_CPPFLAGS += -frtti in some .o file appears another error: undefined reference to

gradle experimental include file directories via srcDir srcFile directive

戏子无情 提交于 2020-01-14 10:39:44
问题 Does anyone knows how the includes of srcDir works in gradle experimental files (cpp AND h)? This is kind of a "3-fold" question: 1°) how do the srcDir work? 1.a°) Does it include recursively all subdirs? Does it only include files at their deep level? Does it they include all cpp/c/cc/cxx files? for example this command: android.sources { main { jni { source { srcDir "../../../../some/path/src" } } } } Does it include all cpp files under src? all files under src? all cpp files recursively

Android C library built on OS X and “ranlib: warning for library…”

假如想象 提交于 2020-01-14 08:14:46
问题 When I tried to build my c library on OS X 10.7.3, I use android-sdk-mac2.2, sdk tools version is 12, and use android-ndk-r6. When I finished my compiling it said : ranlib: warning for library libsystem.a the table of contents is empty (no object file members in the library define global symbols) I tried to use this libsystem.a , and it said could not read symbols: Archive has no index , run ran lib to add one . Is anyone knowing why? And what should I do to compile successfully ? Thanks very

Android JNI APK Packing

本小妞迷上赌 提交于 2020-01-14 07:46:37
问题 I have implemented a JNI android application. This application requires a few additional 'Shared Libs' to be packed as part of the APK. Using Ecplise, I have added these libs to the project's '/libs/armeabi' folder. However, when launching the application (through the integrated debugger), my added 'Shared Libs' are removed from the 'armeabi' folder. How can I prevent these additional libs from being removed? How can I make sure the additional required SOs are packed in the APK? 回答1: You don