The project was working just fine last Thursday, then, some sort of Eclipse bug caused the project properties to get all messed up.
After a splitting and frustrating headache, managed to isolate the issue and fix it....on the emulator, running it on the device gives me the original error messages:
07-25 13:01:08.482: E/AndroidRuntime(4273): FATAL EXCEPTION: main
07-25 13:01:08.482: E/AndroidRuntime(4273): java.lang.ExceptionInInitializerError
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.Class.newInstanceImpl(Native Method)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.Class.newInstance(Class.java:1319)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.Instrumentation.newActivity(Instrumentation.java:1027)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1885)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.access$600(ActivityThread.java:128)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.os.Looper.loop(Looper.java:137)
07-25 13:01:08.482: E/AndroidRuntime(4273): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.reflect.Method.invoke(Method.java:511)
07-25 13:01:08.482: E/AndroidRuntime(4273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-25 13:01:08.482: E/AndroidRuntime(4273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-25 13:01:08.482: E/AndroidRuntime(4273): at dalvik.system.NativeStart.main(Native Method)
07-25 13:01:08.482: E/AndroidRuntime(4273): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load game: findLibrary returned null
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.Runtime.loadLibrary(Runtime.java:365)
07-25 13:01:08.482: E/AndroidRuntime(4273): at java.lang.System.loadLibrary(System.java:535)
Already tried at least 12 different ways to fix the "Couldn't load game: findLibrary returned null" error to no avail.
UPDATE: Tried using a 4.0 simulator with the exact same results, so it's definitely tied to android version; however, the project was created and is indeed built for Android 4.0 as the minimum.
Any ideas what might be happening and how to fix it?
Thanks for any replies
Most probably your library is not properly generated. Goto ProjectHome->libs->armeabi->libgame.so . libgame.so file is missing.
This file could be generated when you run create-android-project.bat or equivalent linux file.
which creates empty android project.Try copy paste this file from there.
To build cocos2dx project for Android you should perform two steps.
Build C++ libraries. It can be done with build_native.sh
Build Java Project. It can be done through Eclipse.
Such error will happen if you have missed the first step.
Related
I get a project from other developer to fix minor issues in app, when I'm running my app on device I'm getting an error:
15142-15142/com.etripconcept E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.crashlytics.android.answers.Answers
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:224)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:207)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:202)
at com.etripconcept.SplashScreenActivity.onCreate(SplashScreenActivity.java:16)
at android.app.Activity.performCreate(Activity.java:5163)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
I'm new in Android development, so it may be stupid question, but Google doesn't say anything about it. I use Android Studio 1.2.2 on Win 8.1
I have to send a byte via bluetooth, the problem is that I can not use this script because I have to write the number that is greater than 127:
mChatService.write(new byte[]{});
how can I do?
Thanks.
EDIT
Logcat:
07-25 14:18:20.410: D/AndroidRuntime(1906): Shutting down VM
07-25 14:18:20.410: W/dalvikvm(1906): threadid=1: thread exiting with uncaught exception (group=0x41607ce0)
07-25 14:18:20.410: E/AndroidRuntime(1906): FATAL EXCEPTION: main
07-25 14:18:20.410: E/AndroidRuntime(1906): Process: com.example.android.BluetoothChat, PID: 1906
07-25 14:18:20.410: E/AndroidRuntime(1906): java.lang.NumberFormatException: Invalid int: ""
07-25 14:18:20.410: E/AndroidRuntime(1906): at java.lang.Integer.invalidInt(Integer.java:137)
07-25 14:18:20.410: E/AndroidRuntime(1906): at java.lang.Integer.parseInt(Integer.java:358)
07-25 14:18:20.410: E/AndroidRuntime(1906): at java.lang.Integer.parseInt(Integer.java:331)
07-25 14:18:20.410: E/AndroidRuntime(1906): at com.example.android.BluetoothChat.BluetoothChat$2.handleMessage(BluetoothChat.java:517)
07-25 14:18:20.410: E/AndroidRuntime(1906): at android.os.Handler.dispatchMessage(Handler.java:102)
07-25 14:18:20.410: E/AndroidRuntime(1906): at android.os.Looper.loop(Looper.java:136)
07-25 14:18:20.410: E/AndroidRuntime(1906): at android.app.ActivityThread.main(ActivityThread.java:5141)
07-25 14:18:20.410: E/AndroidRuntime(1906): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 14:18:20.410: E/AndroidRuntime(1906): at java.lang.reflect.Method.invoke(Method.java:515)
07-25 14:18:20.410: E/AndroidRuntime(1906): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
07-25 14:18:20.410: E/AndroidRuntime(1906): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
07-25 14:18:20.410: E/AndroidRuntime(1906): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
07-25 14:18:20.410: E/AndroidRuntime(1906): at dalvik.system.NativeStart.main(Native Method)
Receive Code
byte[] readBuf = (byte[]) msg.obj;
// construct a string from the valid bytes in the buffer
String readMessage = new String(readBuf, 0, msg.arg1);
mConversationArrayAdapter.add(readMessage);
Bytes in Java are signed so the max range is -128 to +127. If you really just need 1 byte, you can convert it to an integer on the receiving side and add 128 to it to make it in the range of 0-255.
Decided to use Scandit SDK to get the barcode scanning feature in my app. Unfortunately, since I'm relatively new to Android development and Java in general I've run into a few issues that I can't seem to work out. The demo that Scandit provided doesn't give any errors(runs fine) but crashes when I try to start it up (pressing a button from one activity is meant to start it up). I've tried reading the logcat and googling a solution to the problems but I'm not getting the right solutions. Does anyone have an idea of what I'm doing wrong?
Logcat is provided below:
10-08 23:30:00.807 21563-21563/com.kwesimbia.management D/AndroidRuntime? Shutting down VM
10-08 23:30:00.807 21563-21563/com.kwesimbia.management W/dalvikvm? threadid=1: thread exiting with uncaught exception (group=0x40aa4228)
10-08 23:30:00.817 21563-21563/com.kwesimbia.management E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3082)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.kwesimbia.management.ScanditSDKDemoSimple
at com.kwesimbia.management.Activity_D.initiateCodeScan(Activity_D.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Process: com.kwesimbia.management
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Package: com.kwesimbia.management v1 (1.0)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger?
Application Label: firstapp
10-08 23:30:00.827 32726-587/? W/ActivityManager?
Force finishing activity com.kwesimbia.management/.Activity_D
I came across this problem as well, my solution was to extract the library files and put them as their files in the lib folder
The library basically isn't being exported with it
EDIT
So I checked out my project, basically I did these things:
In the libs folder I have a new folder called armeabi and inside that I have libscanditsdk-android-3.3.1.so
Then in my build path I have also referenced the jar file that they provide:
<classpathentry exported="true" kind="lib" path="C:/GIT/Android/FwayScannerProject/FwayScanner/libs/scanditsdk-barcodepicker-android-3.3.1.jar"/>
Please help to understand strange application behaviour.
In almost all devices in production everything is OK, I'm using ACRA to collect crash reports. But here is what I've got from Alpha GTR device:
ComponentInfo{com.xxxxxxxxxxx /com.xxxxxxxxxxx.xxxxActivity}: java.lang.ClassNotFoundException: com.xxxxxxxxxxx.xxxxActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2108)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.access$600(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.xxxxxxxxxxx.xxxxActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)
... 11 more
java.lang.ClassNotFoundException: com.xxxxxxxxxxx.xxxxActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.access$600(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
So application failed to start with strange exception. I've already checked SO questions about it, and just adding libraries as Unable to instantiate activity... Caused by ClassNotFoundException doesn't help here.
Could it be some device-specific exception? My app uses Camera, Google Maps and GPS.
Maybe you have to check if GPS or Camera are supported by the device first?
LocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
How to Give Assets Folder Path for Playing mp4 video? I am Using Following Code for that.
Please Help me.
String stringPath = "file:///android_asset/sample.mp4";
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDisplay(surfaceHolder);
mediaPlayer.setDataSource(stringPath);
mediaPlayer.prepare();
mediaPlayer.start();
But Above Code is Give me Following Warnings & Errors.
07-25 13:11:40.833: ERROR/MediaPlayer(11295): error (1, -2147483648)
07-25 13:11:40.833: WARN/System.err(11295): java.io.IOException: Prepare failed.: status=0x1
07-25 13:11:41.103: WARN/System.err(11295): at android.media.MediaPlayer.prepare(Native Method)
07-25 13:11:41.103: WARN/System.err(11295): at com.arthisoft.tempforvideo2.AndroidVideoPlayer.playvideo(AndroidVideoPlayer.java:69)
07-25 13:11:41.103: WARN/System.err(11295): at com.arthisoft.tempforvideo2.AndroidVideoPlayer$2.onClick(AndroidVideoPlayer.java:52)
07-25 13:11:41.113: WARN/System.err(11295): at android.view.View.performClick(View.java:2408)
07-25 13:11:41.113: WARN/System.err(11295): at android.view.View$PerformClick.run(View.java:8816)
07-25 13:11:41.123: WARN/System.err(11295): at android.os.Handler.handleCallback(Handler.java:587)
07-25 13:11:41.123: WARN/System.err(11295): at android.os.Handler.dispatchMessage(Handler.java:92)
07-25 13:11:41.123: WARN/System.err(11295): at android.os.Looper.loop(Looper.java:123)
07-25 13:11:41.134: WARN/System.err(11295): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-25 13:11:41.143: WARN/System.err(11295): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 13:11:41.143: WARN/System.err(11295): at java.lang.reflect.Method.invoke(Method.java:521)
07-25 13:11:41.143: WARN/System.err(11295): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-25 13:11:41.153: WARN/System.err(11295): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-25 13:11:41.153: WARN/System.err(11295): at dalvik.system.NativeStart.main(Native Method)
07-25 13:11:41.153: ERROR/MediaPlayer(11295): start called in state 0
07-25 13:11:41.163: ERROR/MediaPlayer(11295): error (-38, 0)
07-25 13:11:41.243: ERROR/MediaPlayer(11295): Error (-38,0)
Move the .mp4 file to raw/ folder. Then, replace your string with this:
String stringPath = "android.resource://[your_package_name]/raw/sample"
Please specify your location is in the sd card or in the internal storage. If it is in the sd card then it will be:
String stringPath = "/sdcard/android_asset/sample.mp4";
You have to do something like this
mediaPlayer.setDataSource(AndroidVideoPlayer.this, Uri
.parse("android.resource://com.arthisoft.tempforvideo2/R.raw.sample"));