Ksoap2 Error after Updating Android SDK and ADT - android

I have a problem.
When I updated Android SDK tool to version 17 and the ADT to 17 I can't use ksoap2 any more.
I start the app and get this error:
03-25 20:13:49.995: E/AndroidRuntime(555): FATAL EXCEPTION: main
03-25 20:13:49.995: E/AndroidRuntime(555): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
03-25 20:13:49.995: E/AndroidRuntime(555): at com.alcad.pernat.praksa.SplashScreen.pridobiDanasnjo(SplashScreen.java:124)
03-25 20:13:49.995: E/AndroidRuntime(555): at com.alcad.pernat.praksa.SplashScreen.onCreate(SplashScreen.java:73)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.os.Handler.dispatchMessage(Handler.java:99)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.os.Looper.loop(Looper.java:123)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-25 20:13:49.995: E/AndroidRuntime(555): at java.lang.reflect.Method.invokeNative(Native Method)
03-25 20:13:49.995: E/AndroidRuntime(555): at java.lang.reflect.Method.invoke(Method.java:521)
03-25 20:13:49.995: E/AndroidRuntime(555): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-25 20:13:49.995: E/AndroidRuntime(555): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-25 20:13:49.995: E/AndroidRuntime(555): at dalvik.system.NativeStart.main(Native Method)
I should get String with some numbers but instead I get this error.
I was using ksoap2-2.5.4.jar and tried the new ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar.
I'm using Eclipse indigo, Ubuntu 11.04.
The code looks like this:
SoapObject Request =new SoapObject(NAMESPACE,METHOD_NAME); // Here I get the error
SoapSerializationEnvelope soapEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet=false;
String tmp=odstejDatum(datum);
Request.addProperty("datumod",tmp);
Request.addProperty("datumdo",datum);
Request.addProperty("tip_lme",1);
#SuppressWarnings("deprecation")
HttpTransportSE aht=new HttpTransportSE(URL,5000);
soapEnvelope.setOutputSoapObject(Request);
//
aht.call(SOAP_ACTION_DANASNJI,soapEnvelope);
Object response= soapEnvelope.getResponse();
Thanks for the help.

Android SDK tool to version 17 and the ADT to 17 they changed lib structure more details.
Here is the fix:
Remove the "ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar"
from the build path.
copy the jar file into libs folder
(if not exist create it), then remove jar file from your folder(if you have custom jar folder in your project).
it will automatically take it in the build path.then, clean your project and run.

Related

Android - No such field error in facebook sdk

I'm trying to integrate Facebook SDK in my android app. I downloaded facebook-android-sdk-4.5.1 and followed the steps in the developer guide. As I'm trying to run the sample HelloFacebookSample placed in the samples folder of the SDK, I'm getting the following error:
08-31 18:37:19.399: E/AndroidRuntime(277): FATAL EXCEPTION: main
08-31 18:37:19.399: E/AndroidRuntime(277): java.lang.NoSuchFieldError: java.util.Locale.ROOT
08-31 18:37:19.399: E/AndroidRuntime(277): at com.facebook.FacebookSdk.loadDefaultsFromMetadata(FacebookSdk.java:623)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:203)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:173)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.example.image.HelloFacebookSampleActivity.onCreate(HelloFacebookSampleActivity.java:117)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-31 18:37:19.399: E/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
08-31 18:37:19.399: E/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-31 18:37:19.399: E/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
I'm trying Android 2.2. Is this an issue? Or anything I missed? Can someone guide me please.
The Facebook SDK requires a minimum Android API version 15 (Android 4.0.3, or ICE CREAM SANDWICH).
https://developers.facebook.com/docs/android
I'm trying Android 2.2. Is this an issue?
Yes, since FB 4.5.1 SDK required API 9 to run (that is Android 2.3). You can check it here: https://web.archive.org/web/20150821025823/https://developers.facebook.com/docs/android
Requires Android API 9.
It can't be run on previous Android versions since it uses new API methods/fields (in your case exception is caused by accessing the Locale.ROOT constant which was added only in API 9).
Starting from version 4.6.0 FB SDK started to require API 15:
https://developers.facebook.com/docs/android/upgrading-4.x

android application stopped unexpectedly emulator

