Sorry the application has stopped unexpectedly android - android

Can someone please tell me how to fix my problem? I'm building my first android app and below is the error codes I get when application is launched in Emulator.
Thank you
04-12 21:07:03.480: D/AndroidRuntime(327): Shutting down VM
04-12 21:07:03.480: W/dalvikvm(327): threadid=1: thread exiting with uncaught exception(group=0x40015560)
04-12 21:07:03.580: E/AndroidRuntime(327): FATAL EXCEPTION: main
04-12 21:07:03.580: E/AndroidRuntime(327): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{obd.gss.namespace/obd.gss.namespace.activity.Gssobdreadermainactivity}: java.lang.ClassNotFoundException: obd.gss.namespace.activity.Gssobdreadermainactivity in loader dalvik.system.PathClassLoader[/data/app/obd.gss.namespace-1.apk]
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.os.Handler.dispatchMessage(Handler.java:99)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.os.Looper.loop(Looper.java:123)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-12 21:07:03.580: E/AndroidRuntime(327): at java.lang.reflect.Method.invokeNative(Native Method)
04-12 21:07:03.580: E/AndroidRuntime(327): at java.lang.reflect.Method.invoke(Method.java:507)
04-12 21:07:03.580: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-12 21:07:03.580: E/AndroidRuntime(327): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-12 21:07:03.580: E/AndroidRuntime(327): at dalvik.system.NativeStart.main(Native Method)
04-12 21:07:03.580: E/AndroidRuntime(327): Caused by: java.lang.ClassNotFoundException: obd.gss.namespace.activity.Gssobdreadermainactivity in loader dalvik.system.PathClassLoader[/data/app/obd.gss.namespace-1.apk]
04-12 21:07:03.580: E/AndroidRuntime(327): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-12 21:07:03.580: E/AndroidRuntime(327): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-12 21:07:03.580: E/AndroidRuntime(327): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-12 21:07:03.580: E/AndroidRuntime(327): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
04-12 21:07:03.580: E/AndroidRuntime(327): ... 11 more
Here are the contents of my manifest:
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity android:name=".Activity.Gssobdreadermainactivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity.Gssobdreaderconfigactivity"
android:label="#string/app_name">
</activity>
<activity android:name=".activity.Gssobdreadercommandactivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
</activity>
<service android:name="io.GssobdReaderService"/>
</application>

The cause of your problem is:
java.lang.ClassNotFoundException: obd.gss.namespace.activity.Gssobdreadermainactivity
Did you forget to add your Activity to your manifest?
Your Manifest should look something like:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="obd.gss.namespace"
android:versionCode="1"
android:versionName="1.0" >
<!-- permissions and other stuff here -->
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity android:name=".activity.Gssobdreadermainactivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--more activities and services here -->
</application>
</manifest>
Note that the combination of the manifest tag's package attribute and the activity tag's name attribute should be exactly the same as the fully qualified name of your class. Using my above example, you would wind up with:
obd.gss.namespace.activity.Gssobdreadermainactivity

I've had a similar issue, particularly with newly imported projects. The closest thing to a solution I've found is to make sure the .classpath file is writable, restart Eclipse(or whichever IDE you use), refresh the project, clean and build the project and try again. This doesn't always fix it, but doing it a couple times usually makes the error go away for me. The essence of the error is that the Android OS can't find the Activity, although it does know that the Activity should exist and is trying to launch it.

