現在、NDK プロジェクトに取り組んでおり、.so
ファイルが.apk
. ただし、.so
ファイルは作成されており、app/src/main/libs/$arch
. アプリをデバッグすると、次のエラーが表示されます。
07-19 09:32:43.558 8530-8530/com.example.SanAngeles E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.SanAngeles, PID: 8530
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.SanAngeles-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.SanAngeles-2/lib/x86_64, /vendor/lib64, /system/lib64]]] couldn't find "libsanangeles.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.example.SanAngeles.GLES20Activity.<clinit>(GLES20Activity.java:133)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
現在classpath 'com.android.tools.build:gradle-experimental:0.8.0-alpha4'
、メインのgradleファイルで使用しています。アプリのグラドルは次のとおりです。
apply plugin: 'com.android.model.application'
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile 'com.android.support:support-v4:24.1.+'
}
model {
android {
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
defaultConfig.with {
applicationId = 'com.example.SanAngeles'
minSdkVersion.apiLevel = 11
targetSdkVersion.apiLevel = 23
buildConfigFields {
create() {
type "int"
name "VALUE"
value "1"
}
}
}
buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}
ndk {
moduleName "sanangeles"
stl "stlport_static"
CFlags.add("-I../../common/freetype/include")
CFlags.add("-DANDROID_NDK")
CFlags.add("-DDISABLE_IMPORTGL")
CFlags.add("-DFT2_BUILD_LIBRARY=1")
ldLibs.add("EGL")
ldLibs.add("android")
ldLibs.add("GLESv2")
ldLibs.add("dl")
ldLibs.add("log")
ldLibs.add("mui")
}
sources {
main {
java {
source {
srcDir "src"
}
}
jni {
exportedHeaders {
srcDirs = ["../../common/freetype/include"]
srcDirs += ["../../common/freetype/include/freetype"]
srcDirs += ["../../common/freetype/include/freetype/config"]
}
source {
srcDir "../../common/src"
include "../../common/freetype/src/autofit/autofit.c"
include "../../common/freetype/src/base/basepic.c"
include "../../common/freetype/src/base/ftapi.c"
...
}
}
}
}
}
}