Issue with imsdroid integration with my android application - android

We have problem related with Imsdroid Integration with my android application.During the application startup it gives error as follow..
ExceptionInInitializerError
My log file is:
07-19 19:55:58.047: E/AndroidRuntime(6858): FATAL EXCEPTION: main
07-19 19:55:58.047: E/AndroidRuntime(6858): java.lang.ExceptionInInitializerError
07-19 19:55:58.047: E/AndroidRuntime(6858): at org.doubango.imsdroid.MyMainClass.<init>(MyMainClass.java:43)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.Class.newInstanceImpl(Native Method)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.Class.newInstance(Class.java:1319)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.access$600(ActivityThread.java:149)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.os.Handler.dispatchMessage(Handler.java:99)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.os.Looper.loop(Looper.java:153)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.main(ActivityThread.java:4987)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 19:55:58.047: E/AndroidRuntime(6858): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
07-19 19:55:58.047: E/AndroidRuntime(6858): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
07-19 19:55:58.047: E/AndroidRuntime(6858): at dalvik.system.NativeStart.main(Native Method)
07-19 19:55:58.047: E/AndroidRuntime(6858): Caused by: java.lang.NullPointerException
07-19 19:55:58.047: E/AndroidRuntime(6858): at org.doubango.ngn.NgnEngine.<clinit>(NgnEngine.java:75)
07-19 19:55:58.047: E/AndroidRuntime(6858): ... 16 more

I think its with your AndroidManifest. Try putting this on your Application tag
android:name="org.doubango.ngn.NgnApplication"
or
if you have a custom Application object extend NgnApplication object instead of Application object.

If you want to use imsdroid in your application then you need to use ChromeView instead of WebView in android xml file.
I found more information and at here
<us.costan.chrome.ChromeView
android:id="#+id/customWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

Related

Android AlertDialog in AppCompatActivity

When I am using AlertDialog in ECLIPSE importing the followings
import android.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
My application builds but it's not the view I want. I want to use
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
But after installing the apk the application crashes. What I am doing wrong?
Crash log (perdon my long crash log)
07-19 13:09:13.273: I/Process(17722): Sending signal. PID: 17722 SIG: 9
07-19 13:09:20.993: D/ResourcesManager(17894): For user 0 new
overlays fetched Null
07-19 13:09:21.023: D/JniHelper(17894): JniHelper::setJavaVM
(0xb815f940), pthread_self() = -1225135284
07-19 13:09:21.063: D/Cocos2dxActivity(17894): model=SM-J510FN
07-19 13:09:21.063: D/Cocos2dxActivity(17894): product=j5xnltexx
07-19 13:09:21.063: D/Cocos2dxActivity(17894): isEmulator=false
07-19 13:09:21.073: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 0, K2HH Acceleration , STM
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 1, CM36672P Proximity Sensor, Capella Microsystems, Inc.
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 2, SX9310 Grip Sensor, SEMTECH
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 3, Screen Orientation Sensor, Samsung Electronics
07-19 13:09:21.093: V/PTServicesBridge(17894): PTServicesBridge -- INIT
07-19 13:09:21.113: W/PopupManager(17894): You have not specified a View
to use as content view for popups. Falling back to the Activity
content view. Note that this may not work as expected in multi-
screen environments
07-19 13:09:21.123: D/AndroidRuntime(17894): Shutting down VM
07-19 13:09:21.133: E/AndroidRuntime(17894): FATAL EXCEPTION: main
07-19 13:09:21.133: E/AndroidRuntime(17894): Process: com.tembo.huerun,
PID: 17894
07-19 13:09:21.133: E/AndroidRuntime(17894): java.lang.NoClassDefFoundError:
Failed resolution of: Landroid/support/v7/appcompat/R$attr;
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.support.v7.app.AlertDialog.resolveDialogTheme(AlertDialog.java:108)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.support.v7.app.AlertDialog$Builder.<init>(AlertDialog.java:285)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.AppRater.showRateDialog(AppRater.java:63)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.AppRater.app_launched(AppRater.java:52)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.PTPlayer.onCreate(PTPlayer.java:52)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.Activity.performCreate(Activity.java:6877)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.access$1100(ActivityThread.java:223)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.os.Handler.dispatchMessage(Handler.java:102)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.os.Looper.loop(Looper.java:158)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.main(ActivityThread.java:7231)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.reflect.Method.invoke(Native Method)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:1230)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-19 13:09:21.133: E/AndroidRuntime(17894): Caused by:
java.lang.ClassNotFoundException: Didn't find class
"android.support.v7.appcompat.R$attr" on path: DexPathList[[zip file
"/data/app/com.tembo.huerun-1/base.apk"],nativeLibraryDirectories=
[/data/app/com.tembo.huerun-1/lib/arm, /data/app/com.tembo.huerun-
1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
07-19 13:09:21.133: E/AndroidRuntime(17894): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:469)
07-19 13:09:21.133: E/AndroidRuntime(17894): ... 17 more
07-19 13:09:21.133: E/AndroidRuntime(17894): Suppressed:
java.lang.ClassNotFoundException: android.support.v7.appcompat.R$attr
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.Class.classForName(Native Method)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.BootClassLoader.findClass(ClassLoader.java:781)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:504)
07-19 13:09:21.133: E/AndroidRuntime(17894): ... 18 more
07-19 13:09:21.133: E/AndroidRuntime(17894): Caused by:
java.lang.NoClassDefFoundError: Class not found using the boot class loader;
no stack trace available
07-19 13:09:22.903: I/Process(17894): Sending signal. PID: 17894 SIG: 9
add the apcompact-v7 jar file in your lib folder.