What does your source tree look like? You probably need to remove the .activity. and .Activity. prefixes from your applications fully quallified class name. Unless, of course, you have an "activity" and an "Activity" folder in your source tree (=

Related

my test application of worklight for android stopped unexpectedly when i tried to run that on AVD?

I have developed test application Using worklight for android environment. When i test that on worklight server it works fine, but when i tried to run the same on android virtual device (AVD) it throws an error message like Sorry The application Test (process com.Test) has stopped unexpectedly. Please try again. and the application terminates.
I am using Eclipse 4.2 and android version for AVD is 2.3.3
What is the solution of this...???
`
06-21 10:59:28.407: W/dalvikvm(1209): Unable to resolve superclass of Lcom/Test/Test; (14)
06-21 10:59:28.407: W/dalvikvm(1209): Link of class 'Lcom/Test/Test;' failed
06-21 10:59:28.427: D/AndroidRuntime(1209): Shutting down VM
06-21 10:59:28.427: W/dalvikvm(1209): threadid=1: thread exiting with uncaught exception (group=0xb607d4f0)
06-21 10:59:28.467: E/AndroidRuntime(1209): FATAL EXCEPTION: main
06-21 10:59:28.467: E/AndroidRuntime(1209): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.Test/com.Test.Test}: java.lang.ClassNotFoundException: com.Test.Test in loader dalvik.system.PathClassLoader[/data/app/com.Test-1.apk]
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.os.Handler.dispatchMessage(Handler.java:99)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.os.Looper.loop(Looper.java:130)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-21 10:59:28.467: E/AndroidRuntime(1209): at java.lang.reflect.Method.invokeNative(Native Method)
06-21 10:59:28.467: E/AndroidRuntime(1209): at java.lang.reflect.Method.invoke(Method.java:507)
06-21 10:59:28.467: E/AndroidRuntime(1209): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-21 10:59:28.467: E/AndroidRuntime(1209): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-21 10:59:28.467: E/AndroidRuntime(1209): at dalvik.system.NativeStart.main(Native Method)
06-21 10:59:28.467: E/AndroidRuntime(1209): Caused by: java.lang.ClassNotFoundException: com.Test.Test in loader dalvik.system.PathClassLoader[/data/app/com.Test-1.apk]
06-21 10:59:28.467: E/AndroidRuntime(1209): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-21 10:59:28.467: E/AndroidRuntime(1209): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-21 10:59:28.467: E/AndroidRuntime(1209): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-21 10:59:28.467: E/AndroidRuntime(1209): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
06-21 10:59:28.467: E/AndroidRuntime(1209): ... 11 more
`
Manifest code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Test"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="false"
android:resizeable="false"
android:anyDensity="false"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!-- Push permissions -->
<permission android:name="com.Test.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.Test.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="#string/app_name"
android:debuggable="true"
android:icon="#drawable/icon" >
<activity android:name=".Test"
android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.Test.Test.NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Preference Activity -->
<activity
android:name="com.worklight.common.WLPreferences"
android:label="Worklight Settings">
</activity>
<!-- Push service -->
<!-- In order to use the c2dm library, an application must declare a class with the name C2DMReceiver, in its own package, extending com.google.android.c2dm.C2DMBaseReceiver
It must also include this section in the manifest, replacing "com.google.android.apps.chrometophone" with its package name. -->
<service android:name=".GCMIntentService" />
<!-- Only google service can send data messages for the app. If permission is not set - any other app can generate it -->
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.Test" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.Test" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="10" />
</manifest>
Test.Java
package com.Test;
import android.os.Bundle;
import com.worklight.androidgap.WLDroidGap;
public class Test extends WLDroidGap {
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
}
/**
* onWLInitCompleted is called when the Worklight runtime framework initialization is complete
*/
#Override
public void onWLInitCompleted(Bundle savedInstanceState){
super.loadUrl(getWebMainFilePath());
// Add custom initialization code after this line
}
}
AVD 2.3.x has a known bug which prevents it from running WebView based apps. Use OS 4.x or 2.2.

Android - exception launching project on start after copying a lot of code over from another project

