Solution for "The application has stopped unexpectedly. Please try again" - android

I am developing an app for measuring the signal strength. I have no errors in code, but when I run the app I get an error saying that "The application (app name) package name has stopped unexpectedly". Herewith I am attaching the xml file, java file and android manifest file. Kindly reply as soon as possible.
XML FILE
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity"
>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/ref"
android:textSize="30sp"
/>
<Button
android:id="#+id/bfind"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:text="#string/ref1"
android:layout_gravity="center"
android:textSize="25sp" />
<ProgressBar android:id="#+id/signalLevel" />
<TextView android:id="#+id/signalLevelInfo"/>
</RelativeLayout>
JAVA FILE
package com.signalstrength.gsmece;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.telephony.*;
import android.telephony.gsm.GsmCellLocation;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
Button find;
TelephonyManager _telephonyManager;
GsmSignalStrengthListener _signalStrengthListener;
TextView display;
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation location = (GsmCellLocation) tm.getCellLocation();
String IMEI = tm.getDeviceId();
int lac = location.getLac();
int cid = location .getCid();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
_telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
_signalStrengthListener = new GsmSignalStrengthListener();
find = (Button) findViewById(R.id.bfind);
display = (TextView) findViewById(R.id.textView1) ;
find.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
display.setText("Calculating....");
}
});
}
public abstract class CellSignalStrength extends Object
{
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
MANIFEST FILE
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.signalstrength.gsmece"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.signalatrength.gsmece.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
LOGCAT FILE
03-16 19:15:16.859: D/AndroidRuntime(277): Shutting down VM
03-16 19:15:16.859: W/dalvikvm(277): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-16 19:15:17.089: E/AndroidRuntime(277): FATAL EXCEPTION: main
03-16 19:15:17.089: E/AndroidRuntime(277): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.signalstrength.gsmece/com.signalstrength.gsmece.MainActivity}: java.lang.IllegalStateException: System services not available to Activities before onCreate()
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-16 19:15:17.089: E/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
03-16 19:15:17.089: E/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
03-16 19:15:17.089: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-16 19:15:17.089: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-16 19:15:17.089: E/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
03-16 19:15:17.089: E/AndroidRuntime(277): Caused by: java.lang.IllegalStateException: System services not available to Activities before onCreate()
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.Activity.getSystemService(Activity.java:3526)
03-16 19:15:17.089: E/AndroidRuntime(277): at com.signalstrength.gsmece.MainActivity.<init>(MainActivity.java:23)
03-16 19:15:17.089: E/AndroidRuntime(277): at java.lang.Class.newInstanceImpl(Native Method)
03-16 19:15:17.089: E/AndroidRuntime(277): at java.lang.Class.newInstance(Class.java:1429)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-16 19:15:17.089: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-16 19:15:17.089: E/AndroidRuntime(277): ... 11 more
03-16 19:15:25.850: I/Process(277): Sending signal. PID: 277 SIG: 9
03-16 19:15:50.780: D/AndroidRuntime(288): Shutting down VM
03-16 19:15:50.780: W/dalvikvm(288): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-16 19:15:50.810: E/AndroidRuntime(288): FATAL EXCEPTION: main
03-16 19:15:50.810: E/AndroidRuntime(288): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.signalstrength.gsmece/com.signalstrength.gsmece.MainActivity}: java.lang.IllegalStateException: System services not available to Activities before onCreate()
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.os.Handler.dispatchMessage(Handler.java:99)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.os.Looper.loop(Looper.java:123)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-16 19:15:50.810: E/AndroidRuntime(288): at java.lang.reflect.Method.invokeNative(Native Method)
03-16 19:15:50.810: E/AndroidRuntime(288): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-16 19:15:50.810: E/AndroidRuntime(288): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-16 19:15:50.810: E/AndroidRuntime(288): at dalvik.system.NativeStart.main(Native Method)
03-16 19:15:50.810: E/AndroidRuntime(288): Caused by: java.lang.IllegalStateException: System services not available to Activities before onCreate()
03-16 19:15:50.810: E/AndroidRuntime(288): at com.signalstrength.gsmece.MainActivity.<init>(MainActivity.java:23)
03-16 19:15:50.810: E/AndroidRuntime(288): at java.lang.Class.newInstanceImpl(Native Method)
03-16 19:15:50.810: E/AndroidRuntime(288): at java.lang.Class.newInstance(Class.java:1429)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-16 19:15:50.810: E/AndroidRuntime(288): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-16 19:15:50.810: E/AndroidRuntime(288): ... 11 more
03-16 19:20:50.879: I/Process(288): Sending signal. PID: 288 SIG: 9