Couldn't able to find the error. Logcat Provided
03-22 00:08:15.677: E/dalvikvm(275): Could not find class 'net.sourceforge.jeval.Evaluator', referenced from method com.math.Mainactivitycalculator.onCreate
03-22 00:08:15.927: E/AndroidRuntime(275): FATAL EXCEPTION: main
03-22 00:08:15.927: E/AndroidRuntime(275): java.lang.NoClassDefFoundError: net.sourceforge.jeval.Evaluator
03-22 00:08:15.927: E/AndroidRuntime(275): at com.dbl.dothemath.Mainactivitycalculator.onCreate(Mainactivitycalculator.java:76)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.os.Looper.loop(Looper.java:123)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-22 00:08:15.927: E/AndroidRuntime(275): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 00:08:15.927: E/AndroidRuntime(275): at java.lang.reflect.Method.invoke(Method.java:521)
03-22 00:08:15.927: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-22 00:08:15.927: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-22 00:08:15.927: E/AndroidRuntime(275): at dalvik.system.NativeStart.main(Native Method)
mathematical Expression involving numbers.
Numbers are treated as doubles, so resulting numbers will contain at least one decimal place.
string String can also be added together, compared, etc...
Boolean Expression that evaluate to true (1.0) and false (0.0).
functional Custom functions can be created or there are many Math and String functions that JEval supplies with this class.

android VerifyError

i'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat.
java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
This happens when the build library classes conflict with those at run-time. Try performing a Clean of your project followed by a build.

Android project working on Motodev but crashes on Eclipse

I made an android project on Motodev (which is an eclipse plugin itself). But now when I am trying to run the same project on eclipse, the emulator gives me an error the following error:
FATAL EXCEPTION: main E/AndroidRuntime(4711): java.lang.VerifyError: com.tenpearls.namecalling.Activities.SearchContactsActivity
E/AndroidRuntime(4711): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime(4711): at java.lang.Class.newInstance(Class.java:1429)
E/AndroidRuntime(4711): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime(4711): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
E/AndroidRuntime(4711): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime(4711): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime(4711): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime(4711): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(4711): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(4711): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(4711): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(4711): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(4711): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(4711): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime(4711): at dalvik.system.NativeStart.main(Native Method)
That can be the result when you have compiled against a different library than you are using at runtime.
A good explanation can be had here.
Another possibility is having a duplicate class in the classpath somewhere, such as in a library jar.

Google map application program crashes at the launch

