LibGDX on Netbeans and Android - android

I am trying to run my application that uses LibGDX on Andriod using the NetBeans IDE.
However the game crashes for some reason, I just got the "This application have stopped to work" message when I try to run the application. Everything works great on PC, so apparently I have missed something in the andriod set up. Setting up an andriod project on NetBeans is not an documented area and things seem to be different on Eclipse.
If someone have manged to run LibGDX on andriod by setting up the project in Netbeans, please share the steps you did.
Some code, I doubt that would help through:
public class Game extends AndroidApplication {
public void onCreate (android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initialize((ApplicationListener) new game.GameSystem(new Size2i(100, 100)), false);
}
}
The debug output I get is the following:
D/dalvikvm( 478): Trying to load lib /data/data/com.RPGGame/lib/libgdx.so 0x40515708
D/dalvikvm( 478): Added shared lib /data/data/com.RPGGame/lib/libgdx.so 0x40515708
D/dalvikvm( 478): No JNI_OnLoad found in /data/data/com.RPGGame/lib/libgdx.so 0x40515708, skipping init
D/AndroidRuntime( 478): Shutting down VM
W/dalvikvm( 478): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 478): FATAL EXCEPTION: main
E/AndroidRuntime( 478): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.RPGGame/com.RPGGame.MainActivity}: java.lang.ClassCastException: game.GameSystem
E/AndroidRuntime( 478): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 478): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 478): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 478): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 478): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 478): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 478): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 478): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 478): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 478): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 478): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 478): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 478): Caused by: java.lang.ClassCastException: game.GameSystem
E/AndroidRuntime( 478): at com.RPGGame.MainActivity.onCreate(MainActivity.java:11)
E/AndroidRuntime( 478): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 478): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime( 478): ... 11 more
W/ActivityManager( 104): Force finishing activity com.RPGGame/.MainActivity
W/ActivityManager( 104): Activity pause timeout for HistoryRecord{40512238 com.RPGGame/.MainActivity}
D/dalvikvm( 408): GC_EXPLICIT freed 8K, 54% free 2537K/5511K, external 1625K/2137K, paused 102ms
W/ActivityManager( 104): Activity destroy timeout for HistoryRecord{40512238 com.RPGGame/.MainActivity}
D/dalvikvm( 420): GC_EXPLICIT freed 324K, 55% free 2532K/5511K, external 1625K/2137K, paused 183ms
D/dalvikvm( 322): GC_EXPLICIT freed 9K, 55% free 2589K/5703K, external 1625K/2137K, paused 72ms
So basically I cannot cast game.GameSystem to ApplicationListener. Even if GameSystem implements ApplicationListener.
GameSystem works as intended on PC, all I did for the Andriod project was to put that code in the main file.

Okay, I solved it now, turned out I used the wrong version of game.GameSystem.

Related

Genymotion with Cocos2d-x v3.11

