Unable to create external files directory - ANDROID - android

Here is my code and the error below. I get an error in the logs saying Unable to create external files directory.
String downloadURL = getString(R.string.download_URL);
Uri uri = Uri.parse(downloadURL);
DownloadManager.Request request = new Request(uri);
request.setAllowedNetworkTypes(Request.NETWORK_WIFI | Request.NETWORK_MOBILE);
request.setAllowedOverRoaming(false);
request.setTitle("Android Jelly Bean's Pic Download");
request.setDescription("Android Jelly Beans Pic Download using Download Manager");
request.setDestinationInExternalFilesDir(getApplicationContext(),
Environment.DIRECTORY_DOWNLOADS, "abc.png");
downloadReference = dm.enqueue(request);
The line which has the error is
request.setDestinationInExternalFilesDir(getApplicationContext(),
Environment.DIRECTORY_DOWNLOADS, "abc.png");
12-05 18:51:55.436: W/ApplicationContext(1049): Unable to create external files directory
12-05 18:51:55.436: D/AndroidRuntime(1049): Shutting down VM
12-05 18:51:55.446: W/dalvikvm(1049): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
12-05 18:51:55.476: E/AndroidRuntime(1049): FATAL EXCEPTION: main
12-05 18:51:55.476: E/AndroidRuntime(1049): java.lang.NullPointerException: file
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.net.Uri.fromFile(Uri.java:441)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.app.DownloadManager$Request.setDestinationFromBase(DownloadManager.java:504)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.app.DownloadManager$Request.setDestinationInExternalFilesDir(DownloadManager.java:466)
12-05 18:51:55.476: E/AndroidRuntime(1049): at com.example.downloadmanagerapplication.DownloadManagerActivity.startDownload(DownloadManagerActivity.java:93)
12-05 18:51:55.476: E/AndroidRuntime(1049): at com.example.downloadmanagerapplication.DownloadManagerActivity$1.onClick(DownloadManagerActivity.java:115)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.view.View.performClick(View.java:3480)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.view.View$PerformClick.run(View.java:13983)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.os.Handler.handleCallback(Handler.java:605)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.os.Handler.dispatchMessage(Handler.java:92)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.os.Looper.loop(Looper.java:137)
12-05 18:51:55.476: E/AndroidRuntime(1049): at android.app.ActivityThread.main(ActivityThread.java:4340)
12-05 18:51:55.476: E/AndroidRuntime(1049): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 18:51:55.476: E/AndroidRuntime(1049): at java.lang.reflect.Method.invoke(Method.java:511)
12-05 18:51:55.476: E/AndroidRuntime(1049): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-05 18:51:55.476: E/AndroidRuntime(1049): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-05 18:51:55.476: E/AndroidRuntime(1049): at dalvik.system.NativeStart.main(Native Method)

In order to save/write the data into file or create/remove directories, you must have to set "usage" permission in manifest file.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Sample : Android DownloadManager

You can you try something like:
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + fileName);
Instead of:
request.setDestinationInExternalFilesDir(Context, Type, Path)

Related

ParseLoginSampleBasic giving exception when I push the Log In button on the first screen (Android)