Postgresql connection to Android app

I am trying to connect postgreSQL, using JBDC, to my Android app.
I have written a small program which will try to connect to the database and then the textView will change to connected.
I know for sure that the url is not correct but I followed this website: http://jdbc.postgresql.org/documentation/80/connect.html and used the first one.
Here is my code:
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import java.sql.*;
import java.util.Properties;
public class MainActivity extends Activity {
private static final String dbname = "postgres";
public static final String USER = " yOUR_DATABASE_USERNAME";
public static final String PASSWORD = "DATABASE_PASSWORD";
TextView text;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView) findViewById(R.id.tvConnect);
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String url = "jdbc:postgresql:localhost:5432/postgres";
Connection conn;
try {
//conn = DriverManager.getConnection(url, USER, PASSWORD);
conn = DriverManager.getConnection(url);
text.setText("Connected");
} catch (SQLException e) {
// TODO Auto-generated catch block
Log.e("Tag", "Description", e);
}
}
}
These are the errors I am getting:
07-19 19:23:46.023: E/Tag(1246): Description
07-19 19:23:46.023: E/Tag(1246): org.postgresql.util.PSQLException: Something unusual has occurred to cause the driver to fail. Please report this exception.
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.Driver.connect(Driver.java:300)
07-19 19:23:46.023: E/Tag(1246): at java.sql.DriverManager.getConnection(DriverManager.java:179)
07-19 19:23:46.023: E/Tag(1246): at java.sql.DriverManager.getConnection(DriverManager.java:144)
07-19 19:23:46.023: E/Tag(1246): at com.sql.postgre.MainActivity.onCreate(MainActivity.java:46)
07-19 19:23:46.023: E/Tag(1246): at android.app.Activity.performCreate(Activity.java:5231)
07-19 19:23:46.023: E/Tag(1246): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.access$800(ActivityThread.java:135)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-19 19:23:46.023: E/Tag(1246): at android.os.Handler.dispatchMessage(Handler.java:102)
07-19 19:23:46.023: E/Tag(1246): at android.os.Looper.loop(Looper.java:136)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.main(ActivityThread.java:5017)
07-19 19:23:46.023: E/Tag(1246): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 19:23:46.023: E/Tag(1246): at java.lang.reflect.Method.invoke(Method.java:515)
07-19 19:23:46.023: E/Tag(1246): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-19 19:23:46.023: E/Tag(1246): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-19 19:23:46.023: E/Tag(1246): at dalvik.system.NativeStart.main(Native Method)
07-19 19:23:46.023: E/Tag(1246): Caused by: android.os.NetworkOnMainThreadException
07-19 19:23:46.023: E/Tag(1246): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetAddress.getByName(InetAddress.java:289)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetSocketAddress.<init>(InetSocketAddress.java:105)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetSocketAddress.<init>(InetSocketAddress.java:90)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.core.PGStream.<init>(PGStream.java:60)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:101)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.Driver.makeConnection(Driver.java:410)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.Driver.connect(Driver.java:280)
This might be a late answer but after reading about jdbc drivers for android many people have said that the jdbc jar does not work well at all for android and only one or two versions of the jar actually worked. Otherwise the best way of connecting your database with android is via a web service and using either Volley or Retrofit to talk to the database.
Android has built-in support for SQLite database. Please refer to android documentation or you may download this code demo to quickly check how to code it.
Still if it is required to access any other database server, that server must be running on a machine as android does not host any SQL server so localhost should not work, if you are testing your code with emulator use 10.0.2.2 instead of localhost to access your postgres server on host development machine.
Another important issue to take care of while accessing a database server involves network, executing network related code is not allowed to be executed as part of an activity class hence you must write your code in AsyncTask android API.