I am using cocos2d-x v3.11 on mac and using Genymotion virtual devices.
In my /jni/Application.mk, I've put,
APP_ABI :=armeabi armeabi-v7a
APP_ABI :=x86
But always same error comes NO_MATCHING_ABIS and the app doesn't launch on the genymotion.
Though error log may not be needed but here it is:
D/dalvikvm( 1893): Late-enabling CheckJNI
I/ActivityManager( 587): Start proc org.company.numbergame for activity org.company.numbergame/org.cocos2dx.cpp.AppActivity: pid=1893 uid=10060 gids={50060, 3003}
D/dalvikvm( 1893): Trying to load lib /data/app-lib/org.company.numbergame-1/libMyGame.so 0xa4fe4688
E/dalvikvm( 1893): dlopen("/data/app-lib/org.company.numbergame-1/libMyGame.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
D/AndroidRuntime( 1893): Shutting down VM
W/dalvikvm( 1893): threadid=1: thread exiting with uncaught exception (group=0xa4d17b20)
E/AndroidRuntime( 1893): FATAL EXCEPTION: main
E/AndroidRuntime( 1893): Process: org.company.numbergame, PID: 1893
E/AndroidRuntime( 1893): java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib/libhoudini.so" not found
E/AndroidRuntime( 1893): at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime( 1893): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime( 1893): at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:246)
E/AndroidRuntime( 1893): at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:260)
E/AndroidRuntime( 1893): at android.app.Activity.performCreate(Activity.java:5231)
E/AndroidRuntime( 1893): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1893): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
E/AndroidRuntime( 1893): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
E/AndroidRuntime( 1893): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 1893): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 1893): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1893): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 1893): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 1893): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1893): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1893): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 1893): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 1893): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 587): Force finishing activity org.company.numbergame/org.cocos2dx.cpp.AppActivity
D/dalvikvm( 587): GC_FOR_ALLOC freed 856K, 19% free 8972K/10964K, paused 11ms, total 11ms
D/MobileDataStateTracker( 587): default: setPolicyDataEnable(enabled=true)
W/ActivityManager( 587): Activity pause timeout for ActivityRecord{529f9534 u0 org.company.numbergame/org.cocos2dx.cpp.AppActivity t8 f}
W/EGL_genymotion( 763): eglSurfaceAttrib not implemented
D/MobileDataStateTracker( 587): default: setPolicyDataEnable(enabled=t
The eclipse emulators are really slow and I need to use Genymotion also for multi-device resolution testing.
EDIT:
A strange issue, I noticed after restarting eclipse. (I din't change my Application.mk). When I built project using cocos compile -p android
then it started building for x86 and worked when installed on genymotion device but didn't work for my actual devices. And when I removed x86 then it built for armeabi . But it doesn't work simultaneously on both kind of devices(armeabi and x86).
Does anyone know, how can I resolve it?
Genymotion works on x86 architecture. If you want to run an ARM build on genymotion then download the ARM translation and drop it on your genymotion emulator, then it will start accepting ARM build.

Solving 'application has stopped' crash errors

Building an AOA application, my Android device communicates with an external accessory, in this case an arduino.
When I connect the accessory, my Android application launches correctly as I have a USB_ATTACHED action within my intent-filter for my mainActivity.
However, my Android application unfortunately crashes when disconnected from the USB accessory.
My shell immediately switches from TCPIP to USB mode on disconect but reconnecting I get a complete stack trace
Can any Android gurus suggest how I might debug this further based on the following logcat output?
E/run ( 5092): java.io.IOException: read failed: EIO (I/O error)
D/PicasaSyncManager( 4877): battery info: false
D/UsbDeviceManager( 781): exited USB accessory mode
E/UsbDebuggingManager( 781): got -1 reading
E/UsbDebuggingManager( 781): Communication error:
E/UsbDebuggingManager( 781): java.io.IOException: No such file or directory
E/UsbDebuggingManager( 781): at android.net.LocalSocketImpl.connectLocal(Native Method)
E/UsbDebuggingManager( 781): at android.net.LocalSocketImpl.connect(LocalSocketImpl.java:287)
E/UsbDebuggingManager( 781): at android.net.LocalSocket.connect(LocalSocket.java:130)
E/UsbDebuggingManager( 781): at com.android.server.usb.UsbDebuggingManager.listenToSocket(UsbDebuggingManager.java:75)
E/UsbDebuggingManager( 781): at com.android.server.usb.UsbDebuggingManager.run(UsbDebuggingManager.java:111)
E/UsbDebuggingManager( 781): at java.lang.Thread.run(Thread.java:841)
D/dalvikvm( 781): GC_FOR_ALLOC freed 1069K, 14% free 31156K/35896K, paused 54ms, total 55ms
V/SearchControllerCache( 2819): creating SearchController
W/Sidekick_LocationOracleImpl( 2819): Best location was null
D/dalvikvm( 2819): GC_FOR_ALLOC freed 514K, 5% free 18100K/18940K, paused 15ms, total 15ms
D/audio_hw_primary( 182): select_devices: out_snd_device(0: ) in_snd_device(35: voice-rec-mic)
D/ ( 182): Failed to fetch the lookup information of the device 0000003E
E/ACDB-LOADER( 182): Error: ACDB AudProc vol returned = -19
I/SearchController( 2819): #onHotwordDetectorStarted
D/MainActivity( 5092): ASSERT registerPhone and register =false
D/MainActivity( 5092): ASSERT registerSms and register =false
I/WroxAccessory( 5092): disconnect
D/AndroidRuntime( 5092): Shutting down VM
W/dalvikvm( 5092): threadid=1: thread exiting with uncaught exception (group=0x41e7cba8)
E/AndroidRuntime( 5092): FATAL EXCEPTION: main
E/AndroidRuntime( 5092): Process: ca.foo, PID: 5092
E/AndroidRuntime( 5092): java.lang.RuntimeException: Unable to destroy activity {ca.foo/ca.foo.MainActivity}: java.lang.IllegalArgumentException: Receiver not registered: com.wiley.wroxaccessories.UsbConnection12$1#42f0be28
E/AndroidRuntime( 5092): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3497)
E/AndroidRuntime( 5092): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3515)
E/AndroidRuntime( 5092): at android.app.ActivityThread.access$1400(ActivityThread.java:135)
E/AndroidRuntime( 5092): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1249)
E/AndroidRuntime( 5092): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 5092): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 5092): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 5092): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 5092): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 5092): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 5092): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 5092): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 5092): Caused by: java.lang.IllegalArgumentException: Receiver not registered: com.wiley.wroxaccessories.UsbConnection12$1#42f0be28
E/AndroidRuntime( 5092): at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:667)
E/AndroidRuntime( 5092): at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1453)
E/AndroidRuntime( 5092): at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:489)
E/AndroidRuntime( 5092): at com.wiley.wroxaccessories.UsbConnection12.close(UsbConnection12.java:115)
E/AndroidRuntime( 5092): at ca.foo.MainActivity.onDestroy(MainActivity.java:164)
E/AndroidRuntime( 5092): at android.app.Activity.performDestroy(Activity.java:5403)
E/AndroidRuntime( 5092): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117)
E/AndroidRuntime( 5092): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3484)
E/AndroidRuntime( 5092): ... 11 more
For the IO error that is being thrown,
I came across:
https://code.google.com/p/android/issues/detail?id=20545
An option is writing a function in onPause() ,
but a better way would be: (as mentioned by #9 in the same link) -
use http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
Also, there is a question to properly close the usb accessory connection, which helps in your case
Proper way to close a USB accessory connection
Frankly, as I'm not very familiar with the first of your exceptions, I've tried to research a little over it and what seems the most relevant description is that it's an ICS bug - you can read about it here, but I can't see the relationship between arduino and NFS, though.
The second one looks much more familiar to me. I don't know if it's the only one case which may produce it (probably not), but in my case it was because in the registerReceiver(...) I was passing it two Contexts, and on unregisterReceiver(...) it failed exactly with that exception. The solution was passing getApplicationContext() as context on registering and this exception stopped appearing.
Simply Clear the cache/data the data for that application and restat the device. Hopefully everything will go Normal

Error in running Android's TouchPaint example program

I am just trying out the "TouchPaint" sample provided by Google Android examples at:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
Created my own AndroidManifest.xml, and I figured that "GraphicsActivity.java" and "PictureLayout.java" are two other java files before I could compiled and create the apk successfully.
After I load into my Android phone, it displayed a blank screen. At this point nothing happened yet, but once I touch the screen, the apps died, and generated the following trace in logcat output:
D/dalvikvm( 4939): GC_CONCURRENT freed 44K, 49% free 2779K/5379K, external 3286K/4104K, paused 4ms+2ms
D/dalvikvm( 365): GC_CONCURRENT freed 1102K, 54% free 3271K/7047K, external 2612K/3262K, paused 4ms+4ms
I/ActivityManager( 266): Displayed com.example.android.apis.graphics/.TouchPaint: +382ms
D/AndroidRuntime( 4939): Shutting down VM
W/dalvikvm( 4939): threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
E/AndroidRuntime( 4939): FATAL EXCEPTION: main
E/AndroidRuntime( 4939): java.lang.NoSuchMethodError: android.view.MotionEvent.getButtonState
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchOrHoverEvent(TouchPaint.java:346)
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchEvent(TouchPaint.java:337)
E/AndroidRuntime( 4939): at android.view.View.dispatchTouchEvent(View.java:3952)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
E/AndroidRuntime( 4939): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
E/AndroidRuntime( 4939): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
E/AndroidRuntime( 4939): at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
E/AndroidRuntime( 4939): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4939): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 4939): at android.app.ActivityThread.main(ActivityThread.java:3701)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
E/AndroidRuntime( 4939): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 266): Force finishing activity com.example.android.apis.graphics/.TouchPaint
W/ActivityManager( 266): Activity pause timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
I/InputDispatcher( 266): Application is not responding: Window{2b3f4d00 com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint paused=false}. 5002.0ms since event, 5001.8ms since wait started
I/InputDispatcher( 266): Dropping event because the pointer is not down.
I/WindowManager( 266): Input event dispatching timed out sending to com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint
W/ActivityManager( 266): Activity destroy timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
D/lights ( 266): set_light_backlight: brightness=20
I/ActivityManager( 266): No longer want com.facebook.katana (pid 4319): hidden #16
W/ActivityManager( 266): Scheduling restart of crashed service com.facebook.katana/.service.UploadManager in 5000ms
I am puzzled over what is the possible cause of crashing?
This method is only available since API Level 14, set minSdkVersion to 14 in the Manifest
public final int getButtonState ()
Since: API Level 14
Gets the state of all buttons that are pressed such as a mouse or stylus button.
Returns
The button state.
I found the answer:
http://developer.android.com/resources/dashboard/platform-versions.html
http://developer.android.com/guide/appendix/api-levels.html
From the web page's table, since I know my phone is using Android 2.3.4, so that max target API for SDK should be 10. So instead of using the TouchPaint.java sample from android-14, I copied the TouchPaint.java from android-10,change the minSDK version to 10 inside my AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="10"/>
Everything works!! Thanks to Rajdeep Dua too!!!