am getting this exception:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{business.premium/business.premium.Problemio}:
java.lang.ClassNotFoundException: business.premium.Problemio
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
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.ClassNotFoundException: business.premium.Problemio
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
... 11 more
java.lang.ClassNotFoundException: business.premium.Problemio
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
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)
it says that class is not there, but it IS there. I tried to configure things in my project's build path, but not too sure what to tweak there.
And here is how I start my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="business.premium"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomTheme"
android:name="MyApplication"
android:debuggable="true">
<activity
android:name=".Problemio"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Any thoughts on how to solve this, or what to look into? Thanks!
Its because you specified the "android:name" attribute in the application node in the manifest file.
Do not use the android:name attribute!
It, misleadingly, does not have anything to do with the name of your app and is actually the name of an extra class to load before loading your application. That's why you are getting the ClassNotFoundException.
Remove it and it should work:
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:description="#string/help_text" >
This answer is taken from: java.lang.ClassNotFoundException on working app

Android ClassNotFoundException on published app

I have an application thats been published awhile on Google play, I have been fixing reported bugs as they come in but recently this log below came in and I don't know what to make of it:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mammothtooth.flightinfo/com.mammothtooth.flightinfo.ui.SplashActivity}: java.lang.ClassNotFoundException: com.mammothtooth.flightinfo.ui.SplashActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/mnt/asec/com.mammothtooth.flightinfo-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1743)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
at android.app.ActivityThread.access$1500(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4277)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.mammothtooth.flightinfo.ui.SplashActivity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/mnt/asec/com.mammothtooth.flightinfo-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1735)
Does anyone know anything about this type of error log? My SplashScreenActivity is there and its defined as the entry point of the application in the manifest as follows:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
<uses-library android:name="com.google.android.maps" />
<activity
android:label="#string/app_name"
android:name=".ui.SplashActivity"
android:theme="#android:style/Theme.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|orientation"
android:screenOrientation="portrait">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Would the placing of the uses-library be an issue in the manifest?
I can't reproduce this issue on any of my android devices so any help is greatly appreciated in locating what might be the cause of this issue.

Unable to instantiate activity error? how to solve it?