I just started developing with parse. I downloaded the android ParseLoginUI and the sample apps. Two things I had done to be able to start the app: for ParseLoginUI add a reference to the FacebookSDK and copy the "bolts-android-1.1.2.jar" file from the FacebookSDK libs folder to the ParseLoginUI lib folder.
The ParseLoginSampleBasic runs, the first screen comes up, but when I click on the Log in button , this exception comes up:
12-05 12:02:31.151: E/dalvikvm(24615): Could not find class 'com.parse.ui.ParseLoginActivity', referenced from method com.parse.ui.ParseLoginBuilder.build
12-05 12:02:32.606: E/AndroidRuntime(24615): FATAL EXCEPTION: main
12-05 12:02:32.606: E/AndroidRuntime(24615): Process: com.parse.loginsample.basic, PID: 24615
12-05 12:02:32.606: E/AndroidRuntime(24615): java.lang.NoClassDefFoundError: com.parse.ui.ParseLoginActivity
12-05 12:02:32.606: E/AndroidRuntime(24615): at com.parse.ui.ParseLoginBuilder.build(ParseLoginBuilder.java:309)
12-05 12:02:32.606: E/AndroidRuntime(24615): at com.parse.loginsample.basic.SampleProfileActivity$1.onClick(SampleProfileActivity.java:71)
12-05 12:02:32.606: E/AndroidRuntime(24615): at android.view.View.performClick(View.java:4456)
12-05 12:02:32.606: E/AndroidRuntime(24615): at android.view.View$PerformClick.run(View.java:18482)
12-05 12:02:32.606: E/AndroidRuntime(24615): at android.os.Handler.handleCallback(Handler.java:733)
12-05 12:02:32.606: E/AndroidRuntime(24615): at android.os.Handler.dispatchMessage(Handler.java:95)
12-05 12:02:32.606: E/AndroidRuntime(24615): at android.os.Looper.loop(Looper.java:136)
12-05 12:02:32.606: E/AndroidRuntime(24615): at android.app.ActivityThread.main(ActivityThread.java:5097)
12-05 12:02:32.606: E/AndroidRuntime(24615): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 12:02:32.606: E/AndroidRuntime(24615): at java.lang.reflect.Method.invoke(Method.java:515)
12-05 12:02:32.606: E/AndroidRuntime(24615): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-05 12:02:32.606: E/AndroidRuntime(24615): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-05 12:02:32.606: E/AndroidRuntime(24615): at dalvik.system.NativeStart.main(Native Method)

null pointer on calling ContentResolver.setSyncAutomatically android