Why can Necessitas not support to display Chinese characters in my qt application for android?

Necessitas is the codename for the port of Qt on the Android Operating System and of the user-friendly Qt Creator Integration with Android. Now , using Necessitas (QT for Android),I can run & debug my Qt Applications on Android Devices.
But I got these log when I want to setText("中文") on QLabel.
Why can Necessitas not support to display Chinese characters in my qt application for android ? Or, what steps do I have less ?
Starting remote process ...
I/Qt JAVA ( 469): surfaceChanged: 480,762
D/dalvikvm( 469): Trying to load lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtCore.so 0x44ede7e8
D/dalvikvm( 469): Added shared lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtCore.so 0x44ede7e8
D/dalvikvm( 469): No JNI_OnLoad found in /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtCore.so 0x44ede7e8, skipping init
D/dalvikvm( 469): Trying to load lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtGui.so 0x44ede7e8
D/dalvikvm( 469): Added shared lib /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtGui.so 0x44ede7e8
D/dalvikvm( 469): No JNI_OnLoad found in /data/data/eu.licentia.necessitas.ministro/files/qt/lib/libQtGui.so 0x44ede7e8, skipping init
D/dalvikvm( 469): Trying to load lib /data/data/eu.licentia.necessitas.ministro/files/qt/plugins/platforms/android/libandroid-8.so 0x44ede7e8
D/dalvikvm( 469): Added shared lib /data/data/eu.licentia.necessitas.ministro/files/qt/plugins/platforms/android/libandroid-8.so 0x44ede7e8
I/Qt ( 469): qt start
D/dalvikvm( 469): Trying to load lib /data/data/eu.licentia.necessitas.industrius.example.Yiyaaixuexi/lib/libYiyaaixuexi.so 0x44ede7e8
D/dalvikvm( 469): Added shared lib /data/data/eu.licentia.necessitas.industrius.example.Yiyaaixuexi/lib/libYiyaaixuexi.so 0x44ede7e8
I/Qt ( 469): qt start
W/ApplicationContext( 469): Unable to create files directory
D/AndroidRuntime( 469): Shutting down VM
W/dalvikvm( 469): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 469): FATAL EXCEPTION: main
E/AndroidRuntime( 469): java.lang.NullPointerException
E/AndroidRuntime( 469): at eu.licentia.necessitas.industrius.QtActivity.startApplication(QtActivity.java:126)
E/AndroidRuntime( 469): at eu.licentia.necessitas.industrius.QtActivity.access$000(QtActivity.java:62)
E/AndroidRuntime( 469): at eu.licentia.necessitas.industrius.QtActivity$1$1.run(QtActivity.java:149)
E/AndroidRuntime( 469): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 469): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 469): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 469): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 469): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 469): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 469): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 469): Sending signal. PID: 469 SIG: 9
Is this question ambiguous, vague, incomplete, overly broad, or rhetorical ? Now I'm sure that it doesn't support at all.