app crashes while fetching images from server on some devices

I am fetching images from a server and setting it in a list view. The problem is that it is working properly in many devices but in some devices it crashes while downloading for first the time.
But when I try to do it again it opens without any problem. For the first time it says out of memory error. is this problem related to coding or its just related to heap memory of devices?
here's the log-
07-19 16:22:04.050: E/image_url(14776): http://siliconsoftwares.in/real_json/uploads/property/agent/three hindustani/DSC_0145.jpg
07-19 16:22:04.060: E/AndroidRuntime(14776): FATAL EXCEPTION: AsyncTask #4
07-19 16:22:04.060: E/AndroidRuntime(14776): java.lang.RuntimeException: An error occured while executing doInBackground()
07-19 16:22:04.060: E/AndroidRuntime(14776): at android.os.AsyncTask$3.done(AsyncTask.java:299)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-19 16:22:04.060: E/AndroidRuntime(14776): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.lang.Thread.run(Thread.java:856)
07-19 16:22:04.060: E/AndroidRuntime(14776): Caused by: java.lang.OutOfMemoryError
07-19 16:22:04.060: E/AndroidRuntime(14776): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
07-19 16:22:04.060: E/AndroidRuntime(14776): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:527)
07-19 16:22:04.060: E/AndroidRuntime(14776): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:599)
07-19 16:22:04.060: E/AndroidRuntime(14776): at com.example.realstate.FeaturedPropertiesActivity$ImageLoader.doInBackground(FeaturedPropertiesActivity.java:235)
07-19 16:22:04.060: E/AndroidRuntime(14776): at com.example.realstate.FeaturedPropertiesActivity$ImageLoader.doInBackground(FeaturedPropertiesActivity.java:1)
07-19 16:22:04.060: E/AndroidRuntime(14776): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-19 16:22:04.060: E/AndroidRuntime(14776): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-19 16:22:04.060: E/AndroidRuntime(14776): ... 5 more
07-19 16:22:04.630: E/WindowManager(14776): Activity com.example.realstate.FeaturedPropertiesActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#4442ee10 that was originally added here
07-19 16:22:04.630: E/WindowManager(14776): android.view.WindowLeaked: Activity com.example.realstate.FeaturedPropertiesActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#4442ee10 that was originally added here
07-19 16:22:04.630: E/WindowManager(14776): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:374)
07-19 16:22:04.630: E/WindowManager(14776): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:292)
07-19 16:22:04.630: E/WindowManager(14776): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
07-19 16:22:04.630: E/WindowManager(14776): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
07-19 16:22:04.630: E/WindowManager(14776): at android.view.Window$LocalWindowManager.addView(Window.java:547)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.Dialog.show(Dialog.java:277)
07-19 16:22:04.630: E/WindowManager(14776): at com.example.realstate.FeaturedPropertiesActivity$DownloadPropertiesList.onPreExecute(FeaturedPropertiesActivity.java:174)
07-19 16:22:04.630: E/WindowManager(14776): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
07-19 16:22:04.630: E/WindowManager(14776): at android.os.AsyncTask.execute(AsyncTask.java:534)
07-19 16:22:04.630: E/WindowManager(14776): at com.example.realstate.FeaturedPropertiesActivity.downloadPropertiesList(FeaturedPropertiesActivity.java:98)
07-19 16:22:04.630: E/WindowManager(14776): at com.example.realstate.FeaturedPropertiesActivity.onCreate(FeaturedPropertiesActivity.java:62)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.Activity.performCreate(Activity.java:5008)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.ActivityThread.access$600(ActivityThread.java:133)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
07-19 16:22:04.630: E/WindowManager(14776): at android.os.Handler.dispatchMessage(Handler.java:99)
07-19 16:22:04.630: E/WindowManager(14776): at android.os.Looper.loop(Looper.java:137)
07-19 16:22:04.630: E/WindowManager(14776): at android.app.ActivityThread.main(ActivityThread.java:4794)
07-19 16:22:04.630: E/WindowManager(14776): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 16:22:04.630: E/WindowManager(14776): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 16:22:04.630: E/WindowManager(14776): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
07-19 16:22:04.630: E/WindowManager(14776): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
07-19 16:22:04.630: E/WindowManager(14776): at dalvik.system.NativeStart.main(Native Method)
07-19 16:22:05.490: D/dalvikvm(14776): GC_FOR_ALLOC freed 121K, 8% free 43275K/46919K, paused 41ms, total 42ms
07-19 16:22:05.540: D/dalvikvm(14776): GC_BEFORE_OOM freed 17K, 8% free 43257K/46919K, paused 48ms, total 48ms
07-19 16:22:05.540: E/dalvikvm-heap(14776): Out of memory on a 21233680-byte allocation.

