im new to android and i have a prob in ksoap2 jar . im getting the following exception while running the program and the program closes with error- unfortunately the app stopped. im using ksoap2-android-assembly-2.5.8-jar-with-dependencies for the jars and i have included it both in the build path lib and also in /lib folder but still the problem persists.
im using the .zip file i dont kno how to convert it to jar ... is this the prob. please help , thanks in advance .
03-04 06:24:38.337: E/AndroidRuntime(790): FATAL EXCEPTION: main
03-04 06:24:38.337: E/AndroidRuntime(790): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
03-04 06:24:38.337: E/AndroidRuntime(790): at com.android.example.ksoap2demo.MainActivity.onCreate(MainActivity.java:27)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.Activity.performCreate(Activity.java:5104)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.os.Looper.loop(Looper.java:137)
03-04 06:24:38.337: E/AndroidRuntime(790): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 06:24:38.337: E/AndroidRuntime(790): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 06:24:38.337: E/AndroidRuntime(790): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 06:24:38.337: E/AndroidRuntime(790): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 06:24:38.337: E/AndroidRuntime(790): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-04 06:24:38.337: E/AndroidRuntime(790): at dalvik.system.NativeStart.main(Native Method)
First problem which i can for see is rename the folder to libs instead of lib. and if you unzip the .zip file you will probably get the jar file and that jar file you need to put in the libs folder and add in the build path. that will resolve the problem.
Turns out external jars such as
ksoap2-android-assembly-2.5.8-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!
Related
I recently moved to MoPub and it all appears to be working well except for I have started getting this exception saying that com.millennialmedia.android.VideoPlayer can not be found. I looked and it isn't on the Millennial jar (I just got the latest from their site). Also my AndroidManifest mentions that class and Android Studio also says it can't be found.
This is what I have there:
<activity android:name="com.millennialmedia.android.MMActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|keyboard" />
<activity android:name="com.millennialmedia.android.VideoPlayer" android:configChanges="keyboardHidden|orientation|keyboard" />
On Android Studio the VideoPlayer part is red.
This is the exception I got:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{mypackage/com.millennialmedia.android.VideoPlayer}: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.millennialmedia.android.VideoPlayer" on path: /data/app/mypackage-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(NativeStart.java)
Looking at the latest Millennial Media documentation, it looks like
com.millennialmedia.android.VideoPlayer
isn't included. This may be an update that needs to be made.
Alice
I am new in Android Development. I am working on cordova platform
I have created a sample hello world app and getting this error when i am trying to open it in genymotion. ALthough the app compile succesfully but when i run it in genymotion it just shows the prompt with text "Unfortunately "APP" has stopped."
The Error log shows.
01-12 08:16:04.867 2073-2073/com.technoserves.crudnew D/dalvikvm﹕ Late-enabling CheckJNI
01-12 08:16:06.107 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ Unable to resolve superclass of Lcom/technoserves/crudnew/CordovaApp; (14)
01-12 08:16:06.119 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ Link of class 'Lcom/technoserves/crudnew/CordovaApp;' failed
01-12 08:16:06.135 2073-2073/com.technoserves.crudnew D/AndroidRuntime﹕ Shutting down VM
01-12 08:16:06.135 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa6142908)
01-12 08:16:06.155 2073-2073/com.technoserves.crudnew E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.technoserves.crudnew/com.technoserves.crudnew.CordovaApp}: java.lang.ClassNotFoundException: Didn't find class "com.technoserves.crudnew.CordovaApp" on path: /data/app/com.technoserves.crudnew-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.technoserves.crudnew.CordovaApp" on path: /data/app/com.technoserves.crudnew-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
01-12 08:16:22.399 2073-2073/com.technoserves.crudnew I/Process﹕ Sending signal. PID: 2073 SIG: 9
I have updated my cordova to resolve but still same error however a few days ago it was working fine and i have build some apps.
First download Cordova jar file from following link:
http://www.java2s.com/Code/JarDownload/cordova/cordova-1.8.1.jar.zip
after that extract the folder and put cordova-1.8.1 inside your libs folder of project in eclipse
And right click on your project--> properties and Select Android from left pane and scroll to bottom remove the cordova library if added.
then clean and build your project.
I am having issues with my PhoneGap application that has Urban Airship push notifications running. Everything works fine except when closing the app using Android's native task killer (swiping the app off). When the phone is left idle for 30 seconds to a minute I get the error, "Unfortunately, [app] has stopped". I was viewing LogCat and when this error occured I got these errors:
03-04 10:16:30.420: E/EmbeddedLogger(595): App crashed! Process: com.appname.pacakagename
03-04 10:16:30.420: E/EmbeddedLogger(595): App crashed! Package: com.appname.pacakagename v1 (1.1.2)
03-04 10:16:30.420: E/AndroidRuntime(10257): FATAL EXCEPTION: main
03-04 10:16:30.420: E/AndroidRuntime(10257): java.lang.ExceptionInInitializerError
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.Class.newInstanceImpl(Native Method)
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.Class.newInstance(Class.java:1130)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2909)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread.access$1600(ActivityThread.java:162)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1504)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.os.Looper.loop(Looper.java:158)
03-04 10:16:30.420: E/AndroidRuntime(10257): at android.app.ActivityThread.main(ActivityThread.java:5789)
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 10:16:30.420: E/AndroidRuntime(10257): at java.lang.reflect.Method.invoke(Method.java:525)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:843)
03-04 10:16:30.420: E/AndroidRuntime(10257): at dalvik.system.NativeStart.main(Native Method)
03-04 10:16:30.420: E/AndroidRuntime(10257): Caused by: java.lang.NullPointerException
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.Preferences.migratePreferencesFromFileToDb(Preferences.java:173)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.analytics.AnalyticsPreferences.<init>(AnalyticsPreferences.java:32)
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.analytics.EventService.<clinit>(EventService.java:58)
03-04 10:16:30.420: E/AndroidRuntime(10257): ... 13 more
03-04 10:16:30.430: W/asset(595): Copying FileAsset 0x7860b3b0 (zip:/data/app/com.appname.pacakagename-2.apk:/resources.arsc) to buffer size 200924 to make it aligned.
03-04 10:16:30.430: E/EmbeddedLogger(595): Application Label: appname
So from this I can see these lines:
03-04 10:16:30.420: E/AndroidRuntime(10257): Caused by: java.lang.NullPointerException
03-04 10:16:30.420: E/AndroidRuntime(10257): at com.urbanairship.Preferences.migratePreferencesFromFileToDb(Preferences.java:173)
I wasn't sure where to look to debug that error, I ran this:
find ./ -type f -name *Preferences*
But I couldn't find any file called Preferences.java.
The plugin this is referring to is:
https://github.com/urbanairship/phonegap-ua-push
The Android src is here:
https://github.com/urbanairship/phonegap-ua-push/tree/master/src/android
This was solved by upgrading to the latest version of the Urban Airship plugin and my version of PhoneGap.
03-04 11:09:41.524: E/AndroidRuntime(943): FATAL EXCEPTION: main
03-04 11:09:41.524: E/AndroidRuntime(943): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.otobusumnerede/com.otobusumnerede.AyarlarActivity}: java.lang.NullPointerException
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.os.Looper.loop(Looper.java:137)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 11:09:41.524: E/AndroidRuntime(943): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 11:09:41.524: E/AndroidRuntime(943): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 11:09:41.524: E/AndroidRuntime(943): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 11:09:41.524: E/AndroidRuntime(943): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-04 11:09:41.524: E/AndroidRuntime(943): at dalvik.system.NativeStart.main(Native Method)
03-04 11:09:41.524: E/AndroidRuntime(943): Caused by: java.lang.NullPointerException
03-04 11:09:41.524: E/AndroidRuntime(943): at com.otobusumnerede.AyarlarActivity.onCreate(AyarlarActivity.java:24)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.Activity.performCreate(Activity.java:5104)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-04 11:09:41.524: E/AndroidRuntime(943): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-04 11:09:41.524: E/AndroidRuntime(943): ... 11 more
03-04 11:24:14.452: E/Trace(1311): error opening trace file: No such file or directory (2)
03-04 11:24:44.843: E/AndroidRuntime(1311): FATAL EXCEPTION: main
03-04 11:24:44.843: E/AndroidRuntime(1311): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.otobusumnerede/com.otobusumnerede.AyarlarActivity}: java.lang.NullPointerException
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.os.Looper.loop(Looper.java:137)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-04 11:24:44.843: E/AndroidRuntime(1311): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 11:24:44.843: E/AndroidRuntime(1311): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 11:24:44.843: E/AndroidRuntime(1311): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 11:24:44.843: E/AndroidRuntime(1311): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-04 11:24:44.843: E/AndroidRuntime(1311): at dalvik.system.NativeStart.main(Native Method)
03-04 11:24:44.843: E/AndroidRuntime(1311): Caused by: java.lang.NullPointerException
03-04 11:24:44.843: E/AndroidRuntime(1311): at com.otobusumnerede.AyarlarActivity.onCreate(AyarlarActivity.java:25)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.Activity.performCreate(Activity.java:5104)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-04 11:24:44.843: E/AndroidRuntime(1311): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-04 11:24:44.843: E/AndroidRuntime(1311): ... 11 more
If you can copy text from your activity and paste it, or atleast paste line no.25 of your code, its easier to help you.
Going by as it is so early in your activity, check onCreate() first
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourlayoutxml);
imageView = (ImageView) findViewById(R.id.yourimageviewid); //just an example
make sure to call setContentView() before any findViewById
check if you have declared, initialized your variables properly
if so, look for a value that could be null
This question already has an answer here:
Joda Time in Eclipse: NoClassDefFoundError
(1 answer)
Closed 9 years ago.
I want to get the current date and time by means of DateTime Class ,I have download Joda from http://sourceforge.net/projects/joda-time/files/joda-time/
and I added three jar files which are in the extracted folder to java build path of my project properties.and my code is like the following code:
import org.joda.time.DateTime;
public class TappedNFC extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tapped_nfc);
Button BeamButton=(Button)findViewById(R.id.BeamButton);
BeamButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
DateTime dt = new DateTime();
int month = dt.getMonthOfYear();
TextView tx=(TextView)findViewById(R.id.textView1);
tx.setText(Integer.toString(month));
}
});
}
but the logcat gets exception:
03-04 14:57:18.309: E/AndroidRuntime(540): FATAL EXCEPTION: main
03-04 14:57:18.309: E/AndroidRuntime(540): java.lang.NoClassDefFoundError: org.joda.time.DateTime
03-04 14:57:18.309: E/AndroidRuntime(540): at com.example.tappednfc.TappedNFC$1.onClick(TappedNFC.java:28)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.view.View.performClick(View.java:3460)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.view.View$PerformClick.run(View.java:13955)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.os.Handler.handleCallback(Handler.java:605)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.os.Handler.dispatchMessage(Handler.java:92)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.os.Looper.loop(Looper.java:137)
03-04 14:57:18.309: E/AndroidRuntime(540): at android.app.ActivityThread.main(ActivityThread.java:4340)
03-04 14:57:18.309: E/AndroidRuntime(540): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 14:57:18.309: E/AndroidRuntime(540): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 14:57:18.309: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-04 14:57:18.309: E/AndroidRuntime(540): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-04 14:57:18.309: E/AndroidRuntime(540): at dalvik.system.NativeStart.main(Native Method)
I haven't used Joda before,So please help me to solve this problem.
Thanks a lot.
When you say you added them to your build path did you use the normal (but incorrect for Android) route of "Properties" > "Java Build Path" > "Add External Jars" ? The correct way to bundle external jars in your Android project is to create a "libs" (note the plural) directory and directly paste them under the directory.
A project build will then show your dependent jars under "Android Dependencies" and they will be bundled correctly into the APK. If you don't follow that route then the external jars are not added and you'll see the sorts of exceptions you noted.