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?
Related
In my android project i use other projects as librarys. They are added in the build path as Projects and in Order and Export
03-16 19:54:32.418: I/System.out(27217): Antes del unmarshal
03-16 19:55:36.488: W/dalvikvm(27217): VFY: unable to find class referenced in signature (Lcom/theoryinpractise/halbuilder/api/ReadableRepresentation;)
03-16 19:55:36.488: I/dalvikvm(27217): Could not find method com.theoryinpractise.halbuilder.api.ReadableRepresentation.getValue, referenced from method com.theoryinpractise.halbuilder.jaxrs.HalUnmarshaller.getObjectFromRepresentation
03-16 19:55:36.488: W/dalvikvm(27217): VFY: unable to resolve interface method 11651: Lcom/theoryinpractise/halbuilder/api/ReadableRepresentation;.getValue (Ljava/lang/String;)Ljava/lang/Object;
03-16 19:55:36.488: D/dalvikvm(27217): VFY: replacing opcode 0x72 at 0x003e
03-16 19:55:36.498: W/dalvikvm(27217): VFY: unable to resolve exception class 1502 (Lcom/theoryinpractise/halbuilder/api/RepresentationException;)
03-16 19:55:36.498: W/dalvikvm(27217): VFY: unable to find exception handler at addr 0x58
03-16 19:55:36.508: W/dalvikvm(27217): VFY: rejected Lcom/theoryinpractise/halbuilder/jaxrs/HalUnmarshaller;.getObjectFromRepresentation (Lcom/theoryinpractise/halbuilder/api/ReadableRepresentation;Ljava/lang/Class;)Ljava/lang/Object;
03-16 19:55:36.508: W/dalvikvm(27217): VFY: rejecting opcode 0x0d at 0x0058
03-16 19:55:36.508: W/dalvikvm(27217): VFY: rejected Lcom/theoryinpractise/halbuilder/jaxrs/HalUnmarshaller;.getObjectFromRepresentation (Lcom/theoryinpractise/halbuilder/api/ReadableRepresentation;Ljava/lang/Class;)Ljava/lang/Object;
03-16 19:55:36.508: W/dalvikvm(27217): Verifier rejected class Lcom/theoryinpractise/halbuilder/jaxrs/HalUnmarshaller;
03-16 19:55:45.828: W/System.err(27217): java.util.concurrent.ExecutionException: java.lang.VerifyError: com/theoryinpractise/halbuilder/jaxrs/HalUnmarshaller
03-16 19:55:45.848: W/System.err(27217): at java.util.concurrent.FutureTask.report(FutureTask.java:93)
03-16 19:55:45.848: W/System.err(27217): at java.util.concurrent.FutureTask.get(FutureTask.java:163)
03-16 19:55:45.858: W/System.err(27217): at android.os.AsyncTask.get(AsyncTask.java:483)
03-16 19:55:45.858: W/System.err(27217): at com.example.modelo.ObtieneRecursos.obtieneTokenMe(ObtieneRecursos.java:49)
03-16 19:55:45.868: W/System.err(27217): at com.example.pestanasholacampus.InitActivity.compruebaUsuario(InitActivity.java:123)
03-16 19:55:45.878: W/System.err(27217): at com.example.pestanasholacampus.InitActivity$2.onClick(InitActivity.java:68)
03-16 19:55:45.878: W/System.err(27217): at android.view.View.performClick(View.java:4442)
03-16 19:55:45.878: W/System.err(27217): at android.view.View$PerformClick.run(View.java:18473)
03-16 19:55:45.878: W/System.err(27217): at android.os.Handler.handleCallback(Handler.java:733)
03-16 19:55:45.878: W/System.err(27217): at android.os.Handler.dispatchMessage(Handler.java:95)
03-16 19:55:45.888: W/System.err(27217): at android.os.Looper.loop(Looper.java:136)
03-16 19:55:45.888: W/System.err(27217): at android.app.ActivityThread.main(ActivityThread.java:5105)
03-16 19:55:45.888: W/System.err(27217): at java.lang.reflect.Method.invokeNative(Native Method)
03-16 19:55:45.888: W/System.err(27217): at java.lang.reflect.Method.invoke(Method.java:515)
03-16 19:55:45.888: W/System.err(27217): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
03-16 19:55:45.888: W/System.err(27217): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
03-16 19:55:45.898: W/System.err(27217): at dalvik.system.NativeStart.main(Native Method)
03-16 19:55:45.898: W/System.err(27217): Caused by: java.lang.VerifyError: com/theoryinpractise/halbuilder/jaxrs/HalUnmarshaller
03-16 19:55:45.898: W/System.err(27217): at com.example.modelo.ObtencionTokenUsuario.doInBackground(ObtencionTokenUsuario.java:60)
03-16 19:55:45.898: W/System.err(27217): at com.example.modelo.ObtencionTokenUsuario.doInBackground(ObtencionTokenUsuario.java:1)
03-16 19:55:45.898: W/System.err(27217): at android.os.AsyncTask$2.call(AsyncTask.java:288)
03-16 19:55:45.908: W/System.err(27217): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-16 19:55:45.908: W/System.err(27217): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
03-16 19:55:45.908: W/System.err(27217): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
03-16 19:55:45.908: W/System.err(27217): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
03-16 19:55:45.908: W/System.err(27217): at java.lang.Thread.run(Thread.java:841)
I only see one rare thing in the buildPath. It only contains this:
I have read another posts with this problem but i dont know why does not works if the build path contains the projects.
All helps are welcome. Thanks.
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
Following this tutorial: Getting started with Android.
I try to create my first phonegap project using Eclipse. However, when clicking on the icon of "Cordova Example"(name of the application from the example of PhoneGap) on the screen of device. An error named : "the application Cordova Example (process org.apache.cordova.example) has stopped unexpectedly. Please try again" occurs.
This is the log file when error occurs:
01-02 09:40:46.280: D/AndroidRuntime(310): Shutting down VM
01-02 09:40:46.280: W/dalvikvm(310): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-02 09:40:46.308: E/AndroidRuntime(310): FATAL EXCEPTION: main
01-02 09:40:46.308: E/AndroidRuntime(310): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.apache.cordova.example/org.apache.cordova.example.cordovaExample}: java.lang.ClassNotFoundException: org.apache.cordova.example.cordovaExample in loader dalvik.system.PathClassLoader[/data/app/org.apache.cordova.example-2.apk]
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.os.Looper.loop(Looper.java:123)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.reflect.Method.invokeNative(Native Method)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.reflect.Method.invoke(Method.java:521)
01-02 09:40:46.308: E/AndroidRuntime(310): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-02 09:40:46.308: E/AndroidRuntime(310): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-02 09:40:46.308: E/AndroidRuntime(310): at dalvik.system.NativeStart.main(Native Method)
01-02 09:40:46.308: E/AndroidRuntime(310): Caused by: java.lang.ClassNotFoundException: org.apache.cordova.example.cordovaExample in loader dalvik.system.PathClassLoader[/data/app/org.apache.cordova.example-2.apk]
01-02 09:40:46.308: E/AndroidRuntime(310): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-02 09:40:46.308: E/AndroidRuntime(310): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-02 09:40:46.308: E/AndroidRuntime(310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
01-02 09:40:46.308: E/AndroidRuntime(310): ... 11 more
The java.lang.ClassNotFoundException seems like can't find your Main Class, it could be a name problem of your java main class or in config.xml or in manifest, check all names are correctly.
Regards.
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
Please find the attached code to retrieve the contact name for the incoming call. Here I hard coded the number as "123". I have added this contact in the emulator. But the application crashes at getContentResolver().query. Any help please.
String number = "123";
// define the columns I want the query to return
String[] projection = new String[] {
ContactsContract.PhoneLookup.DISPLAY_NAME,
ContactsContract.PhoneLookup.NUMBER };
// encode the phone number and build the filter URI
Uri contactUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
// query time
Cursor c = getContentResolver().query(contactUri, projection, null,
null, null);
// if the query returns 1 or more results
// return the first result
if (c.moveToFirst()) {
String name = c.getString(c
.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME));
Log.i("Map", "Contact Name " + name);
}
03-16 11:12:09.304: INFO/ActivityManager(65): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=ContactName.com/.ContactName }
03-16 11:12:09.544: INFO/ActivityManager(65): Start proc ContactName.com for activity ContactName.com/.ContactName: pid=406 uid=10024 gids={}
03-16 11:12:10.284: DEBUG/ddm-heap(406): Got feature list request
03-16 11:12:11.103: ERROR/DatabaseUtils(145): Writing exception to parcel
03-16 11:12:11.103: ERROR/DatabaseUtils(145): java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/phone_lookup/9895318420 from pid=406, uid=10024 requires android.permission.READ_CONTACTS
03-16 11:12:11.103: ERROR/DatabaseUtils(145): at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:240)
03-16 11:12:11.103: ERROR/DatabaseUtils(145): at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:116)
03-16 11:12:11.103: ERROR/DatabaseUtils(145): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:98)
03-16 11:12:11.103: ERROR/DatabaseUtils(145): at android.os.Binder.execTransact(Binder.java:287)
03-16 11:12:11.103: ERROR/DatabaseUtils(145): at dalvik.system.NativeStart.run(Native Method)
03-16 11:12:11.194: DEBUG/AndroidRuntime(406): Shutting down VM
03-16 11:12:11.204: WARN/dalvikvm(406): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
03-16 11:12:11.214: ERROR/AndroidRuntime(406): Uncaught handler: thread main exiting due to uncaught exception
03-16 11:12:11.284: ERROR/AndroidRuntime(406): java.lang.RuntimeException: Unable to start activity ComponentInfo{ContactName.com/ContactName.com.ContactName}: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/phone_lookup/9895318420 from pid=406, uid=10024 requires android.permission.READ_CONTACTS
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.os.Handler.dispatchMessage(Handler.java:99)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.os.Looper.loop(Looper.java:123)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at java.lang.reflect.Method.invokeNative(Native Method)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at java.lang.reflect.Method.invoke(Method.java:521)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at dalvik.system.NativeStart.main(Native Method)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/phone_lookup/9895318420 from pid=406, uid=10024 requires android.permission.READ_CONTACTS
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.os.Parcel.readException(Parcel.java:1218)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.content.ContentProviderProxy.bulkQuery(ContentProviderNative.java:326)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.content.ContentProviderProxy.query(ContentProviderNative.java:345)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.content.ContentResolver.query(ContentResolver.java:202)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at ContactName.com.ContactName.onCreate(ContactName.java:31)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
03-16 11:12:11.284: ERROR/AndroidRuntime(406): ... 11 more
03-16 11:12:11.344: INFO/Process(65): Sending signal. PID: 406 SIG: 3
03-16 11:12:11.354: INFO/dalvikvm(406): threadid=7: reacting to signal 3
03-16 11:12:11.354: ERROR/dalvikvm(406): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
03-16 11:12:19.364: WARN/ActivityManager(65): Launch timeout has expired, giving up wake lock!
03-16 11:12:20.454: WARN/ActivityManager(65): Activity idle timeout for HistoryRecord{43ea9568 ContactName.com/.ContactName}
03-16 11:17:11.394: INFO/Process(406): Sending signal. PID: 406 SIG: 9
03-16 11:17:11.454: INFO/ActivityManager(65): Process ContactName.com (pid 406) has died.
03-16 11:17:11.684: ERROR/gralloc(65): [unregister] handle 0x388370 still locked (state=40000001)
03-16 11:17:11.724: INFO/UsageStats(65): Unexpected resume of com.android.launcher while already resumed in ContactName.com
03-16 11:17:11.914: WARN/InputManagerService(65): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#43b7f980
03-16 11:21:00.374: DEBUG/dalvikvm(65): GC freed 13348 objects / 660920 bytes in 285ms
Can you give the logs output from logcat.
You need a context to call getContentResolver(). Are you calling this method in your activity class or somewhere else?
Edit: You need to add permissions to read the contacts from the phone's address book. Please follow this link:
http://developer.android.com/reference/android/Manifest.permission.html#READ_CONTACTS
ERROR/DatabaseUtils(145): java.lang.SecurityException: Permission Denial: reading
com.android.providers.contacts.ContactsProvider2 uri
content://com.android.contacts/phone_lookup/9895318420 from pid=406, uid=10024 requires
android.permission.READ_CONTACTS
The solution is right in the error log you posted. Add permission READ_CONTACTS to your AndroidManifest You'll need a few other related permissions as well, look at the documentation for content to see which. -- which you need will depend on how you use the API.