Your manifest file has wrong package name when starting the main activity. Replace
android:name="com.signalatrength.gsmece.MainActivity"
with
android:name="com.signalstrength.gsmece.MainActivity"

You can't call getSystemServices until onCreate is called. Move the lines where you get a TelephonyManager and those that rely on it into onCreate

Related

Unfortunately, “App Name” has stopped. (Eclipse, Android)

I am somewhat new to Android app Programming.
I was able to create the app and be able to export it and install it to my android device, but when I try to run it it quits and displays the message "Unfortunately, My First App has stopped." This problem is also present when I try to run the app in an emulator
This is my AndroidManifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tada"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<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>
</manifest>
This is my mainactivity file:
package com.example.tada;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
#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.main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
item.getItemId();
return true;
}
}
This is my activity_main file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.tada.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/welcome_to_the_tada_app" />
</RelativeLayout>
Here is my LogCat
11-23 01:22:21.520: D/AndroidRuntime(1055): Shutting down VM
11-23 01:22:21.520: W/dalvikvm(1055): threadid=1: thread exiting with uncaught exception (group=0xb3afbba8)
11-23 01:22:21.560: E/AndroidRuntime(1055): FATAL EXCEPTION: main
11-23 01:22:21.560: E/AndroidRuntime(1055): Process: com.example.tada, PID: 1055
11-23 01:22:21.560: E/AndroidRuntime(1055): java.lang.Error: Unresolved compilation problem:
11-23 01:22:21.560: E/AndroidRuntime(1055): activity_main cannot be resolved or is not a field
11-23 01:22:21.560: E/AndroidRuntime(1055): at com.example.tada.MainActivity.onCreate(MainActivity.java:14)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.Activity.performCreate(Activity.java:5231)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.os.Looper.loop(Looper.java:136)
11-23 01:22:21.560: E/AndroidRuntime(1055): at android.app.ActivityThread.main(ActivityThread.java:5017)
11-23 01:22:21.560: E/AndroidRuntime(1055): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 01:22:21.560: E/AndroidRuntime(1055): at java.lang.reflect.Method.invoke(Method.java:515)
11-23 01:22:21.560: E/AndroidRuntime(1055): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-23 01:22:21.560: E/AndroidRuntime(1055): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-23 01:22:21.560: E/AndroidRuntime(1055): at dalvik.system.NativeStart.main(Native Method)
11-23 01:22:26.100: I/Process(1055): Sending signal. PID: 1055 SIG: 9
When developing for android, always have a logcat window open.
When you see the crash dialog, the logcat will reveal the root cause of the error, making it easy for you to find it and fix it.
Its the issue of corrupted R.java file.....Immediately create a new project and do the code or switch ur sdk.
Delete your R.java file and Clean your project. No need to create a new project.

android.view.Inflate Exception, emulator says application has stopped unexpectedly

