Gradle似乎没有建立我所包含的项目:
FATAL EXCEPTION: main
Process: com.projecttango.examples.cpp.planefitting, PID: 14678
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/libtango_device2.jar", zip file "/data/app/com.projecttango.examples.cpp.planefitting-1/base.apk"],nativeLibraryDirectories=[/data/app/com.projecttango.examples.cpp.planefitting-1/lib/arm, /data/app/com.projecttango.examples.cpp.planefitting-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libcpp_plane_fitting_example.so"
在我的主build.gradle
:
dependencies {
compile project(':cpp_example_util')
}
我的顶级build.gradle
:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的外部项目的build.gradle
:
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion "24"
defaultConfig {
minSdkVersion 17
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
def external_lib_prefix = null
if (project.hasProperty("Tango.catkin_devel_prefix")) {
external_lib_prefix = project.property("Tango.catkin_devel_prefix")
}
settings.gradle
:
include ':app'
include ':cpp_example_util'
project(':cpp_example_util').projectDir = new File('../cpp_example_util/app')
如错误所示,没有构建libcpp_plane_fitting_example
库。
答案 0 :(得分:0)
由于错误读取couldn't find "libcpp_plane_fitting_example.so"
,看起来您的NDK配置存在一些错误,这可能是它无法访问本机代码的原因。
要处理 UnsatisfiedLinkError ,请使用
static {
System.loadLibrary("yourlibraryname");
}
并确保包签名正确无误。