I made an App. and since I just wanted to test some functions before adding them to the App,
I decided to copy my project into a new Project. When I tried to run the new project, the app crashes and the log-cat output is as follows.
Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidbook.MP"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" android:debuggable="true">
<activity
android:name=".MPActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="AddLocationActivity"></activity>
<activity android:name="MPData"></activity>
<activity android:name="MyLocations"></activity>
<activity android:name="MPInfo"></activity>
<activity android:name="Navigation"></activity>
</application>
LogCat:
05-21 15:30:03.710: E/AndroidRuntime(11294): FATAL EXCEPTION: main
05-21 15:30:03.710: E/AndroidRuntime(11294): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.androidbook.MP/com.androidbook.MP.MPActivity}:
java.lang.ClassNotFoundException: com.androidbook.MP.MPActivity in loader
dalvik.system.PathClassLoader[/data/app/com.androidbook.MP-1.apk]
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.os.Looper.loop(Looper.java:130)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.ActivityThread.main(ActivityThread.java:3691)
05-21 15:30:03.710: E/AndroidRuntime(11294): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 15:30:03.710: E/AndroidRuntime(11294): at java.lang.reflect.Method.invoke(Method.java:507)
05-21 15:30:03.710: E/AndroidRuntime(11294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
05-21 15:30:03.710: E/AndroidRuntime(11294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
05-21 15:30:03.710: E/AndroidRuntime(11294): at dalvik.system.NativeStart.main(Native Method)
05-21 15:30:03.710: E/AndroidRuntime(11294): Caused by: java.lang.ClassNotFoundException: com.androidbook.MP.MPActivity in loader dalvik.system.PathClassLoader[/data/app/com.androidbook.MP-1.apk]
05-21 15:30:03.710: E/AndroidRuntime(11294): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-21 15:30:03.710: E/AndroidRuntime(11294): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-21 15:30:03.710: E/AndroidRuntime(11294): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-21 15:30:03.710: E/AndroidRuntime(11294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
05-21 15:30:03.710: E/AndroidRuntime(11294): ... 11 more
Check your Manifest file, if the activity is to be declared.
for Ex:
<application>
<activity android:name=".MyActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Look through all the files in your new project and make sure they aren't referencing classes from the old project.
I think I found the solution, i should have checked that, the package name of the new project is included in the manifest file as for an example
"package="com.androidbook.MPTest" ..
my mistake is the i used the package name of the old project as a package name of the new project.

Phonegap app Crashes at Runtime

When i Try to run my app from both simulator and phys device it crashes, heres the log
I have phonegap 1.3.0 :)
01-12 14:13:51.742: W/dalvikvm(344): threadid=1: thread exiting with uncaught exception (group=0x40015560)
01-12 14:13:51.791: E/AndroidRuntime(344): FATAL EXCEPTION: main
01-12 14:13:51.791: E/AndroidRuntime(344): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.philipslighting.roadlight/com.philipslighting.roadlight.PhilipsRoadlightFinalActivity}: java.lang.ClassNotFoundException: com.philipslighting.roadlight.PhilipsRoadlightFinalActivity in loader dalvik.system.PathClassLoader[/data/app/com.philipslighting.roadlight-1.apk]
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.os.Handler.dispatchMessage(Handler.java:99)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.os.Looper.loop(Looper.java:123)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.reflect.Method.invokeNative(Native Method)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.reflect.Method.invoke(Method.java:507)
01-12 14:13:51.791: E/AndroidRuntime(344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-12 14:13:51.791: E/AndroidRuntime(344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-12 14:13:51.791: E/AndroidRuntime(344): at dalvik.system.NativeStart.main(Native Method)
01-12 14:13:51.791: E/AndroidRuntime(344): Caused by: java.lang.ClassNotFoundException: com.philipslighting.roadlight.PhilipsRoadlightFinalActivity in loader dalvik.system.PathClassLoader[/data/app/com.philipslighting.roadlight-1.apk]
01-12 14:13:51.791: E/AndroidRuntime(344): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-12 14:13:51.791: E/AndroidRuntime(344): ... 11 more
01-12 14:13:51.821: W/ActivityManager(61): Force finishing activity com.philipslighting.roadlight/.PhilipsRoadlightFinalActivity
01-12 14:13:52.341: W/ActivityManager(61): Activity pause timeout for HistoryRecord{4053ec18 com.philipslighting.roadlight/.PhilipsRoadlightFinalActivity}
01-12 14:13:53.151: I/Process(328): Sending signal. PID: 328 SIG: 9
01-12 14:13:53.181: I/ActivityManager(61): Process com.roadlight.philips (pid 328) has died.
01-12 14:13:54.331: I/Process(344): Sending signal. PID: 344 SIG: 9
01-12 14:13:54.371: W/InputManagerService(61): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#405c2d80
01-12 14:13:54.621: I/ActivityManager(61): Process com.philipslighting.roadlight (pid 344) has died.
here is my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.philipslighting.roadlight"
android:versionCode="4"
android:versionName="1.2" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Were in the activity tag would you you import the phone gap activity?
Thanks in advance !
It you have used this tutorial http://phonegap.com/start#android
then to fix java.lang.ClassNotFoundException as above you need to check the box next to cordova-XXX.jar in the "Order and Export" tab then you add a dependency for cordova-XXX.jar in Libraries tab at "Configure Build Path".
And of course mainclass's name must be correct at android:name="<main class name>".
I was following the phonegap droid getting started guide
In my case, I had created a folder called lib instead of libs. A symptom of this was that I had to manually add the jar to the build path. I removed the jar from the build path, renamed the lib folder to libs and things started working immediately.
In activity you import the file for PhoneGap please check it.
and see the index.html file in your folder.
I think just follow this path :
http://phonegap.com/start#android
See, video you will find solution for this.
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
you should mention with package name along with main class name in 'activity' tag,look at below example:
android:name="com.philipslighting.roadlight.MainActivity"
<activity
android:label="#string/app_name"
android:name="yourPACKAGEname.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources