rosjava / android_core

Android libraries for rosjava
145 stars 166 forks source link

catkin_make error with android ndk #295

Closed gongyue666 closed 5 years ago

gongyue666 commented 5 years ago

hi, nowadays I follow the tutorial:" Wrapping your native code as a rosjava node", when I catkin_make for the jni (2.1-7), error comes:Process 'command '/home/gy/Android/Sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2. the steps before 2.1-7 I have finished successfully.my sdk tool version is 25.0.2, sdk have 25,21,18,15,13.10, and my ubuntu is 16.04 ros Kinetic.here is my `Android.mk:LOCAL_PATH := $(call my-dir) ROS_NDK_PATH := /home/gy/ros-android-ndk/roscpp_android/output/target

include $(CLEAR_VARS) LOCAL_MODULE := chatter_jni LOCAL_SRC_FILES := src/chatter_jni.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/include LOCAL_LDLIBS := -landroid -llog LOCAL_STATIC_LIBRARIES := ROS_NDK_PATH include $(BUILD_SHARED_LIBRARY)

$(call import-add-path, /home/gy/ros-android-ndk/roscpp_android/output) $(call import-module, ROS_NDK_PATH) and this is build.gradle under app folder: dependencies { compile('org.ros.android_core:android_10:[0.3, 0.4)') { exclude group: 'junit' exclude group: 'xml-apis' } }

apply plugin: 'com.android.application'

tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild }

task ndkBuild(type: Exec) { Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) def ndkbuild = properties.getProperty('ndk.dir', null) commandLine ndkbuild + '/ndk-build', '-C', file('src/main/jni').absolutePath }

android { compileSdkVersion 25 defaultConfig { minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" } sourceSets.main { jniLibs.srcDir 'src/main/libs'; jni.srcDirs = [] } }` where is the bug?plz help~

gongyue666 commented 5 years ago

here is my project :https://github.com/gongyue666/ros-ndk/tree/master/androidpkg1, plz point out my faults, thx very much~

gongyue666 commented 5 years ago

I slove the problem.I copy ~/ros-android-ndk/roscpp_android/output/target/lib(and inlcude) to ~/ros-android-ndk/roscpp_android/output/roscpp_android_ndk/, these should be there when make ros-android-ndk pkg, but I don't know mine not.