Runtime Crash on constructing Gson object with NoClassDefFoundError - android

I am developing one android application and in that app I am trying to use Gson Library for Json serialization and de-serialization. I downloaded the library from the following link:-
http://code.google.com/p/google-gson/downloads/list
I included the gson-2.2.2.jar in Java Build Path, but the application crashes at run time when constructing Gson object:-
Gson gson = new Gson();
in logcat I get
07-24 14:53:21.648: E/dalvikvm(488): Could not find class 'com.google.gson.Gson', referenced from method com.google.gson.examples.android.GsonProguardExampleActivity.onCreate
07-24 14:53:21.648: W/dalvikvm(488): VFY: unable to resolve new-instance 10 (Lcom/google/gson/Gson;) in Lcom/google/gson/examples/android/GsonProguardExampleActivity;
07-24 14:53:21.668: D/dalvikvm(488): VFY: replacing opcode 0x22 at 0x0010
07-24 14:53:21.668: D/dalvikvm(488): VFY: dead code 0x0012-007a in Lcom/google/gson/examples/android/GsonProguardExampleActivity;.onCreate (Landroid/os/Bundle;)V
07-24 14:53:21.788: D/AndroidRuntime(488): Shutting down VM
07-24 14:53:21.788: W/dalvikvm(488): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-24 14:53:21.814: E/AndroidRuntime(488): FATAL EXCEPTION: main
07-24 14:53:21.814: E/AndroidRuntime(488): java.lang.NoClassDefFoundError: com.google.gson.Gson
07-24 14:53:21.814: E/AndroidRuntime(488): at com.google.gson.examples.android.GsonProguardExampleActivity.onCreate(GsonProguardExampleActivity.java:40)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.os.Looper.loop(Looper.java:123)
07-24 14:53:21.814: E/AndroidRuntime(488): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-24 14:53:21.814: E/AndroidRuntime(488): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 14:53:21.814: E/AndroidRuntime(488): at java.lang.reflect.Method.invoke(Method.java:521)
07-24 14:53:21.814: E/AndroidRuntime(488): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-24 14:53:21.814: E/AndroidRuntime(488): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-24 14:53:21.814: E/AndroidRuntime(488): at dalvik.system.NativeStart.main(Native Method)
Error is:-
07-24 14:53:21.814: E/AndroidRuntime(488): java.lang.NoClassDefFoundError: com.google.gson.Gson
Also, If I include full source of Gson library as another package in my project it all works well.
What am I doing wrong, is this the correct jar??

Seems you have kept the jar file inside lib folder, rather the name should be changed to libs. This was updated newer revisions of ADT (revision 17 onwards).

Related

app crashes on android 4.3 [duplicate]

