As the title states : When running my Android hybrid (Java/C) project, I get this error :
08-07 12:49:54.933 4546-4557/editor.lua.com.luaeditor E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 10
java.lang.ExceptionInInitializerError
at editor.lua.com.luaeditor.Opengl_Renderer.onSurfaceChanged(Opengl_Renderer.java:28)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1381)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1312]: 2123 cannot locate 'srand'...
at java.lang.Runtime.loadLibrary(Runtime.java:434)
at java.lang.System.loadLibrary(System.java:554)
at editor.lua.com.luaeditor.Native.<clinit>(Native.java:12)
at editor.lua.com.luaeditor.Opengl_Renderer.onSurfaceChanged(Opengl_Renderer.java:28)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1381)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
To be safe, here are my build.grable :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "editor.lua.com.luaeditor"
minSdkVersion 10
targetSdkVersion 10
ndk {
cFlags "-NDK_HOST_32BIT 1"
cFlags "-std=c99"
moduleName "Lua_Editor"
ldLibs "GLESv2"
}
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
And here is my Manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="editor.lua.com.luaeditor">
<application android:allowBackup="true" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<activity
android:name=".Lua_Editor"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
By looking around the web and documentations, I found others have had the same issue : Android NDK: load_library: cannot locate srand The answer back then was to install the 32bit NDK.
With a little more digging around, i found that build-ndk had an option : NDK_HOST_32BIT 1
This option is supposed to force the NDK to compile to 32 bit.
Using Android Studio, so using gradle, i searched where i can add this option to configure the ndk, the only attempt that compiled was the attempt a pasted as my build.grable
Still, my error persists and I am keeping digging but the documentation on the android studio 1.3 preview ndk plugin seems low.
For information : I am running the app on an Samsung Galaxy S, compiling on a 64 bit Mint computer ( based on Ubuntu ).
So I am turning to you guys as a last resort. Am i stupid or am i stupid?