I am new to android and using google map v2 for the 1st time by looking at android developer tutorials. getting exceptions and don't know what is wrong. Can someone help me out ?
LOG CAT
03-12 22:00:01.678: D/AndroidRuntime(278): Shutting down VM
03-12 22:00:01.678: W/dalvikvm(278): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-12 22:00:01.758: E/AndroidRuntime(278): FATAL EXCEPTION: main
03-12 22:00:01.758: E/AndroidRuntime(278): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sameer.example.maps_example/com.sameer.example.maps_example.MainActivity}: android.view.InflateException: Binary XML file line #3: Error inflating class fragment
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.os.Looper.loop(Looper.java:123)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-12 22:00:01.758: E/AndroidRuntime(278): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 22:00:01.758: E/AndroidRuntime(278): at java.lang.reflect.Method.invoke(Method.java:521)
03-12 22:00:01.758: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-12 22:00:01.758: E/AndroidRuntime(278): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-12 22:00:01.758: E/AndroidRuntime(278): at dalvik.system.NativeStart.main(Native Method)
03-12 22:00:01.758: E/AndroidRuntime(278): Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class fragment
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-12 22:00:01.758: E/AndroidRuntime(278): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.Activity.setContentView(Activity.java:1647)
03-12 22:00:01.758: E/AndroidRuntime(278): at com.sameer.example.maps_example.MainActivity.onCreate(MainActivity.java:11)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-12 22:00:01.758: E/AndroidRuntime(278): ... 11 more
03-12 22:00:01.758: E/AndroidRuntime(278): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.sameer.example.maps_example-2.apk]
03-12 22:00:01.758: E/AndroidRuntime(278): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-12 22:00:01.758: E/AndroidRuntime(278): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-12 22:00:01.758: E/AndroidRuntime(278): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
03-12 22:00:01.758: E/AndroidRuntime(278): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
03-12 22:00:01.758: E/AndroidRuntime(278): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
03-12 22:00:01.758: E/AndroidRuntime(278): ... 19 more
XML LAYOUT FILE
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
Java File
package com.sameer.example.maps_example;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Android Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sameer.example.maps_example"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission
android:name="com.sameer.example.maps_example.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.sameer.example.maps_example.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You are writing application for API V8 but you are using MapFragment and Activity classes.
instead you should use the android-support-v4 library and use the SupportMapFragment and FragmentActvity classes.
To add the support library to the project you need to download it using the SDK Manager.
and then you can right click your project and chose Android Tools -> SupportLibrary.
Then extand your map Activity from FragmentActivity and make shure you are importing:
android.support.v4.app.FragmentActivity
in you XML file use the SupportMapFragment class instead of MapFragment, like so:
<fragment
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />

how to get contacts from google contacts programmatically in android

i am using contacservice class and i set the usercredentials of my gmail account
and i want to get the contact from the google contacts for that my code as follows
ContactService myservice=new ContactService("ex-app-1.0");
myservice.setUserCredentials("username","password");
URL url=new URL("https://www.google.com/m8/feeds/contacts/xxx#gmail.com/full");
ContactFeed resultFeed = myService.getFeed(feedUrl, ContactFeed.class);
but i got an exception like this in logcat
03-16 12:24:49.217: E/AndroidRuntime(1013): FATAL EXCEPTION: main
03-16 12:24:49.217: E/AndroidRuntime(1013): java.lang.RuntimeException: Unable to start activity
ComponentInfo{c.b.p/c.b.p.ContactsBackupActivity}: java.lang.NullPointerException
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.os.Handler.dispatchMessage(Handler.java:99)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.os.Looper.loop(Looper.java:123)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-16 12:24:49.217: E/AndroidRuntime(1013): at java.lang.reflect.Method.invokeNative(Native Method)
03-16 12:24:49.217: E/AndroidRuntime(1013): at java.lang.reflect.Method.invoke(Method.java:521)
03-16 12:24:49.217: E/AndroidRuntime(1013): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-16 12:24:49.217: E/AndroidRuntime(1013): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-16 12:24:49.217: E/AndroidRuntime(1013): at dalvik.system.NativeStart.main(Native Method)
03-16 12:24:49.217: E/AndroidRuntime(1013): Caused by: java.lang.NullPointerException
03-16 12:24:49.217: E/AndroidRuntime(1013): at c.b.p.ContactsBackupActivity.onCreate(ContactsBackupActivity.java:128)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-16 12:24:49.217: E/AndroidRuntime(1013): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-16 12:24:49.217: E/AndroidRuntime(1013): ... 11 more
03-16 12:29:49.329: I/Process(1013): Sending signal. PID: 1013 SIG: 9

