I'm learning the basics of Android development and I've ran into some issues with setting up the programming environment. Now I've created a new Android Application Project and I'm running it using my phone. When I do, I get an error message on my phone: "Unfortunately, HelloWorld has stopped." and I'm not sure if it's supposed to or not, considering that I've done absolutely nothing to the project files. Here is the LogCat output in its entirety:
03-10 18:34:16.264: D/dalvikvm(2673): Late-enabling CheckJNI
03-10 18:34:16.361: W/dalvikvm(2673): VFY: unable to resolve static field 1559 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
03-10 18:34:16.361: D/dalvikvm(2673): VFY: replacing opcode 0x62 at 0x0004
03-10 18:34:16.364: D/AndroidRuntime(2673): Shutting down VM
03-10 18:34:16.364: W/dalvikvm(2673): threadid=1: thread exiting with uncaught exception (group=0x416d7d40)
03-10 18:34:16.368: E/AndroidRuntime(2673): FATAL EXCEPTION: main
03-10 18:34:16.368: E/AndroidRuntime(2673): Process: com.example.helloworld, PID: 2673
03-10 18:34:16.368: E/AndroidRuntime(2673): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
03-10 18:34:16.368: E/AndroidRuntime(2673): at com.example.helloworld.MainActivity.onCreate(MainActivity.java:18)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.Activity.performCreate(Activity.java:5248)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.os.Handler.dispatchMessage(Handler.java:102)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.os.Looper.loop(Looper.java:136)
03-10 18:34:16.368: E/AndroidRuntime(2673): at android.app.ActivityThread.main(ActivityThread.java:5102)
03-10 18:34:16.368: E/AndroidRuntime(2673): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 18:34:16.368: E/AndroidRuntime(2673): at java.lang.reflect.Method.invoke(Method.java:515)
03-10 18:34:16.368: E/AndroidRuntime(2673): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-10 18:34:16.368: E/AndroidRuntime(2673): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-10 18:34:16.368: E/AndroidRuntime(2673): at dalvik.system.NativeStart.main(Native Method)
03-10 18:34:18.259: I/Process(2673): Sending signal. PID: 2673 SIG: 9
03-10 18:36:57.062: W/dalvikvm(2984): VFY: unable to resolve static field 1559 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
03-10 18:36:57.063: D/dalvikvm(2984): VFY: replacing opcode 0x62 at 0x0004
03-10 18:36:57.064: D/AndroidRuntime(2984): Shutting down VM
03-10 18:36:57.064: W/dalvikvm(2984): threadid=1: thread exiting with uncaught exception (group=0x416d7d40)
03-10 18:36:57.066: E/AndroidRuntime(2984): FATAL EXCEPTION: main
03-10 18:36:57.066: E/AndroidRuntime(2984): Process: com.example.helloworld, PID: 2984
03-10 18:36:57.066: E/AndroidRuntime(2984): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
03-10 18:36:57.066: E/AndroidRuntime(2984): at com.example.helloworld.MainActivity.onCreate(MainActivity.java:18)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.Activity.performCreate(Activity.java:5248)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.os.Handler.dispatchMessage(Handler.java:102)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.os.Looper.loop(Looper.java:136)
03-10 18:36:57.066: E/AndroidRuntime(2984): at android.app.ActivityThread.main(ActivityThread.java:5102)
03-10 18:36:57.066: E/AndroidRuntime(2984): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 18:36:57.066: E/AndroidRuntime(2984): at java.lang.reflect.Method.invoke(Method.java:515)
03-10 18:36:57.066: E/AndroidRuntime(2984): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-10 18:36:57.066: E/AndroidRuntime(2984): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-10 18:3
6:57.066: E/AndroidRuntime(2984): at dalvik.system.NativeStart.main(Native Method)
So, is this normal behavior or have I done something wrong while setting up Eclipse, etc?
It looks like the Android compatibility library is not correctly configured for your project. In Eclipse, right click on the project in the package explorer and select Android Tools > Add Support Library. After setting up the support library, clean and rebuild your project.
This is normal behavior when reporting an error with your application.
Related
I am developing an android application to show all call logs in the list and when user taps on any call log, i need to open native app's call details screen for that tapped call log.
I have tried following code snippet and it works fine in Emulator (Pure android OS.)
Intent mDetailsIntent = new Intent(Intent.ACTION_VIEW); mDetailsIntent.setType(android.provider.CallLog.Calls.CONTENT_TYPE);
Uri mUri = Uri.withAppendedPath(android.provider.CallLog.Calls.CONTENT_URI, String.valueOf(mCallLog.getId()));
mDetailsIntent.setData(mUri);
startActivity(mDetailsIntent);
But when I run it on Samsung device, it shown the last recent call log's details screen each time regardless of call log id.
And for HTC devices, it throws ActivityNotFoundException.
Following log cat is for HTC device.
**03-10 14:19:00.772: D/LogsFragment(20947): Call log details uri==>content://call_log/calls/62
03-10 14:19:00.782: W/System.err(20947): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://call_log/calls/62 }
03-10 14:19:00.792: W/System.err(20947): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1638)
03-10 14:19:00.792: W/System.err(20947): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1510)
03-10 14:19:00.792: W/System.err(20947): at android.app.Activity.startActivityForResult(Activity.java:3258)
03-10 14:19:00.792: W/System.err(20947): at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:833)
03-10 14:19:00.792: W/System.err(20947): at android.support.v4.app.Fragment.startActivity(Fragment.java:856)
03-10 14:19:00.792: W/System.err(20947): at com.cwiker.fragments.LogsFragment.onItemClick(LogsFragment.java:219)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AbsListView.performItemClick(AbsListView.java:1099)
03-10 14:19:00.792: W/System.err(20947): at android.widget.ListView.performItemClick(ListView.java:4758)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2556)
03-10 14:19:00.792: W/System.err(20947): at android.widget.AbsListView$1.run(AbsListView.java:3223)
03-10 14:19:00.792: W/System.err(20947): at android.os.Handler.handleCallback(Handler.java:608)
03-10 14:19:00.802: W/System.err(20947): at android.os.Handler.dispatchMessage(Handler.java:92)
03-10 14:19:00.802: W/System.err(20947): at android.os.Looper.loop(Looper.java:156)
03-10 14:19:00.802: W/System.err(20947): at android.app.ActivityThread.main(ActivityThread.java:4987)
03-10 14:19:00.802: W/System.err(20947): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 14:19:00.802: W/System.err(20947): at java.lang.reflect.Method.invoke(Method.java:511)
03-10 14:19:00.802: W/System.err(20947): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-10 14:19:00.802: W/System.err(20947): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-10 14:19:00.802: W/System.err(20947): at dalvik.system.NativeStart.main(Native Method)**
Please help me to solve this problem.
Thanks.
I'm trying to do something similar to this post. But when I try it it throws a fatal exception.
03-06 16:48:23.421: W/dalvikvm(2300): VFY: unable to resolve exception class 748 (Lcom/google/zxing/ChecksumException;)
03-06 16:48:23.421: W/dalvikvm(2300): VFY: unable to find exception handler at addr 0xc
03-06 16:48:23.421: W/dalvikvm(2300): VFY: rejected Lcom/example/pfc/MainActivity;.onCameraFrame (Lorg/opencv/android/CameraBridgeViewBase$CvCameraViewFrame;)Lorg/opencv/core/Mat;
03-06 16:48:23.421: W/dalvikvm(2300): VFY: rejecting opcode 0x0d at 0x000c
03-06 16:48:23.421: W/dalvikvm(2300): VFY: rejected Lcom/example/pfc/MainActivity;.onCameraFrame (Lorg/opencv/android/CameraBridgeViewBase$CvCameraViewFrame;)Lorg/opencv/core/Mat;
03-06 16:48:23.421: W/dalvikvm(2300): Verifier rejected class Lcom/example/pfc/MainActivity;
03-06 16:48:23.421: W/dalvikvm(2300): Class init failed in newInstance call (Lcom/example/pfc/MainActivity;)
03-06 16:48:23.421: W/dalvikvm(2300): threadid=1: thread exiting with uncaught exception (group=0x416efd40)
03-06 16:48:23.424: E/AndroidRuntime(2300): FATAL EXCEPTION: main
03-06 16:48:23.424: E/AndroidRuntime(2300): Process: com.example.pfc, PID: 2300
03-06 16:48:23.424: E/AndroidRuntime(2300): java.lang.VerifyError: com/example/pfc/MainActivity
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.Class.newInstanceImpl(Native Method)
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.Class.newInstance(Class.java:1208)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.Instrumentation.newActivity(Instrumentation.java:1084)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2126)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.os.Handler.dispatchMessage(Handler.java:102)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.os.Looper.loop(Looper.java:136)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.main(ActivityThread.java:5102)
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.reflect.Method.invokeNative(Native Method)
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.reflect.Method.invoke(Method.java:515)
03-06 16:48:23.424: E/AndroidRuntime(2300): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-06 16:48:23.424: E/AndroidRuntime(2300): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-06 16:48:23.424: E/AndroidRuntime(2300): at dalvik.system.NativeStart.main(Native Method)
I though it was becase of minimun SDK version but no... Also I know the problem is in the onCameraFrame, because when I comment the try/catch, I can run the app. Any ideas?
Thanks.
Solved, the core.jar must be in the Libs folder...
I'm using google maps v2 in my application. The app crashes as soon as it starts. Min SDK version is 8 and Max is 19. I can't get what the error is. Below is my LogCat and Code, Please Help
Log
03-10 16:17:37.977: E/AndroidRuntime(24296): FATAL EXCEPTION: main
03-10 16:17:37.977: E/AndroidRuntime(24296): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appscourt.earth.map.location/com.appscourt.earth.map.location.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2136)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2174)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.ActivityThread.access$700(ActivityThread.java:141)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1267)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.os.Handler.dispatchMessage(Handler.java:99)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.os.Looper.loop(Looper.java:137)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.ActivityThread.main(ActivityThread.java:5059)
03-10 16:17:37.977: E/AndroidRuntime(24296): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 16:17:37.977: E/AndroidRuntime(24296): at java.lang.reflect.Method.invoke(Method.java:511)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
03-10 16:17:37.977: E/AndroidRuntime(24296): at dalvik.system.NativeStart.main(Native Method)
03-10 16:17:37.977: E/AndroidRuntime(24296): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:260)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.Activity.setContentView(Activity.java:1893)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.appscourt.earth.map.location.MainActivity.onCreate(MainActivity.java:31)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.Activity.performCreate(Activity.java:5058)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
03-10 16:17:37.977: E/AndroidRuntime(24296): ... 11 more
03-10 16:17:37.977: E/AndroidRuntime(24296): Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behavior:
03-10 16:17:37.977: E/AndroidRuntime(24296): <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
03-10 16:17:37.977: E/AndroidRuntime(24296): at maps.e.ch.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at maps.e.ay.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at maps.e.ay.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at maps.e.al.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at maps.e.bg.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at maps.e.bf.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at eio.onTransact(SourceFile:107)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.os.Binder.transact(Binder.java:326)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.google.android.gms.dynamic.a$4.b(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.google.android.gms.dynamic.a.a(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
03-10 16:17:37.977: E/AndroidRuntime(24296): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
XML File
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="35dip"
android:name="com.google.android.gms.maps.SupportMapFragment" />
MainActivity.Java
public class MainActivity extends FragmentActivity implements
LoaderCallbacks<Cursor> {
....
private void initializeMap() {
if (gMap == null) {
gMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (gMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
Your logcat clearly said:
Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to
ensure a correct behavior: 03-10 16:17:37.977: E/AndroidRuntime(24296):
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
You need to add this permission in your manifest.xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
For the Internet security reason you need to add this permission to manifest file.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
To inflate Google Map you need to Add below permission in your manifest. It clearly defined in your logcat error.
Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behavior:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Also make sure you have added the below permissions also
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
I am working on Card Scanner application, Using native camera and barcode scanning apis in my app(everything is fine with camera and barcode sanning), also using Spring Android library with Java POJO Objects for in/out to Rest apis.
ISSUE
Android is closing my application without any notification, QA reported a bug that he was testing and suddenly app closed(behavior is similar to home button press).
I don't have any idea about this issue. I reproduced this issue at my end and got below mentioned logs in logcat.
Here is my logs:
01-29 14:35:00.805: E/AndroidRuntime(25696): FATAL EXCEPTION: main
01-29 14:35:00.805: E/AndroidRuntime(25696): Process: com.ihi.bcr, PID: 25696
01-29 14:35:00.805: E/AndroidRuntime(25696): java.lang.RuntimeException: Unable to start service com.ihi.bcr.services.ContactSyncService#44e4fbf8 with Intent { flg=0x10000000 cmp=com.ihi.bcr/.services.ContactSyncService }: java.lang.NullPointerException
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2719)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.access$2100(ActivityThread.java:135)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.os.Handler.dispatchMessage(Handler.java:102)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.os.Looper.loop(Looper.java:136)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.main(ActivityThread.java:5017)
01-29 14:35:00.805: E/AndroidRuntime(25696): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 14:35:00.805: E/AndroidRuntime(25696): at java.lang.reflect.Method.invoke(Method.java:515)
01-29 14:35:00.805: E/AndroidRuntime(25696): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-29 14:35:00.805: E/AndroidRuntime(25696): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-29 14:35:00.805: E/AndroidRuntime(25696): at dalvik.system.NativeStart.main(Native Method)
01-29 14:35:00.805: E/AndroidRuntime(25696): Caused by: java.lang.NullPointerException
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.IntentService.onStart(IntentService.java:116)
01-29 14:35:00.805: E/AndroidRuntime(25696): at roboguice.service.RoboIntentService.onStart(RoboIntentService.java:66)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.IntentService.onStartCommand(IntentService.java:130)
01-29 14:35:00.805: E/AndroidRuntime(25696): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702)
01-29 14:35:00.805: E/AndroidRuntime(25696): ... 10 more
01-29 14:35:00.815: W/ActivityManager(780): Force finishing activity com.ihi.bcr/.activity.HomeScreen
01-29 14:35:00.975: E/Database(19015): 0
01-29 14:35:01.185: E/Database(19015): 0
01-29 14:35:01.215: D/audio_hw_primary(184): select_devices: out_snd_device(2: speaker) in_snd_device(0: )
01-29 14:35:01.345: W/ActivityManager(780): Activity pause timeout for ActivityRecord{4382e1c0 u0 com.ihi.bcr/.activity.HomeScreen t171 f}
01-29 14:35:01.405: E/Database(19015): 0
01-29 14:35:01.645: D/dalvikvm(19015): GC_FOR_ALLOC freed 527K, 4% free 17113K/17728K, paused 24ms, total 25ms
NOTE:
ContactSyncService is intent service.
I am starting contactSyncService by startService() method.
I didn't override onStart and onStartCommand() functions of IntentService(As it is mention in Android Docs)
You have missed to call super.onCreate() in your ContactSyncService.onCreate().
I am going to use camera/gallery in my project. FOr this i have first taken picture and saved it in my folder(Suppose pictureworld) and also saved the imageuri in the localdatabase. Then when i am trying to get the picture to show it in the gridview i am getting a warning message. In the gridview there is no picture but it can view the picture name. I have checked that it is creating the picture and also the uri in the localdatabase is correct.I want to add that when i am trying to save the pic using the gallery ..there is no problem. I have used the same adapter for viewing the saved gallery and camera picture. I am attaching the warning here:
03-10 17:48:11.367: W/System.err(522): at libcore.io.IoBridge.open(IoBridge.java:406)
03-10 17:48:11.367: W/System.err(522): at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-10 17:48:11.367: W/System.err(522): at java.io.FileInputStream.<init>(FileInputStream.java:105)
03-10 17:48:11.367: W/System.err(522): at android.content.ContentResolver.openInputStream(ContentResolver.java:369)
03-10 17:48:11.367: W/System.err(522): at android.provider.MediaStore$Images$Media.getBitmap(MediaStore.java:705)
03-10 17:48:11.367: W/System.err(522): at hr.s2is.ischool.admin.adapter.CommunityUserAdapter.getView(CommunityUserAdapter.java:71)
03-10 17:48:11.367: W/System.err(522): at android.widget.AbsListView.obtainView(AbsListView.java:2033)
03-10 17:48:11.367: W/System.err(522): at android.widget.GridView.makeAndAddView(GridView.java:1323)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.makeRow(GridView.java:328)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.fillDown(GridView.java:281)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.fillFromTop(GridView.java:403)
03-10 17:48:11.377: W/System.err(522): at android.widget.GridView.layoutChildren(GridView.java:1215)
03-10 17:48:11.377: W/System.err(522): at android.widget.AbsListView.onLayout(AbsListView.java:1863)
03-10 17:48:11.377: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.377: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.377: W/System.err(522): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:925)
03-10 17:48:11.387: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.387: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.387: W/System.err(522): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
03-10 17:48:11.387: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.387: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.387: W/System.err(522): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
03-10 17:48:11.397: W/System.err(522): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
03-10 17:48:11.397: W/System.err(522): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
03-10 17:48:11.397: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.397: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.397: W/System.err(522): at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
03-10 17:48:11.397: W/System.err(522): at android.view.View.layout(View.java:11278)
03-10 17:48:11.397: W/System.err(522): at android.view.ViewGroup.layout(ViewGroup.java:4224)
03-10 17:48:11.407: W/System.err(522): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489)
03-10 17:48:11.407: W/System.err(522): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
03-10 17:48:11.407: W/System.err(522): at android.os.Handler.dispatchMessage(Handler.java:99)
03-10 17:48:11.407: W/System.err(522): at android.os.Looper.loop(Looper.java:137)
03-10 17:48:11.407: W/System.err(522): at android.app.ActivityThread.main(ActivityThread.java:4424)
03-10 17:48:11.407: W/System.err(522): at java.lang.reflect.Method.invokeNative(Native Method)
03-10 17:48:11.417: W/System.err(522): at java.lang.reflect.Method.invoke(Method.java:511)
03-10 17:48:11.417: W/System.err(522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-10 17:48:11.417: W/System.err(522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-10 17:48:11.417: W/System.err(522): at dalvik.system.NativeStart.main(Native Method)
03-10 17:48:11.417: W/System.err(522): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
03-10 17:48:11.427: W/System.err(522): at libcore.io.Posix.open(Native Method)
03-10 17:48:11.427: W/System.err(522): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
03-10 17:48:11.427: W/System.err(522): at libcore.io.IoBridge.open(IoBridge.java:390)
Have you given the permission to read the local storage? You should check if any permission is declared in Android Manifest regarding Writing and reading of Internal Storage.
did you add permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
One more thing:
With sdk, you can't write to the root of internal storage. This cause your error.Try something like this
final File dir = new File(context.getFilesDir() + "/nfs/guille/groce/users/nicholsk/workspace3/SQLTest");
dir.mkdirs(); //create folders where write files
final File file = new File(dir, "BlockForTest.txt");