This question already has answers here:
What is a stack trace, and how can I use it to debug my application errors?
(7 answers)
Closed 8 years ago.
I got an issue with an android app I'm trying to develop. When I test it in an emulator with android 4.4.2 (the target sdk version), everything works fine. But when I run the same code in an emulator with the same settings but android 4.3 instead, the app crashes almost immediately with the catlog error below.
Using the android lint in eclipse (right click on project, "Android tools" > "Run lint: check for common error"), I cannot find any code that doesn't correspond with the minSdkVersion (16).
Anyone got suggestions what's going wrong?
Catlog error:
07-24 12:54:14.592: D/AndroidRuntime(1012): Shutting down VM
07-24 12:54:14.592: W/dalvikvm(1012): threadid=1: thread exiting with uncaught exception (group=0x41465700)
07-24 12:54:14.631: E/AndroidRuntime(1012): FATAL EXCEPTION: main
07-24 12:54:14.631: E/AndroidRuntime(1012): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.protime360_basics/com.example.protime360_basics.MainActivity}: java.lang.NullPointerException
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.os.Looper.loop(Looper.java:137)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.ActivityThread.main(ActivityThread.java:5103)
07-24 12:54:14.631: E/AndroidRuntime(1012): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 12:54:14.631: E/AndroidRuntime(1012): at java.lang.reflect.Method.invoke(Method.java:525)
07-24 12:54:14.631: E/AndroidRuntime(1012): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
07-24 12:54:14.631: E/AndroidRuntime(1012): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-24 12:54:14.631: E/AndroidRuntime(1012): at dalvik.system.NativeStart.main(Native Method)
07-24 12:54:14.631: E/AndroidRuntime(1012): Caused by: java.lang.NullPointerException
07-24 12:54:14.631: E/AndroidRuntime(1012): at com.example.protime360_basics.MainActivity.loginPopup(MainActivity.java:167)
07-24 12:54:14.631: E/AndroidRuntime(1012): at com.example.protime360_basics.MainActivity.onCreate(MainActivity.java:61)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.Activity.performCreate(Activity.java:5133)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-24 12:54:14.631: E/AndroidRuntime(1012): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
07-24 12:54:14.631: E/AndroidRuntime(1012): ... 11 more
I found the problem thanks to #codeMagic and #Chris Stratton. Line 167 in my code was
if(!username.equals(null)){
I changed that to
if(username != null && !username.isEmpty()){
=> Problem solved!

Google map API v2. android

I'm trying to develop an android app where it shows my current location on google map , but I'm having difficulties on showing the map on emulator. I've been working with this since yesterday and I tried looking for solution by browsing similar thread but I can't figure out what's wrong with my code.
here is my logcat:
07-24 03:35:27.041: I/dalvikvm(1268): Could not find method
android.app.AlertDialog$Builder.<init>, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.a
07-24 03:35:27.041: W/dalvikvm(1268): VFY: unable to resolve direct method 145: Landroid/app/AlertDialog$Builder;.<init> (Landroid/content/Context;I)V
07-24 03:35:27.041: D/dalvikvm(1268): VFY: replacing opcode 0x70 at 0x002c
07-24 03:35:27.051: I/dalvikvm(1268): Could not find method android.app.Activity.getFragmentManager, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.b
07-24 03:35:27.051: W/dalvikvm(1268): VFY: unable to resolve virtual method 94: Landroid/app/Activity;.getFragmentManager ()Landroid/app/FragmentManager;
07-24 03:35:27.051: D/dalvikvm(1268): VFY: replacing opcode 0x6e at 0x0023
07-24 03:35:27.051: D/dalvikvm(1268): VFY: dead code 0x0026-0030 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (ILandroid/app/Activity;Landroid/support/v4/app/Fragment;ILandroid/content/DialogInterface$OnCancelListener;)Z
07-24 03:35:27.061: D/dalvikvm(1268): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
07-24 03:35:27.061: W/dalvikvm(1268): VFY: unable to resolve instance field 60
07-24 03:35:27.061: D/dalvikvm(1268): VFY: replacing opcode 0x52 at 0x0012
07-24 03:35:27.061: D/dalvikvm(1268): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
07-24 03:35:27.081: D/AndroidRuntime(1268): Shutting down VM
07-24 03:35:27.081: W/dalvikvm(1268): threadid=1: thread exiting with uncaught exception (group=0xb5f054f0)
07-24 03:35:27.091: E/AndroidRuntime(1268): FATAL EXCEPTION: main
07-24 03:35:27.091: E/AndroidRuntime(1268): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemapdemo/com.example.googlemapdemo.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.os.Looper.loop(Looper.java:130)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-24 03:35:27.091: E/AndroidRuntime(1268): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 03:35:27.091: E/AndroidRuntime(1268): at java.lang.reflect.Method.invoke(Method.java:507)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-24 03:35:27.091: E/AndroidRuntime(1268): at dalvik.system.NativeStart.main(Native Method)
07-24 03:35:27.091: E/AndroidRuntime(1268): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:128)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:77)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.example.googlemapdemo.MainActivity.onCreate(MainActivity.java:17)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-24 03:35:27.091: E/AndroidRuntime(1268): ... 11 more
07-24 03:35:27.091: E/AndroidRuntime(1268): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 5077000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.internal.u.F(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.internal.u.E(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.SupportMapFragment$b.ju(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.dynamic.a.a(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
07-24 03:35:27.091: E/AndroidRuntime(1268): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
07-24 03:35:27.091: E/AndroidRuntime(1268): ... 19 more
here is my
activity_main.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
GoogleMapDemo.manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemapdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="20" />
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAMQ0-kK-KaFM_SeGjn7Nv22WvETNRmRZc"
/>
</application>
</manifest>
Use google api 19 version emulator while creating the AVD in your Eclipse IDE.
Maps is available in google api emulator only. If the problem persist again, update the SDK of your emulator to latest build and try again.
Yes., you can get map in emulator too. To achieve this follow this step by step process which I answered in another post
In your manifest :
meta-data
must be outside application block
and you have to add :
<meta-data android:name="com.google.android.gms.version> android:value="#integer/google_play_services_version"/>

App Getting Crashed in version 2.2

I create an android App which works perfectly in Android 2.3+ all devices. But when i tried to run in 2.2 but it crashed and gives error in log as,
08-16 10:22:41.323: E/dalvikvm(442): Could not find class 'android.os.StrictMode$ThreadPolicy$Builder', referenced from method com.uks.android.mssga.activity.LoginActivity.onCreate
08-16 10:22:41.333: W/dalvikvm(442): VFY: unable to resolve new-instance 39 (Landroid/os/StrictMode$ThreadPolicy$Builder;) in Lcom/uks/android/mssga/activity/LoginActivity;
08-16 10:22:41.333: D/dalvikvm(442): VFY: replacing opcode 0x22 at 0x000a
08-16 10:22:41.333: D/dalvikvm(442): VFY: dead code 0x000c-009a in Lcom/uks/android/mssga/activity/LoginActivity;.onCreate (Landroid/os/Bundle;)V
08-16 10:22:41.423: D/dalvikvm(442): GC_EXTERNAL_ALLOC freed 744 objects / 59064 bytes in 68ms
08-16 10:22:41.483: D/AndroidRuntime(442): Shutting down VM
08-16 10:22:41.483: W/dalvikvm(442): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-16 10:22:41.483: E/AndroidRuntime(442): FATAL EXCEPTION: main
08-16 10:22:41.483: E/AndroidRuntime(442): java.lang.NoClassDefFoundError: android.os.StrictMode$ThreadPolicy$Builder
08-16 10:22:41.483: E/AndroidRuntime(442): at com.uks.android.mssga.activity.LoginActivity.onCreate(LoginActivity.java:58)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.os.Handler.dispatchMessage(Handler.java:99)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.os.Looper.loop(Looper.java:123)
08-16 10:22:41.483: E/AndroidRuntime(442): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-16 10:22:41.483: E/AndroidRuntime(442): at java.lang.reflect.Method.invokeNative(Native Method)
08-16 10:22:41.483: E/AndroidRuntime(442): at java.lang.reflect.Method.invoke(Method.java:521)
08-16 10:22:41.483: E/AndroidRuntime(442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-16 10:22:41.483: E/AndroidRuntime(442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-16 10:22:41.483: E/AndroidRuntime(442): at dalvik.system.NativeStart.main(Native Method)
08-16 10:22:44.503: I/Process(442): Sending signal. PID: 442 SIG: 9
Code of LoginActivity is,
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
// Other stuff
}
StrictMode.ThreadPolicy.Builder was introduced in Android 2.3 (API level 9), so attempts to call it in versions earlier than that will fail.
To stop it crashing on 2.2 and earlier you can choose to either:
* Remove the ThreadPolicy code (as it is a developer debug tool to provide warnings of bad things you are doing)
or
* Use reflection to determine if the class exists before making use of it

android:google-code droidreader forceclose error

m using DroidReader project to display the PdfFiles.When i execute my project i am getting force close error like this
07-24 20:13:26.694: E/AndroidRuntime(286): FATAL EXCEPTION: main
07-24 20:13:26.694: E/AndroidRuntime(286): java.lang.ExceptionInInitializerError
07-24 20:13:26.694: E/AndroidRuntime(286): at de.hilses.droidreader.DroidReaderActivity.onCreate(DroidReaderActivity.java:108)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.os.Looper.loop(Looper.java:123)
07-24 20:13:26.694: E/AndroidRuntime(286): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-24 20:13:26.694: E/AndroidRuntime(286): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 20:13:26.694: E/AndroidRuntime(286): at java.lang.reflect.Method.invoke(Method.java:521)
07-24 20:13:26.694: E/AndroidRuntime(286): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-24 20:13:26.694: E/AndroidRuntime(286): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-24 20:13:26.694: E/AndroidRuntime(286): at dalvik.system.NativeStart.main(Native Method)
07-24 20:13:26.694: E/AndroidRuntime(286): Caused by: java.lang.UnsatisfiedLinkError: Library pdfrender not found
07-24 20:13:26.694: E/AndroidRuntime(286): at java.lang.Runtime.loadLibrary(Runtime.java:461)
07-24 20:13:26.694: E/AndroidRuntime(286): at java.lang.System.loadLibrary(System.java:557)
07-24 20:13:26.694: E/AndroidRuntime(286): at de.hilses.droidreader.PdfRender.<clinit>(PdfRender.java:111)
07-24 20:13:26.694: E/AndroidRuntime(286): ... 14 more
Help Me please
I guess you do not have add the .so file with name pdfrender.
You can find .so files in this apk file.
Open .apk file with a zip tool. and copy the content of lib folder in your libs.

Issues while consuming webservice

Installing Apache Tomcat, Apache Axis2, Create web project, Convert to service, Deploy it in Tomcat, Create client project then, Create client with stub of our services and finally, access the service.
I think these are all the steps to consume web service on Android Eclipse.
Here I have completed up to the step deploying the web project on tomcat server, it shown about the services successfully, but server option shown up as SYNCHRONIZED. It's given below
server
Tomcat v6.0 server at localhost[Started,Synchronized]
AndBack[Synchronized].
Meanwhile after creating client project it shown up during run time as:
Sorry! The application has stopped unexpectedly. Please try again. Force close
Please refer my logcat given below.
LOGCAT
04-25 16:46:51.153: E/dalvikvm(273): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method org.test.Frontend.AndFrontActivity.onCreate
04-25 16:46:51.153: W/dalvikvm(273): VFY: unable to resolve new-instance 25 (Lorg/ksoap2/serialization/SoapObject;) in Lorg/test/Frontend/AndFrontActivity;
04-25 16:46:51.153: D/dalvikvm(273): VFY: replacing opcode 0x22 at 0x0010
04-25 16:46:51.164: D/dalvikvm(273): VFY: dead code 0x0012-0081 in Lorg/test/Frontend/AndFrontActivity;.onCreate (Landroid/os/Bundle;)V
04-25 16:46:51.243: D/AndroidRuntime(273): Shutting down VM
04-25 16:46:51.243: W/dalvikvm(273): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-25 16:46:51.273: E/AndroidRuntime(273): FATAL EXCEPTION: main
04-25 16:46:51.273: E/AndroidRuntime(273): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
04-25 16:46:51.273: E/AndroidRuntime(273): at org.test.Frontend.AndFrontActivity.onCreate(AndFrontActivity.java:28)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.os.Looper.loop(Looper.java:123)
04-25 16:46:51.273: E/AndroidRuntime(273): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-25 16:46:51.273: E/AndroidRuntime(273): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 16:46:51.273: E/AndroidRuntime(273): at java.lang.reflect.Method.invoke(Method.java:521)
04-25 16:46:51.273: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-25 16:46:51.273: E/AndroidRuntime(273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-25 16:46:51.273: E/AndroidRuntime(273): at dalvik.system.NativeStart.main(Native Method)
Turns out external jars such as
ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar
to be put under /libs folder so Eclipse ADT automatically adds your jars to the buildpath of your application. It was a buildpath missing defined class error after all.. I hope this will help you, too!
here or there

Categories

Resources