Android NDK hellojni example fails

I'm trying to run the example from NDK package on a AT91SAM9M10-EKES board running Android 2.1
The activity fails.
This is what I get in the logcat, Can someone please guide me with this ?
D/AndroidRuntime( 1153): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1153): CheckJNI is ON
D/AndroidRuntime( 1153): --- registering native functions ---
D/ddm-heap( 1153): Got feature list request
D/AndroidRuntime( 1153): Shutting down VM
D/dalvikvm( 1153): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1153): DestroyJavaVM shutting VM down
D/dalvikvm( 1153): HeapWorker thread shutting down
D/dalvikvm( 1153): HeapWorker thread has shut down
D/jdwp ( 1153): JDWP shutting down net...
I/dalvikvm( 1153): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1153): VM cleaning up
E/AndroidRuntime( 1153): ERROR: thread attach failed
D/dalvikvm( 1153): LinearAlloc 0x0 used 629532 of 5242880 (12%)
D/AndroidRuntime( 1161):
D/AndroidRuntime( 1161): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1161): CheckJNI is ON
D/AndroidRuntime( 1161): --- registering native functions ---
D/ddm-heap( 1161): Got feature list request
I/ActivityManager( 767): Starting activity: Intent { act=android.intent.action.MAIN cat=android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.hellojni/.HelloJni }
D/AndroidRuntime( 1161): Shutting down VM
D/dalvikvm( 1161): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1161): DestroyJavaVM shutting VM down
D/dalvikvm( 1161): HeapWorker thread shutting down
D/dalvikvm( 1161): HeapWorker thread has shut down
D/jdwp ( 1161): JDWP shutting down net...
I/dalvikvm( 1161): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1161): VM cleaning up
E/AndroidRuntime( 1161): ERROR: thread attach failed
D/dalvikvm( 1161): LinearAlloc 0x0 used 639500 of 5242880 (12%)
I/ActivityManager( 767): Start proc com.example.hellojni for activity com.example.hellojni/.HelloJni: pid=1168 uid=10018 gids={1015}
D/ddm-heap( 1168): Got feature list request
W/dalvikvm( 1168): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/example/hellojni/HelloJni;.<clinit>
W/dalvikvm( 1168): Class init failed in newInstance call (Lcom/example/hellojni/HelloJni;)
D/AndroidRuntime( 1168): Shutting down VM
W/dalvikvm( 1168): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 1168): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1168): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1168): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 1168): at java.lang.Class.newInstance(Class.java:1479)
E/AndroidRuntime( 1168): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 1168): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
E/AndroidRuntime( 1168): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 1168): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 1168): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 1168): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1168): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1168): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 1168): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1168): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1168): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 1168): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 1168): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1168): Caused by: java.lang.UnsatisfiedLinkError: Library hello-jni not found
E/AndroidRuntime( 1168): at java.lang.Runtime.loadLibrary(Runtime.java:489)
E/AndroidRuntime( 1168): at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 1168): at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
E/AndroidRuntime( 1168): ... 15 more
I/Process ( 767): Sending signal. PID: 1168 SIG: 3
I/dalvikvm( 1168): threadid=7: reacting to signal 3
E/dalvikvm( 1168): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
W/ActivityManager( 767): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 767): Activity idle timeout for HistoryRecord{43d5c310 com.example.hellojni/.HelloJni}
D/dalvikvm( 813): GC freed 301 objects / 14832 bytes in 91ms
I/power ( 767): *** set_screen_state 0
E/power ( 767): Failed setting last user activity: g_error=0
W/ActivityManager( 767): Activity pause timeout for HistoryRecord{43d5c310 com.example.hellojni/.HelloJni}
D/dalvikvm( 873): GC freed 165 objects / 6624 bytes in 81ms
you hadnt built the library(.so) file of the project thats why you are getting this error, try to build the project with help of android-ndk http://developer.android.com/sdk/ndk/index.html and cygwin http://www.cygwin.com/

Categories

Resources