I want to sync my local app database with my remote server database using android sync adapter. I followed all steps mentioned in developer website and I double checked every thing. but I get null pointer when lines below executed in my MainActivity oncreate:
mAccount = CreateSyncAccount(this);
ContentResolver.setSyncAutomatically(mAccount, AUTHORITY, true);
here is my stacktrace:
12-05 15:05:40.099: E/AndroidRuntime(13641): FATAL EXCEPTION: main
12-05 15:05:40.099: E/AndroidRuntime(13641): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mobinMahsaz.dortan/com.mobinMahsaz.dortan.MainActivity2}: java.lang.NullPointerException
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.os.Looper.loop(Looper.java:130)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.ActivityThread.main(ActivityThread.java:3687)
12-05 15:05:40.099: E/AndroidRuntime(13641): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 15:05:40.099: E/AndroidRuntime(13641): at java.lang.reflect.Method.invoke(Method.java:507)
12-05 15:05:40.099: E/AndroidRuntime(13641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-05 15:05:40.099: E/AndroidRuntime(13641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
12-05 15:05:40.099: E/AndroidRuntime(13641): at dalvik.system.NativeStart.main(Native Method)
12-05 15:05:40.099: E/AndroidRuntime(13641): Caused by: java.lang.NullPointerException
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.os.Parcel.readException(Parcel.java:1328)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.os.Parcel.readException(Parcel.java:1276)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.content.IContentService$Stub$Proxy.setSyncAutomatically(IContentService.java:568)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.content.ContentResolver.setSyncAutomatically(ContentResolver.java:1047)
12-05 15:05:40.099: E/AndroidRuntime(13641): at com.mobinMahsaz.dortan.MainActivity2.onCreate(MainActivity2.java:283)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-05 15:05:40.099: E/AndroidRuntime(13641): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
12-05 15:05:40.099: E/AndroidRuntime(13641): ... 11 more
I can't find any documentation that states what is the reason of this exception.
EDIT:
After reading ContentResolver documentation I find out null pointer cause by getcontentService().
It could be different for you, but for me this was caused because I had a null mAccount object. I had incorrectly assumed that if AccountManager.addAccountExplicitly returned false then there had been a fatal error, so was returning a null Account from my CreateSyncAccount function in that situation.

Out of Memory Error Nexus 7 android 4.2.1 [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am developing an app for all android devices. It is working good on all device and I tested it on Samsung Galaxy S1, Galaxy Nexus, Motorola Xoom, HTC One and also on Amazon Kindle Fire.
It runs perfectly on all devices but when i tried using it on Nexus 7, it crashes and in log it says Out of Memory Error. I tried using System.gc(); in Activity#onPause() method but in vain. There are alternative drawables and layouts exist in app.
Please help me to resolve this issue. This issue is only specific to Nexus 7.
Below is stacktrace:
12-05 16:42:45.625: E/AndroidRuntime(8759): FATAL EXCEPTION: main
12-05 16:42:45.625: E/AndroidRuntime(8759): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.app/com.android.app.activity.MyListActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.os.Looper.loop(Looper.java:137)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Method.invoke(Method.java:511)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-05 16:42:45.625: E/AndroidRuntime(8759): at dalvik.system.NativeStart.main(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.Activity.setContentView(Activity.java:1881)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.app.activity.MyListActivity.onCreate(MyListActivity.java:39)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.Activity.performCreate(Activity.java:5104)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-05 16:42:45.625: E/AndroidRuntime(8759): ... 11 more
12-05 16:42:45.625: E/AndroidRuntime(8759): Caused by: java.lang.reflect.InvocationTargetException
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Constructor.constructNative(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
12-05 16:42:45.625: E/AndroidRuntime(8759): ... 23 more
12-05 16:42:45.625: E/AndroidRuntime(8759): Caused by: java.lang.OutOfMemoryError
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.content.res.Resources.loadDrawable(Resources.java:1965)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.View.<init>(View.java:3328)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.ViewGroup.<init>(ViewGroup.java:431)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
12-05 16:42:45.625: E/AndroidRuntime(8759): ... 26 more
Thanks in advance.
Ya i had faced this issue too but not found a valid solution but you can try using android:largeHeap="true" in manifest at application level

Android application doesn't work after migration to newest ADT and android sdk

I have an Android application in Eclipse Indigo with ADT version 15. Upgrading ADT to the version 21 the program crashes and is impossible to execute over both the emulator and the mobile device.
LogCat shows this error message:
12-05 10:07:35.960: E/AndroidRuntime(31462): FATAL EXCEPTION: main
12-05 10:07:35.960: E/AndroidRuntime(31462): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{test.hello/test.StartActivityZZ}: java.lang.ClassNotFoundException: test.start.StartActivityZZ
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.ActivityThread.access$600(ActivityThread.java:140)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.os.Looper.loop(Looper.java:137)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-05 10:07:35.960: E/AndroidRuntime(31462): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 10:07:35.960: E/AndroidRuntime(31462): at java.lang.reflect.Method.invoke(Method.java:511)
12-05 10:07:35.960: E/AndroidRuntime(31462): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-05 10:07:35.960: E/AndroidRuntime(31462): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-05 10:07:35.960: E/AndroidRuntime(31462): at dalvik.system.NativeStart.main(Native Method)
12-05 10:07:35.960: E/AndroidRuntime(31462): Caused by: java.lang.ClassNotFoundException: test.start.StartActivityZZ
12-05 10:07:35.960: E/AndroidRuntime(31462): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-05 10:07:35.960: E/AndroidRuntime(31462): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-05 10:07:35.960: E/AndroidRuntime(31462): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
12-05 10:07:35.960: E/AndroidRuntime(31462): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
12-05 10:07:35.960: E/AndroidRuntime(31462): ... 11 more
The Android project uses maven but creating a new one without maven the problem persists and shows the same message.
Any suggestions to fix this problem?
Thanks
At some point (probably after ver 15), the libraries you use must be placed in the "libs" folder. Try placing a copy of your libraries there and retry

Sorry the application Sudoku has stopped unexpectly. Please try again

Help!
I’m having problems with my Sudoku application. I plugged in all the code to have my application remember the current position. Now when I run the application and I try to either start a new game or continue my Sudoku application says:
Sorry the application Sudoku (process org.example.sudoku) has stopped unexpectedly. Please try again.
It hasn’t done this in the past yet and I’m confused on where to go from here. I took a look at the logcat but I’m not sure what I should look for and how to fix it. Here is the logcat below
12-05 14:47:32.376: DEBUG/AndroidRuntime(289): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
12-05 14:47:32.376: DEBUG/AndroidRuntime(289): CheckJNI is ON
12-05 14:47:32.796: DEBUG/AndroidRuntime(289): —registering native functions --
12-05 14:47:34.306: DEBUG/AndroidRuntime(289): Shutting down VM
12-05 14:47:34.325: DEBUG/dalvikvm(289): Debugger has detached; object registry had 1 entries
12-05 14:47:34.345: INFO/AndroidRuntime(289): NOTE: attach of thread ‘Binder Thread #3’ failed
12-05 14:47:35.246: DEBUG/AndroidRuntime(297): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
12-05 14:47:35.246: DEBUG/AndroidRuntime(297): CheckJNI is ON
12-05 14:47:35.625: DEBUG/AndroidRuntime(297): —registering native functions --
12-05 14:47:36.985: INFO/ActivityManager(60): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0×10000000 cmp=org.example.sudoku/.Sudoku }
12-05 14:47:37.126: DEBUG/AndroidRuntime(297): Shutting down VM
12-05 14:47:37.146: DEBUG/dalvikvm(297): Debugger has detached; object registry had 1 entries
12-05 14:47:37.186: INFO/AndroidRuntime(297): NOTE: attach of thread ‘Binder Thread #3’ failed
12-05 14:47:37.359: INFO/ActivityManager(60): Start proc org.example.sudoku for activity org.example.sudoku/.Sudoku: pid=304 uid=10037 gids={}
12-05 14:47:39.327: INFO/ActivityManager(60): Displayed activity org.example.sudoku/.Sudoku: 2047 ms (total 333042 ms)
12-05 14:47:44.516: DEBUG/dalvikvm(128): GC_EXPLICIT freed 205 objects / 9864 bytes in 134ms
12-05 14:48:14.936: DEBUG/Sudoku(304): clicked on 0
12-05 14:48:14.957: INFO/ActivityManager(60): Starting activity: Intent { cmp=org.example.sudoku/.Game (has extras) }
12-05 14:48:15.146: DEBUG/AndroidRuntime(304): Shutting down VM
12-05 14:48:15.146: WARN/dalvikvm(304): threadid=1: thread exiting with uncaught exception (group=0×4001d800)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): FATAL EXCEPTION: main
12-05 14:48:15.295: ERROR/AndroidRuntime(304): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.example.sudoku/org.example.sudoku.Game}: java.lang.NullPointerException
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.os.Looper.loop(Looper.java:123)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.reflect.Method.invoke(Method.java:521)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at dalvik.system.NativeStart.main(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): Caused by: java.lang.NullPointerException
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.content.ContextWrapper.getPackageName(ContextWrapper.java:120)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Activity.getLocalClassName(Activity.java:3478)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Activity.getPreferences(Activity.java:3512)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at org.example.sudoku.Game.<init>(Game.java:104)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.Class.newInstanceImpl(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.Class.newInstance(Class.java:1429)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): ... 11 more
12-05 14:48:15.376: WARN/ActivityManager(60): Force finishing activity org.example.sudoku/.Game
12-05 14:48:15.455: WARN/ActivityManager(60): Force finishing activity org.example.sudoku/.Sudoku
12-05 14:48:15.927: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44049308 org.example.sudoku/.Game}
12-05 14:48:27.095: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{43f562c0 org.example.sudoku/.Sudoku}
12-05 14:48:27.202: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{44049308 org.example.sudoku/.Game}
12-05 14:49:20.407: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
Any help would be greatly appreciated. Thank you
-James
You need to look at line 104 of Game.java as it seems it may be the cause of a NullPointerException
Your error of interest is:
12-05 14:48:15.295: ERROR/AndroidRuntime(304): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.example.sudoku/org.example.sudoku.Game}: java.lang.NullPointerException
Usual error - your intent is not in the Manifest.xml

Categories

Resources