I'm trying to run this code (android app):
manifest file:
<<<<<<< Original
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testamish"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Results"
android:label="#string/title_activity_results" >
</activity>
<activity
android:name=".SpinnerDemo"
android:label="#string/title_activity_spinner_demo" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
=======
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
<application>
<activity android:name="com.example.testamish.MainActivity"
android:label="#string/title_activity_main"
>
</activity>
</application>
</manifest>
>>>>>>> Added
However, when trying to launch this on a virtual device, I get those errors and I don't get why (code has no errors/warnings):
10-17 17:07:22.685: E/Trace(819): error opening trace file: No such file or directory (2)
10-17 17:07:23.430: D/AndroidRuntime(819): Shutting down VM
10-17 17:07:23.430: W/dalvikvm(819): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
10-17 17:07:23.445: E/AndroidRuntime(819): FATAL EXCEPTION: main
10-17 17:07:23.445: E/AndroidRuntime(819): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.testamish/com.example.testamish.MainActivity}: java.lang.ClassNotFoundException: com.example.testamish.MainActivity
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.os.Handler.dispatchMessage(Handler.java:99)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.os.Looper.loop(Looper.java:137)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-17 17:07:23.445: E/AndroidRuntime(819): at java.lang.reflect.Method.invokeNative(Native Method)
10-17 17:07:23.445: E/AndroidRuntime(819): at java.lang.reflect.Method.invoke(Method.java:511)
10-17 17:07:23.445: E/AndroidRuntime(819): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-17 17:07:23.445: E/AndroidRuntime(819): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-17 17:07:23.445: E/AndroidRuntime(819): at dalvik.system.NativeStart.main(Native Method)
10-17 17:07:23.445: E/AndroidRuntime(819): Caused by: java.lang.ClassNotFoundException: com.example.testamish.MainActivity
10-17 17:07:23.445: E/AndroidRuntime(819): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
10-17 17:07:23.445: E/AndroidRuntime(819): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-17 17:07:23.445: E/AndroidRuntime(819): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
10-17 17:07:23.445: E/AndroidRuntime(819): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
10-17 17:07:23.445: E/AndroidRuntime(819): ... 11 more
Thanks for your help!
Solution
Remove this from you Manifest (from the original one!):
<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>
And add this four line to the Activity, you want to start on launch:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Details
In Android, the data&actions between activities is driven by Intents. When you want to launch an app, it's kind an action between the Launcher app, and your app. It's also an Intent, when you start the Gallery, to choose an image for Facebook, or to start the Twitter app, to share something.
You can define in the Manifest.xml, for each Activity of your app, to which Intents to catch. You defined a MainActivity in your Manifest, and set to catch the android.intent.action.MAIN and android.intent.category.LAUNCHER intents. These two Intents responds, to start the app from the Launcher.
So the emulator was finding for your MainActivity, 'cause it read from you Manifest, to start that. But cannot found it, so throw an exception.
Related
EDIT: STILL NEED HELP >:( Logcat added, as well as the manifest fix I can use for emulators only but not physical devices. If I transfer file to APK and load onto my device the manifest.xml file for that project just reverts to the second copy of the manifest.xml file.
I had this code working literally 5 minutes ago where the whole app would run a welcome screen, 6 different "flash cards", and an exit screen with button transitions. Now all of a sudden if I push any button the app crashes. Just says app has stopped working unexpectedly. I would put the logcat, but the error message is always dealing with the activity missing in the manifest. I am getting frustrated and just want to sleep.
logcat I get for the bottom manifest file that it always goes to. If it manually add the others then I do not get it. DOES NOT WORK WHEN TURNING PROJECT INTO APK FORMAT
11-04 05:29:01.912: D/gralloc_goldfish(819): Emulator without GPU emulation detected.
11-04 05:29:04.302: D/AndroidRuntime(819): Shutting down VM
11-04 05:29:04.302: W/dalvikvm(819): threadid=1: thread exiting with uncaught exception (group=0x41465700)
11-04 05:29:04.382: E/AndroidRuntime(819): FATAL EXCEPTION: main
11-04 05:29:04.382: E/AndroidRuntime(819): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.androidassignment2/com.example.androidassignment2.MainActivity}; have you declared this activity in your AndroidManifest.xml?
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Activity.startActivityForResult(Activity.java:3390)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.Activity.startActivityForResult(Activity.java:3351)
11-04 05:29:04.382: E/AndroidRuntime(819): at com.example.androidassignment2.Startup$1.onClick(Startup.java:22)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.view.View.performClick(View.java:4240)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.view.View$PerformClick.run(View.java:17721)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.os.Handler.handleCallback(Handler.java:730)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.os.Handler.dispatchMessage(Handler.java:92)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.os.Looper.loop(Looper.java:137)
11-04 05:29:04.382: E/AndroidRuntime(819): at android.app.ActivityThread.main(ActivityThread.java:5103)
11-04 05:29:04.382: E/AndroidRuntime(819): at java.lang.reflect.Method.invokeNative(Native Method)
11-04 05:29:04.382: E/AndroidRuntime(819): at java.lang.reflect.Method.invoke(Method.java:525)
11-04 05:29:04.382: E/AndroidRuntime(819): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-04 05:29:04.382: E/AndroidRuntime(819): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-04 05:29:04.382: E/AndroidRuntime(819): at dalvik.system.NativeStart.main(Native Method)
working manifest file fix
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidassignment2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.androidassignment2.Startup"
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="com.example.androidassignment2.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.AndroidAssignment2.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.AndroidAssignment2.MainActivity" />
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_1" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_2" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_3" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_4" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2_5" >
</activity>
<activity
android:name="com.example.androidassignment2.AndroidAssignment2" >
</activity>
<activity
android:name="com.example.androidassignment2.MainActivity" >
</activity>
</application>
</manifest>
all of the activities just go away once put into apk
this happens to the manifest file after putting the project into apk
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidassignment2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.androidassignment2.Startup"
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="com.example.androidassignment2.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.AndroidAssignment2.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.AndroidAssignment2.MainActivity" />
</activity>
</application>
</manifest>
EDIT: Before and after manifests.
LOGCAT JUST SAYS ACTIVITY NOT FOUND DECLARE IN MANIFEST
I have finally finished my app and everything was working fine. I went back to add in the admob stuff and now it will not start in the emulator. it says it successfully installed the app on the emulator but it does not launch and the icon is not visible to try to manually run. I think the manifest is where my error is but I am unsure.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidsleepmachine.gamble"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.WAKE_LOCK" >
</uses-permission>
<uses-permission android:name="android.permission.Internet" >
</uses-permission>
<uses-permission android:name="android.permission.Write_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"
></activity>
<activity
android:name=".Splash"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="com.AndroidSleepMachine.gamble.SPLASH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.AndroidSleepMachine.gamble.HOME"
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=".About"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="com.AndroidSleepMachine.gamble.ABOUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.androidsleepmachine.gamble.Ship" />
<activity android:name="com.androidsleepmachine.gamble.OceanThunder" />
<activity android:name="com.androidsleepmachine.gamble.Ocean" />
<activity android:name="com.androidsleepmachine.gamble.Forest" />
<activity android:name="com.androidsleepmachine.gamble.Rain" />
<activity android:name="com.androidsleepmachine.gamble.Thunderbirds" />
<activity android:name="com.androidsleepmachine.gamble.Meditation" />
<activity android:name="com.androidsleepmachine.gamble.Focus" />
<activity android:name="com.androidsleepmachine.gamble.Pain" />
</application>
</manifest>
logcat files
09-23 13:17:47.582: E/AndroidRuntime(1563): FATAL EXCEPTION: main
09-23 13:17:47.582: E/AndroidRuntime(1563): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.androidsleepmachine.gamble/com.AndroidSleepMachine.gamble.HOME}:
java.lang.ClassNotFoundException: com.AndroidSleepMachine.gamble.HOME
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.access$600(ActivityThread.java:130)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.os.Looper.loop(Looper.java:137)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.main(ActivityThread.java:4745)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.reflect.Method.invokeNative(Native Method)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.reflect.Method.invoke(Method.java:511)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
dalvik.system.NativeStart.main(Native Method)
09-23 13:17:47.582: E/AndroidRuntime(1563): Caused by:
java.lang.ClassNotFoundException: com.AndroidSleepMachine.gamble.HOME
09-23 13:17:47.582: E/AndroidRuntime(1563): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-23 13:17:47.582: E/AndroidRuntime(1563): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
It looks like your main activity name is incorrect. Java is case sensitive and your application package name is
package="com.androidsleepmachine.gamble"
while your main activity class name is
com.AndroidSleepMachine.gamble.HOME
The ClassNotFoundException is being thrown because your Activity class name is incorrect in the manifest and isn't being found by the class loader.
It cannot find a class called:
com.AndroidSleepMachine.gamble.HOME
Why is "AndroidSleepMachine" using capital letters?
Why not just use:
android:name=".HOME"
...if your class is indeed called HOME.java? Case-sensitivity may be causing your issue.
com.AndroidSleepMachine.gamble.HOME is not the same as com.androidsleepmachine.gamble.HOME
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
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 (=
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>