I have been trying to add a map to my application, I have followed instructions on the android developers HelloGoogleMaps tutorial but my map is just force closing when I run the maps option. I have obtained my api key logged permissions in manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MappDemo.mymaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:debuggable="true" >
<activity
android:name=".MappingDemoActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<uses-library android:name="com.google.android.maps" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ShowTheMap" android:label="Lat/Long Location"> </activity>
<activity android:name=".MapMe" android:label="Track Present Location"> </activity>
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</application>
</manifest>
Can some one tell if any thing needs to be configured in addition to run the code?
03-25 11:50:52.217: I/Process(687): Sending signal. PID: 687 SIG: 9
03-25 11:51:00.557: D/AndroidRuntime(729): Shutting down VM
03-25 11:51:00.567: W/dalvikvm(729): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-25 11:51:00.627: E/AndroidRuntime(729): FATAL EXCEPTION: main
03-25 11:51:00.627: E/AndroidRuntime(729): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MappDemo.mymaps/com.MappDemo.mymaps.MappingDemoActivity}: java.lang.ClassCastException: com.MappDemo.mymaps.MappingDemoActivity
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.os.Handler.dispatchMessage(Handler.java:99)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.os.Looper.loop(Looper.java:123)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-25 11:51:00.627: E/AndroidRuntime(729): at java.lang.reflect.Method.invokeNative(Native Method)
03-25 11:51:00.627: E/AndroidRuntime(729): at java.lang.reflect.Method.invoke(Method.java:507)
03-25 11:51:00.627: E/AndroidRuntime(729): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-25 11:51:00.627: E/AndroidRuntime(729): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-25 11:51:00.627: E/AndroidRuntime(729): at dalvik.system.NativeStart.main(Native Method)
03-25 11:51:00.627: E/AndroidRuntime(729): Caused by: java.lang.ClassCastException: com.MappDemo.mymaps.MappingDemoActivity
03-25 11:51:00.627: E/AndroidRuntime(729): at com.MappDemo.mymaps.MappingDemoActivity.onCreate(MappingDemoActivity.java:19)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-25 11:51:00.627: E/AndroidRuntime(729): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-25 11:51:00.627: E/AndroidRuntime(729): ... 11 more
03-25 11:51:10.013: I/Process(729): Sending signal. PID: 729 SIG: 9
03-25 11:52:16.817: D/AndroidRuntime(782): Shutting down VM
03-25 11:52:16.817: W/dalvikvm(782): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-25 11:52:16.877: E/AndroidRuntime(782): FATAL EXCEPTION: main
03-25 11:52:16.877: E/AndroidRuntime(782): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MappDemo.mymaps/com.MappDemo.mymaps.MappingDemoActivity}: java.lang.ClassCastException: com.MappDemo.mymaps.MappingDemoActivity
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.os.Handler.dispatchMessage(Handler.java:99)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.os.Looper.loop(Looper.java:123)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-25 11:52:16.877: E/AndroidRuntime(782): at java.lang.reflect.Method.invokeNative(Native Method)
03-25 11:52:16.877: E/AndroidRuntime(782): at java.lang.reflect.Method.invoke(Method.java:507)
03-25 11:52:16.877: E/AndroidRuntime(782): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-25 11:52:16.877: E/AndroidRuntime(782): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-25 11:52:16.877: E/AndroidRuntime(782): at dalvik.system.NativeStart.main(Native Method)
03-25 11:52:16.877: E/AndroidRuntime(782): Caused by: java.lang.ClassCastException: com.MappDemo.mymaps.MappingDemoActivity
03-25 11:52:16.877: E/AndroidRuntime(782): at com.MappDemo.mymaps.MappingDemoActivity.onCreate(MappingDemoActivity.java:19)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-25 11:52:16.877: E/AndroidRuntime(782): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-25 11:52:16.877: E/AndroidRuntime(782): ... 11 more
this is what I can see in logcat..
this what I have in mappingDemoActivity.java
public class MappingDemoActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//add listners for all buttons
View firstbutton= findViewById(R.id.geocode_button);
firstbutton.setOnClickListener((OnClickListener) this);
View secondButton = findViewById(R.id.latlong_button);
secondButton.setOnClickListener((OnClickListener) this);
View thirdButton = findViewById(R.id.presentLocation_button);
thirdButton.setOnClickListener((OnClickListener) this);
}
public void onClick(View v)
{
switch(v.getId())
{
case R.id.geocode_button:
Log.i("Button","Button 1 pushed");
Intent j = new Intent(this, ShowTheMap.class);
startActivity(j);
break;
case R.id.latlong_button:
Log.i("Button","Button 2 pushed");
Intent k = new Intent(this, ShowTheMap.class);
startActivity(k);
break;
case R.id.presentLocation_button:
Log.i("Button","Button 3 pushed");
Intent m = new Intent(this, MapMe.class);
startActivity(m);
break;
}
}
<uses-permission> tag needs to be a child of <manifest>, not <application>.
Try change <uses-permission> position, it can help.
Remove this code which is inside <intent-filter>
`<uses-library android:name="com.google.android.maps" />`
Because it is Already there in Below Quote.
Have a look at the Google MapsDemo that is included in the SDK my path is:
C:\android-sdk\add-ons\addon-google_apis-google_inc_-10\samples\MapsDemo
I had a quite anoying problem (MapActivity crashes on some devices) that was only showing up on certain(!) Android devices and also not in the Emulator. What I did was, to strip down the working demo until it was similar to my basic example. Then it turned out that Samsung phones don't accept package names not starting with com., while other devices (HTC Flyer) do! But this is not your problem, since you are using a com. package name.
There might be one more thing that comes to my mind. You didn't post your main.xml. If you use a nested LinearLayout below the MapView this also crashes the app. On top of the MapView it works fine. So in case you are using something like:
<LinearLayout ... >
<com.google.android.maps.MapView ... />
<LinearLayout ... >
<Button .../>
</LinearLayout>
</LinearLayout>
This could cause your problem. This is reproducable and throws exactly the same java.lang.ClassCastException error.
Also be sure to have your < uses-permission > and < uses-library > statements in the right place, as the guys said before. The first one must be a direct child of the < manifest > node. The second one must be a direct child of the < application > node.
I hope this helps you. I was going crazy with this stuff.
Bernd

Categories

Resources