Help with app, (force close)

I created an app, on eclips, but when i try to run it is force close why?
logcat :
03-16 19:28:09.820: INFO/ActivityManager(439): Start proc com.soundboard.Jaribarh.LIL_SIDDI for activity com.soundboard.Jaribarh.LIL_SIDDI/.Jaribarh_soundbord: pid=2621 uid=10020 gids={1015}
03-16 19:28:09.860: DEBUG/AK8973(415): Compass Start
03-16 19:28:09.860: DEBUG/Sensors(439): open_akm, fd=126
03-16 19:28:09.870: DEBUG/dalvikvm(2621): Debugger has detached; object registry had 1 entries
03-16 19:28:09.910: DEBUG/AndroidRuntime(2621): Shutting down VM
03-16 19:28:09.910: WARN/dalvikvm(2621): threadid=1: thread exiting with uncaught exception (group=0x40025a18)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): FATAL EXCEPTION: main
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.soundboard.Jaribarh.LIL_SIDDI/com.soundboard.Jaribarh.LIL_SIDDI.Jaribarh_soundbord}: java.lang.ClassNotFoundException: com.soundboard.Jaribarh.LIL_SIDDI.Jaribarh_soundbord in loader dalvik.system.PathClassLoader[/data/app/com.soundboard.Jaribarh.LIL_SIDDI-2.apk]
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2755)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2854)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.ActivityThread.access$2300(ActivityThread.java:136)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.os.Handler.dispatchMessage(Handler.java:99)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.os.Looper.loop(Looper.java:143)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.ActivityThread.main(ActivityThread.java:5068)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at java.lang.reflect.Method.invokeNative(Native Method)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at java.lang.reflect.Method.invoke(Method.java:521)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at dalvik.system.NativeStart.main(Native Method)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): Caused by: java.lang.ClassNotFoundException: com.soundboard.Jaribarh.LIL_SIDDI.Jaribarh_soundbord in loader dalvik.system.PathClassLoader[/data/app/com.soundboard.Jaribarh.LIL_SIDDI-2.apk]
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.Instrumentation.newActivity(Instrumentation.java:1034)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)
03-16 19:28:09.910: ERROR/AndroidRuntime(2621): ... 11 more
03-16 19:28:09.920: WARN/ActivityManager(439): Force finishing activity com.soundboard.Jaribarh.LIL_SIDDI/.Jaribarh_soundbord
03-16 19:28:10.420: WARN/ActivityManager(439): Activity pause timeout for HistoryRecord{48894070 com.soundboard.Jaribarh.LIL_SIDDI/.Jaribarh_soundbord}
It looks like the class com.soundboard.Jaribarh.LIL_SIDDI/.Jaribarh_soundbord doesn't exist. Possibly a misspelling of soundboard?
This is the important line from your log:
java.lang.ClassNotFoundException: com.soundboard.Jaribarh.LIL_SIDDI.Jaribarh_soundbord
Is there a typo in the class name, or is it possible that this Activity is not declared in the Manifest?

NetworkConnectivityListener class not found on UPC300-2.2 Viewsonic G-Tablet

I am getting this error in my application, and this happens only on UPC300-2.2 Viewsonic G-Tablet. All answers I've found so far (including this one) adviced on putting
<uses-permission android:name="android.permission.INTERNET"/>
to the manifest file, but it doesn't help.
Here is the complete stacktrace:
java.lang.NoClassDefFoundError: android.net.NetworkConnectivityListener
at
com.google.android.maps.MapActivity.onCreate(MapActivity.java:199)
at
myapp.Activity.ActivityMapSearch.onCreate(ActivityMapSearch.java:99)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at
android.os.Handler.dispatchMessage(Handler.java:99)
at
android.os.Looper.loop(Looper.java:123)
at
android.app.ActivityThread.main(ActivityThread.java:4627)
at
java.lang.reflect.Method.invokeNative(Native
Method) at
java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at
dalvik.system.NativeStart.main(Native
Method)
If that is TRUE, you can grab the source code of the class from the Android Source and add it yourself

Categories

Resources