12-11 02:45:59.232: E/AndroidRuntime(348): FATAL EXCEPTION: main
12-11 02:45:59.232: E/AndroidRuntime(348): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ass.ui/com.ass.ui.Settings}: java.lang.InstantiationException: com.ass.ui.Settings
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.os.Handler.dispatchMessage(Handler.java:99)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.os.Looper.loop(Looper.java:123)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.reflect.Method.invoke(Method.java:521)
12-11 02:45:59.232: E/AndroidRuntime(348): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-11 02:45:59.232: E/AndroidRuntime(348): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-11 02:45:59.232: E/AndroidRuntime(348): at dalvik.system.NativeStart.main(Native Method)
12-11 02:45:59.232: E/AndroidRuntime(348): Caused by: java.lang.InstantiationException: com.ass.ui.Settings
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.Class.newInstanceImpl(Native Method)
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.Class.newInstance(Class.java:1429)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-11 02:45:59.232: E/AndroidRuntime(348): ... 11 more
this is my Logcat error, and below is the android manifest file. This works yesterday and i havent changed a single letter and the error persists now.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ass.ui"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.ass.ui.Main"
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.ass.ui.Settings"
android:configChanges="orientation"
android:label="#string/app_name"
android:noHistory="true"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
Seems I cant see where Im wrong here. Tnx for a help.
The problem lies with your Java class, not the configuration. Most probably your activity class has no public empty constructor or it is abstract.
Related
I am trying to create an application location, but it shows me the error the application of gmaps (com.formation.gmaps) has stopped unexpectedly.
Note that I have already uninstalled eclipse but always this error appears.
Here is my Error log:
03-25 14:21:59.914: E/AndroidRuntime(431): FATAL EXCEPTION: main
03-25 14:21:59.914: E/AndroidRuntime(431): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.formation.gmaps/com.formation.gmaps.MainActivity}: java.lang.ClassNotFoundException: com.formation.gmaps.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.formation.gmaps-1.apk]
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.os.Handler.dispatchMessage(Handler.java:99)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.os.Looper.loop(Looper.java:123)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-25 14:21:59.914: E/AndroidRuntime(431): at java.lang.reflect.Method.invokeNative(Native Method)
03-25 14:21:59.914: E/AndroidRuntime(431): at java.lang.reflect.Method.invoke(Method.java:521)
03-25 14:21:59.914: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-25 14:21:59.914: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-25 14:21:59.914: E/AndroidRuntime(431): at dalvik.system.NativeStart.main(Native Method)
03-25 14:21:59.914: E/AndroidRuntime(431): Caused by: java.lang.ClassNotFoundException: com.formation.gmaps.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.formation.gmaps-1.apk]
03-25 14:21:59.914: E/AndroidRuntime(431): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-25 14:21:59.914: E/AndroidRuntime(431): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-25 14:21:59.914: E/AndroidRuntime(431): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-25 14:21:59.914: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-25 14:21:59.914: E/AndroidRuntime(431): ... 11 more
This is MainActivity.java
package com.formation.gmaps;
import android.os.Bundle;
import android.view.Menu;
import com.google.android.maps.MapActivity;
public class MainActivity extends MapActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
This is AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.formation.gmaps.MainActivity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<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"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_GPS"/>
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.formation.gmaps.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>
</application>
</manifest>
The system cannot find the MainActivity.class in your com.formation.gmaps package. This can be caused by many things but you can check if:
1. You declared your activity com.formation.gmaps.MainActivity in your AndroidManifest.xml.
2. Your MainActivity.java has the correct package name set in the top of the file (e.g package com.formation.gmaps).
3. You should have import com.formation.gmaps.R;
4. Use the shortcut CTRL + SHIFT + O in Eclipse. This will import any missing classes.
5. A Project -> Clean could also help(provided you're using Eclipse).
EDIT
In your AndroidManifest.xml change package="com.formation.gmaps.MainActivity" to package="com.formation.gmaps".
EDIT 02
Your problem is your MapActivity.java. Read this. If you used the latest API then this paragraph explains it:
Because maps are encapsulated in the MapFragment class, you can
implement them by extending the Android standard Activity class,
rather than extending the MapActivity used in version 1.
So please check your MapActivity.class. If it extends Fragment then the problem is there. You can test this by changing your MainActivity to extent Activity instead of MapActivity. Do not forget to add import android.app.Activity;
If you're still using V1 of Maps then read the documentation on the link I have provided and switch to V2. You might still be using the old version which requires the process of importing a maps.jar.
This might help you as well.
Good luck and let us know if you run into more trouble.
I am making a game using LibGdx framwork.This is working fine for dekstop but when try to run for android
give exception:-
12-03 10:39:46.687: E/AndroidRuntime(9487): FATAL EXCEPTION: main
12-03 10:39:46.687: E/AndroidRuntime(9487): java.lang.NoClassDefFoundError: com.inoXmobile.glowjump.SuperJumper
12-03 10:39:46.687: E/AndroidRuntime(9487): at com.inoXmobile.glowjump.GlowJupmAndroid.onCreate(GlowJupmAndroid.java:35)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.os.Looper.loop(Looper.java:130)
12-03 10:39:46.687: E/AndroidRuntime(9487): at android.app.ActivityThread.main(ActivityThread.java:3687)
12-03 10:39:46.687: E/AndroidRuntime(9487): at java.lang.reflect.Method.invokeNative(Native Method)
12-03 10:39:46.687: E/AndroidRuntime(9487): at java.lang.reflect.Method.invoke(Method.java:507)
12-03 10:39:46.687: E/AndroidRuntime(9487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-03 10:39:46.687: E/AndroidRuntime(9487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
12-03 10:39:46.687: E/AndroidRuntime(9487): at dalvik.system.NativeStart.main(Native Method)I
have put these jars and so file in android project libs folder:-
**1- gdx.jar
2-gdx-backend-android.jar
3-armeabi
4-armeabi-v7a**
My Android Activity is:-
public class GlowJupmAndroid extends AndroidApplication {
/** Called when the activity is first created. */
private PowerManager.WakeLock wl;
Bundle next;
#Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.initialize(new SuperJumper(), false);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "DoNotDimScreen");
}
#Override
protected void onResume() {
super.onResume();
wl.acquire();
}
#Override
protected void onPause() {
super.onPause();
wl.release();
}
}
and my manifest file is this:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.inoXmobile.glowjump"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto">
<application android:icon="#drawable/icon" android:debuggable="true" android:label="#string/app_name">
<activity android:name=".GlowJupmAndroid"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
please anyone suggest me why this exception occure many time I have been try to remove project and try to run ,clean and and new jar download from cod.google,but it is not working.
This looks like the ADT 17 problem. A good explanation can be found here, but the simplest approach is probably to follow the steps here.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have spent almost two weeks now just trying to run my android game. Every time I run it on my phone from Eclipse it crashes and says "The process closed unexpectedly, please try again" or something like that. I created a new project with just an activity and other basic classes to see what the problem was, and I still get the message. I am not new to Java but am new to android, and I am having a very hard time debugging. I always get this error:
11-16 14:15:55.613: D/AndroidRuntime(9468): Shutting down VM
11-16 14:15:55.613: W/dalvikvm(9468): threadid=1: thread exiting with uncaught exception (group=0x4001d570)
11-16 14:15:55.613: E/AndroidRuntime(9468): FATAL EXCEPTION: main
11-16 14:15:55.613: E/AndroidRuntime(9468): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.stickman.revolution/com.example.stickman.revolution.MainActivity}: java.lang.ClassNotFoundException: com.example.stickman.revolution.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stickman.revolution-2.apk]
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.os.Looper.loop(Looper.java:130)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.reflect.Method.invoke(Method.java:507)
11-16 14:15:55.613: E/AndroidRuntime(9468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-16 14:15:55.613: E/AndroidRuntime(9468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-16 14:15:55.613: E/AndroidRuntime(9468): at dalvik.system.NativeStart.main(Native Method)
11-16 14:15:55.613: E/AndroidRuntime(9468): Caused by: java.lang.ClassNotFoundException: com.example.stickman.revolution.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stickman.revolution-2.apk]
11-16 14:15:55.613: E/AndroidRuntime(9468): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
11-16 14:15:55.613: E/AndroidRuntime(9468): ... 11 more
Here is the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.stickman.revolution"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<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>
</application>
You are getting a ClassNotFoundException your MainActivity and therefore the Activity can't get launched. Check your Android Manifest and look if your Activity is registered.
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
I want to use the GreenDroid library in my application.
I added it as a library in the project settings.
My XML:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.korn.tvbrain"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.GreenDroid"
android:name=".TVBrainApplication">>
<activity
android:label="#string/app_name"
android:name=".TVBrainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
TVBrainActivity:
public class TVBrainActivity extends GDActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.gd_action_bar_empty);
}
}
Application Class:
public class AppBrainApplication extends GDApplication{
#Override
public Class<?> getHomeActivityClass() {
return AppBrainApplication.class;
}
}
Error Log:
10-24 10:25:55.265: E/AndroidRuntime(524): Uncaught handler: thread main exiting due to uncaught exception
10-24 10:25:55.295: E/AndroidRuntime(524): java.lang.RuntimeException: Unable to instantiate application com.korn.tvbrain.TVBrainApplication: java.lang.ClassNotFoundException: com.korn.tvbrain.TVBrainApplication in loader dalvik.system.PathClassLoader#44bfd908
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:523)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3996)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.ActivityThread.access$2900(ActivityThread.java:119)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1901)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.os.Looper.loop(Looper.java:123)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.ActivityThread.main(ActivityThread.java:4363)
10-24 10:25:55.295: E/AndroidRuntime(524): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 10:25:55.295: E/AndroidRuntime(524): at java.lang.reflect.Method.invoke(Method.java:521)
10-24 10:25:55.295: E/AndroidRuntime(524): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-24 10:25:55.295: E/AndroidRuntime(524): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-24 10:25:55.295: E/AndroidRuntime(524): at dalvik.system.NativeStart.main(Native Method)
10-24 10:25:55.295: E/AndroidRuntime(524): Caused by: java.lang.ClassNotFoundException: com.korn.tvbrain.TVBrainApplication in loader dalvik.system.PathClassLoader#44bfd908
10-24 10:25:55.295: E/AndroidRuntime(524): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
10-24 10:25:55.295: E/AndroidRuntime(524): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
10-24 10:25:55.295: E/AndroidRuntime(524): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.Instrumentation.newApplication(Instrumentation.java:942)
10-24 10:25:55.295: E/AndroidRuntime(524): at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:518)
10-24 10:25:55.295: E/AndroidRuntime(524): ... 11 more
I always get a ClassNotFound Exception.
In application tag in AndroidManifest file I guess android:name=".TVBrainApplication" here the name should be android:name=".AppBrainApplication"
It looks like you should add android:name=".AppBrainApplication" instead of android:name=".TVBrainApplication" in your AndroidManifest