Having issues integrating Scandit SDK into my app

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"/>

Why is findFragmentById() returning null?

In the method below, NasaDailyFragment is always null in the debugger. The method call NasaDailyFragment.onRefresh(); fails using because of this. I can't figure out why its null.
public class NasaAppActivity extends FragmentActivity {
//other methods
public void onRefreshClicked(View view){
Log.d("debug", "in run");
FragmentManager fragmentManager=getSupportFragmentManager();
NasaDailyImage NasaDailyFragment=(NasaDailyImage)fragmentManager.findFragmentById(R.id.fragment_iotd);
if(NasaDailyFragment!=null){
Log.d("debug", "fragment has been casted and is NOT null!!!");
}
NasaDailyFragment.onRefresh();//always crashes here because NasaDailyFragment is null, this is "line 40" of the code
}
}
Here's the xml for the fragment defined by R.id.fragment_iotd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment android:name="com.wajumbie.nasadailyimage.NasaDailyImage"
android:id="#+id/fragment_iotd"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
The logcat output
07-19 11:21:25.916: D/debug(534): in run
07-19 11:21:25.916: D/AndroidRuntime(534): Shutting down VM
07-19 11:21:25.916: W/dalvikvm(534): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
07-19 11:21:25.936: E/AndroidRuntime(534): FATAL EXCEPTION: main
07-19 11:21:25.936: E/AndroidRuntime(534): java.lang.IllegalStateException: Could not execute method of the activity
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View$1.onClick(View.java:3044)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View.performClick(View.java:3511)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View$PerformClick.run(View.java:14105)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.os.Handler.handleCallback(Handler.java:605)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.os.Handler.dispatchMessage(Handler.java:92)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.os.Looper.loop(Looper.java:137)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 11:21:25.936: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-19 11:21:25.936: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-19 11:21:25.936: E/AndroidRuntime(534): at dalvik.system.NativeStart.main(Native Method)
07-19 11:21:25.936: E/AndroidRuntime(534): Caused by: java.lang.reflect.InvocationTargetException
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View$1.onClick(View.java:3039)
07-19 11:21:25.936: E/AndroidRuntime(534): ... 11 more
07-19 11:21:25.936: E/AndroidRuntime(534): Caused by: java.lang.NullPointerException
07-19 11:21:25.936: E/AndroidRuntime(534): at com.wajumbie.nasadailyimage.NasaAppActivity.onRefreshClicked(NasaAppActivity.java:40)
07-19 11:21:25.936: E/AndroidRuntime(534): ... 14 more
07-19 11:21:26.556: I/dalvikvm(534): threadid=3: reacting to signal 3
07-19 11:21:26.586: I/dalvikvm(534): Wrote stack traces to '/data/anr/traces.txt'

Categories

Resources