I'm developing an application here and it's been working good so far, but now I've put the HoloEverywhere lib to update the layout to the ICS look, and I started getting a random error on startup.
I searched for this error and found out that it could be related to the Eclipse ADT plugin incorrectly building the apk or something like that, but the error doesn't occurs only when I starde from Eclipse, it occurs frequently almost every time I reopen the application after not using it for a while.
And there's really nothing wrong with my application, because it worked well before HoloEverywhere, and when I get this crash (The app crashed everytime I get the error), I just have to reopen it again and it'll work.
This is what I'm getting:
03-01 12:37:03.913: E/AndroidRuntime(29273): FATAL EXCEPTION: main
03-01 12:37:03.913: E/AndroidRuntime(29273): java.lang.RuntimeException: Unable to instantiate application br.uff.uffmobile.context.UffMobileApplication: java.lang.NullPointerException
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4159)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.ActivityThread.access$1400(ActivityThread.java:134)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1277)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.os.Handler.dispatchMessage(Handler.java:99)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.os.Looper.loop(Looper.java:137)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.ActivityThread.main(ActivityThread.java:4856)
03-01 12:37:03.913: E/AndroidRuntime(29273): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 12:37:03.913: E/AndroidRuntime(29273): at java.lang.reflect.Method.invoke(Method.java:511)
03-01 12:37:03.913: E/AndroidRuntime(29273): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
03-01 12:37:03.913: E/AndroidRuntime(29273): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
03-01 12:37:03.913: E/AndroidRuntime(29273): at dalvik.system.NativeStart.main(Native Method)
03-01 12:37:03.913: E/AndroidRuntime(29273): Caused by: java.lang.NullPointerException
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
03-01 12:37:03.913: E/AndroidRuntime(29273): at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
03-01 12:37:03.913: E/AndroidRuntime(29273): ... 11 more
I have also put try/catches everywhere I could to see if I could avoid this nullpointer, but it seems it's either a HoloEverywhere problem or an internal Android bug. I'm testing it with a 4.1.2 android Galaxy S Advance.
Related
I know this question is asked so many times. but not working in my case tried so many solution. so help please
my mainActivity extends Activity within onCreate map generates this way.
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager()
.findFragmentById(R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
and xml view is
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
support:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
error em getting:
03-01 13:29:20.089: E/AndroidRuntime(26406): FATAL EXCEPTION: main
03-01 13:29:20.089: E/AndroidRuntime(26406): Process: com.commteldigital.cinecorn.activity, PID: 26406
03-01 13:29:20.089: E/AndroidRuntime(26406): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.commteldigital.cinecorn.activity/com.commteldigital.cmovies.activity.LocationActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.ActivityThread.access$800(ActivityThread.java:151)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.os.Handler.dispatchMessage(Handler.java:110)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.os.Looper.loop(Looper.java:193)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.ActivityThread.main(ActivityThread.java:5299)
03-01 13:29:20.089: E/AndroidRuntime(26406): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 13:29:20.089: E/AndroidRuntime(26406): at java.lang.reflect.Method.invoke(Method.java:515)
03-01 13:29:20.089: E/AndroidRuntime(26406): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
03-01 13:29:20.089: E/AndroidRuntime(26406): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
03-01 13:29:20.089: E/AndroidRuntime(26406): at dalvik.system.NativeStart.main(Native Method)
03-01 13:29:20.089: E/AndroidRuntime(26406): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-01 13:29:20.089: E/AndroidRuntime(26406): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:305)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Activity.setContentView(Activity.java:1944)
03-01 13:29:20.089: E/AndroidRuntime(26406): at com.commteldigital.cmovies.activity.LocationActivity.onCreate(LocationActivity.java:27)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Activity.performCreate(Activity.java:5264)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
03-01 13:29:20.089: E/AndroidRuntime(26406): ... 11 more
03-01 13:29:20.089: E/AndroidRuntime(26406): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Fragment.instantiate(Fragment.java:597)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Fragment.instantiate(Fragment.java:561)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Activity.onCreateView(Activity.java:4811)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
03-01 13:29:20.089: E/AndroidRuntime(26406): ... 21 more
03-01 13:29:20.089: E/AndroidRuntime(26406): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.MapFragment" on path: DexPathList[[zip file "/data/app/com.commteldigital.cinecorn.activity-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.commteldigital.cinecorn.activity-2, /vendor/lib, /system/lib]]
03-01 13:29:20.089: E/AndroidRuntime(26406): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-01 13:29:20.089: E/AndroidRuntime(26406): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
03-01 13:29:20.089: E/AndroidRuntime(26406): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
03-01 13:29:20.089: E/AndroidRuntime(26406): at android.app.Fragment.instantiate(Fragment.java:583)
03-01 13:29:20.089: E/AndroidRuntime(26406): ... 24 more
well. have imported google play lib from extras folder. why the class is unavailable. thanks in advance
It seems you are using a wrong name. Use this code:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
</merge>
In addition, getMap() is now deprecated, you are using an old API.
Change
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
to
<fragment
android:id="#+id/map"
class="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
add those lines in your manifest files within application tag if you didn't add them
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
When i run my java code in the emulator or the real device, i every once in a while get this error. However, the app goes on and installs well. Since the error below appears in red text in my eclipse log, i have been forced to ask.. Is it an error that can cause significant problems when i release the app eventually or its something i should ignore? My guess is that i can use a try catch statement to capture the NullPointerException but i have no clue at what point in my MainActivity this error is generated.
12-10 20:15:44.268: E/AndroidRuntime(1126): FATAL EXCEPTION: main
12-10 20:15:44.268: E/AndroidRuntime(1126): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread.access$1300(ActivityThread.java:130)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.os.Handler.dispatchMessage(Handler.java:99)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.os.Looper.loop(Looper.java:137)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.ActivityThread.main(ActivityThread.java:4745)
12-10 20:15:44.268: E/AndroidRuntime(1126): at java.lang.reflect.Method.invokeNative(Native Method)
12-10 20:15:44.268: E/AndroidRuntime(1126): at java.lang.reflect.Method.invoke(Method.java:511)
12-10 20:15:44.268: E/AndroidRuntime(1126): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-10 20:15:44.268: E/AndroidRuntime(1126): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-10 20:15:44.268: E/AndroidRuntime(1126): at dalvik.system.NativeStart.main(Native Method)
12-10 20:15:44.268: E/AndroidRuntime(1126): Caused by: java.lang.NullPointerException
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
12-10 20:15:44.268: E/AndroidRuntime(1126): at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
12-10 20:15:44.268: E/AndroidRuntime(1126): ... 11 more
Any idea why would this crash appear? The trace has only native code so very hard to track it down. Happens on Samsung Galaxy s3 platform 4.1.2 when I run animation inside a Fragment and when animation ends I call notifyDataSetChanged for the FragmentStatePagerAdapter. The issue is not 100% reproducible.
Thanks.
Trace:
03-01 11:50:11.836: E/AndroidRuntime(21136): FATAL EXCEPTION: main
03-01 11:50:11.836: E/AndroidRuntime(21136): java.lang.NullPointerException
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3147)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3151)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12646)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.View.getDisplayList(View.java:12754)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1144)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2273)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2145)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1956)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1112)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.Choreographer.doFrame(Choreographer.java:525)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.os.Handler.handleCallback(Handler.java:615)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.os.Looper.loop(Looper.java:137)
03-01 11:50:11.836: E/AndroidRuntime(21136): at android.app.ActivityThread.main(ActivityThread.java:4898)
03-01 11:50:11.836: E/AndroidRuntime(21136): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 11:50:11.836: E/AndroidRuntime(21136): at java.lang.reflect.Method.invoke(Method.java:511)
03-01 11:50:11.836: E/AndroidRuntime(21136): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
03-01 11:50:11.836: E/AndroidRuntime(21136): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
03-01 11:50:11.836: E/AndroidRuntime(21136): at dalvik.system.NativeStart.main(Native Method)
Fix was simple but no idea why works.
In the AnimationListener's onAnimationEnd callback I had a callback which triggered notifyDataSetChanged. I add that callback into Runnable and ran the Runnable with getView().post
#Override
public void onAnimationEnd(Animation animation) {
getView().post(new Runnable() {
#Override
public void run() {
// notifyDataSetChanged here
}
});
}
Good answer but as in all things Android these answers become dated pretty quickly.
I would use runOnUiThread now. I was running in a baseclass with the animator as a private class. For a deeper dive on runOnUiThread see
Android basics: running code in the UI thread
#Override
public void onAnimationEnd(Animator animation) {
//
MyBaseActivity.this.runOnUiThread(new Runnable() {
public void run() {
Log.d("UI thread", "I am the UI thread");
}
});
}
I have created an application which will allow the user to set a new theme to their phone. I am trying to change the icons of the default applications(mms,camera,calculator etc) after applying the theme. I am trying to do this by storing the theme icon images into the local memory.
In Iconcache.java I have modified the code. I am checking there which theme is currently used and if it is not default theme then I am checking the local memory to get which theme is assigned and getting icon location and assigning that particular icon.
I am getting icon location correctly there, but not able open it. It is showing permission denied exception. See the logs below.
03-01 12:14:30.324: INFO/System.out(197): CN: ComponentInfo{com.android.settings/com.android.settings.Settings}
03-01 12:14:30.324: INFO/System.out(197): *********In Try*******
03-01 12:14:30.324: INFO/System.out(197): getfullresiconnnnnnnnnnnnnnnn
03-01 12:14:30.334: DEBUG/IconCache(197): getFullResIcon : info ResolveInfo{410b09f8 com.android.settings.Settings p=0 o=0 m=0x0}
03-01 12:14:30.334: DEBUG/IconCache(197): getFullResIcon :try settingsContext android.app.ContextImpl#4108b660
03-01 12:14:30.354: DEBUG/IconCache(197): getFullResIcon : currentThemePackage Default Theme
03-01 12:14:30.354: INFO/System.out(197): current theme package :Default Theme
03-01 12:14:30.374: DEBUG/IconCache(197): if currenttheme!=default
03-01 12:14:30.374: INFO/System.out(197): Icon file :/data/data/com.android.settings/app_themes/settings.png
03-01 12:14:30.424: DEBUG/IconCache(197): getFullResIcon : iconFile /data/data/com.android.settings/app_themes/settings.png
03-01 12:14:30.424: DEBUG/IconCache(197): if iconFile!=null
03-01 12:14:30.434: DEBUG/IconCache(197): if iconFile!=null : ico val /data/data/com.android.settings/app_themes/settings.png
03-01 12:14:30.483: WARN/System.err(197): java.io.FileNotFoundException: /data/data/com.android.settings/app_themes/settings.png: open failed: EACCES (Permission denied)
03-01 12:14:30.493: WARN/System.err(197): at libcore.io.IoBridge.open(IoBridge.java:406)
03-01 12:14:30.533: DEBUG/dalvikvm(76): GC_CONCURRENT freed 1570K, 24% free 12477K/16263K, paused 5ms+81ms
03-01 12:14:30.583: WARN/ActivityManager(76): Activity idle timeout for ActivityRecord{410e4510 com.android.launcher/com.android.launcher2.Launcher}
03-01 12:14:30.703: WARN/System.err(197): at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-01 12:14:30.703: WARN/System.err(197): at com.android.launcher2.IconCache.getFullResIcon(IconCache.java:142)
03-01 12:14:30.723: WARN/System.err(197): at com.android.launcher2.IconCache.cacheLocked(IconCache.java:282)
03-01 12:14:30.723: WARN/System.err(197): at com.android.launcher2.IconCache.getIcon(IconCache.java:250)
03-01 12:14:30.746: WARN/System.err(197): at com.android.launcher2.LauncherModel.getShortcutInfo(LauncherModel.java:1641)
03-01 12:14:30.746: WARN/System.err(197): at com.android.launcher2.LauncherModel$LoaderTask.loadWorkspace(LauncherModel.java:1041)
03-01 12:14:30.755: WARN/System.err(197): at com.android.launcher2.LauncherModel$LoaderTask.loadAndBindWorkspace(LauncherModel.java:756)
03-01 12:14:30.763: WARN/System.err(197): at com.android.launcher2.LauncherModel$LoaderTask.run(LauncherModel.java:821)
03-01 12:14:30.763: WARN/System.err(197): at android.os.Handler.handleCallback(Handler.java:605)
03-01 12:14:30.763: WARN/System.err(197): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 12:14:30.773: DEBUG/StrictMode(271): StrictMode policy violation; ~duration=249 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=2711 violation=2
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1074)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.app.SharedPreferencesImpl.awaitLoadedLocked(SharedPreferencesImpl.java:184)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.app.SharedPreferencesImpl.getBoolean(SharedPreferencesImpl.java:241)
03-01 12:14:30.773: DEBUG/StrictMode(271): at com.android.calendar.Utils.getHideDeclinedEvents(Utils.java:464)
03-01 12:14:30.773: DEBUG/StrictMode(271): at com.android.calendar.widget.CalendarAppWidgetService$CalendarFactory.initLoader(CalendarAppWidgetService.java:356)
03-01 12:14:30.773: DEBUG/StrictMode(271): at com.android.calendar.widget.CalendarAppWidgetService$CalendarFactory.onReceive(CalendarAppWidgetService.java:525)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2118)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.os.Handler.dispatchMessage(Handler.java:99)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.os.Looper.loop(Looper.java:137)
03-01 12:14:30.773: DEBUG/StrictMode(271): at android.app.ActivityThread.main(ActivityThread.java:4340)
03-01 12:14:30.773: DEBUG/StrictMode(271): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 12:14:30.773: DEBUG/StrictMode(271): at java.lang.reflect.Method.invoke(Method.java:511)
03-01 12:14:30.773: DEBUG/StrictMode(271): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-01 12:14:30.773: DEBUG/StrictMode(271): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-01 12:14:30.773: DEBUG/StrictMode(271): at dalvik.system.NativeStart.main(Native Method)
03-01 12:14:30.783: WARN/System.err(197): at android.os.Looper.loop(Looper.java:137)
03-01 12:14:30.803: WARN/System.err(197): at android.os.HandlerThread.run(HandlerThread.java:60)
03-01 12:14:30.863: WARN/System.err(197): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
03-01 12:14:30.863: WARN/System.err(197): at libcore.io.Posix.open(Native Method)
03-01 12:14:30.902: WARN/System.err(197): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:98)
03-01 12:14:30.902: WARN/System.err(197): at libcore.io.IoBridge.open(IoBridge.java:390)
03-01 12:14:30.913: DEBUG/dalvikvm(152): GC_CONCURRENT freed 4820K, 41% free 7254K/12231K, paused 4ms+270ms
03-01 12:14:30.954: INFO/ActivityManager(76): Start proc com.android.providers.calendar for content provider com.android.providers.calendar/.CalendarProvider2: pid=310 uid=10009 gids={3003, 1015}
03-01 12:14:31.044: WARN/System.err(197): ... 12 more
03-01 12:14:31.044: DEBUG/Launcher.IconCache(197): getFullResIcon
03-01 12:14:31.074: INFO/System.out(197): *********Executed******
03-01 12:14:31.103: DEBUG/PowerManagerService(76): bootCompleted
03-01 12:14:31.173: VERBOSE/DevicePolicyManagerService(76): Sending password expiration notifications for action android.intent.action.BOOT_COMPLETED
03-01 12:14:31.204: INFO/SurfaceFlinger(33): Boot is finished (32818 ms)
03-01 12:14:31.204: INFO/SurfaceFlinger(33):
03-01 12:14:31.334 76:0x75 F/NetworkStats ]
03-01 12:14:31.204: INFO/SurfaceFlinger(33): problem reading network stats
03-01 12:14:31.204: INFO/SurfaceFlinger(33): java.lang.IllegalStateException: problem parsing line: null
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1234)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:810)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:721)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.server.net.NetworkStatsService.updateIfaces(NetworkStatsService.java:699)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.server.net.NetworkStatsService.access$000(NetworkStatsService.java:128)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.server.net.NetworkStatsService$8.handleMessage(NetworkStatsService.java:1546)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at android.os.Handler.dispatchMessage(Handler.java:95)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at android.os.Looper.loop(Looper.java:137)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at android.os.HandlerThread.run(HandlerThread.java:60)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at libcore.io.IoBridge.open(IoBridge.java:406)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at java.io.FileReader.<init>(FileReader.java:42)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:272)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): ... 9 more
03-01 12:14:31.204: INFO/SurfaceFlinger(33): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at libcore.io.Posix.open(Native Method)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:98)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): at libcore.io.IoBridge.open(IoBridge.java:390)
03-01 12:14:31.204: INFO/SurfaceFlinger(33): ... 12 more
03-01 12:14:31.384: INFO/System.out(197): CN: ComponentInfo{com.android.contacts/com.android.contacts.activities.DialtactsActivity}
03-01 12:14:31.663: DEBUG/dalvikvm(34): GC_EXPLICIT freed 33K, 4% free 6825K/7107K, paused 3ms+4ms
03-01 12:14:31.803: INFO/System.out(197): *********In Try*******
03-01 12:14:31.803: INFO/System.out(197): getfullresiconnnnnnnnnnnnnnnn
03-01 12:14:31.843: DEBUG/IconCache(197): getFullResIcon : info ResolveInfo{410f0068 com.android.contacts.activities.DialtactsActivity p=0 o=0 m=0x0}
03-01 12:14:31.843: DEBUG/IconCache(197): getFullResIcon :try settingsContext android.app.ContextImpl#410f69a8
03-01 12:14:31.884: DEBUG/IconCache(197): getFullResIcon : currentThemePackage Default Theme
03-01 12:14:31.884: INFO/System.out(197): current theme package :Default Theme
03-01 12:14:31.894: DEBUG/IconCache(197): if currenttheme!=default
03-01 12:14:31.894: INFO/System.out(197): Icon file :/data/data/com.android.settings/app_themes/contacts.png
03-01 12:14:31.894: DEBUG/IconCache(197): getFullResIcon : iconFile /data/data/com.android.settings/app_themes/contacts.png
03-01 12:14:31.894: DEBUG/IconCache(197): if iconFile!=null
03-01 12:14:31.894: DEBUG/IconCache(197): if iconFile!=null : ico val /data/data/com.android.settings/app_themes/contacts.png
03-01 12:14:31.924: WARN/System.err(197): java.io.FileNotFoundException: /data/data/com.android.settings/app_themes/contacts.png: open failed: EACCES (Permission denied)
03-01 12:14:31.924: WARN/System.err(197): at libcore.io.IoBridge.open(IoBridge.java:406)
03-01 12:14:31.964: WARN/System.err(197): at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-01 12:14:31.964: WARN/System.err(197): at com.android.launcher2.IconCache.getFullResIcon(IconCache.java:142)
03-01 12:14:31.973: WARN/System.err(197): at com.android.launcher2.IconCache.cacheLocked(IconCache.java:282)
03-01 12:14:31.973: WARN/System.err(197): at com.android.launcher2.IconCache.getIcon(IconCache.java:250)
03-01 12:14:32.004: WARN/System.err(197): at com.android.launcher2.LauncherModel.getShortcutInfo(LauncherModel.java:1641)
03-01 12:14:32.004: WARN/System.err(197): at com.android.launcher2.LauncherModel$LoaderTask.loadWorkspace(LauncherModel.java:1041)
03-01 12:14:32.014: WARN/System.err(197): at com.android.launcher2.LauncherModel$LoaderTask.loadAndBindWorkspace(LauncherModel.java:756)
03-01 12:14:32.014: WARN/System.err(197): at com.android.launcher2.LauncherModel$LoaderTask.run(LauncherModel.java:821)
03-01 12:14:32.024: WARN/System.err(197): at android.os.Handler.handleCallback(Handler.java:605)
03-01 12:14:32.024: WARN/System.err(197): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 12:14:32.034: WARN/System.err(197): at android.os.Looper.loop(Looper.java:137)
03-01 12:14:32.044: WARN/System.err(197): at android.os.HandlerThread.run(HandlerThread.java:60)
03-01 12:14:32.044: WARN/System.err(197): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
03-01 12:14:32.064: WARN/System.err(197): at libcore.io.Posix.open(Native Method)
03-01 12:14:32.064: WARN/System.err(197): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:98)
03-01 12:14:32.114: WARN/System.err(197): at libcore.io.IoBridge.open(IoBridge.java:390)
03-01 12:14:32.114: WARN/System.err(197): ... 12 more
03-01 12:14:32.124: DEBUG/Launcher.IconCache(197): getFullResIcon
03-01 12:14:32.154: INFO/System.out(197): *********Executed******
I'm using Jsoup for one of my android applications, and I have a relatively simple piece of code that keeps throwing NullPointerException when I call connection.get().
This used to work a couple months back, but after installing the latest SDK it no longer works in the emulator. It is working fine on my physical device, but I don't know if this is an emulation only bug or could impact other handsets.
This is my code:
String URL = "http://finance.google.com/finance/feeds/default/portfolios?returns=true"
String _AUTHPARAMS = "GoogleLogin auth="
String AuthToken = "random string of characters"
Connection c = Jsoup.connect(URL);
c.header("Authorization", _AUTHPARAMS + AuthToken);
c.userAgent("foo");
c.timeout(10000);
c.ignoreContentType(true);
Document doc = c.get();
I am catching a NullPointerException on the last line (c.get())
If I call exception.getMessage(), it just says "null". I'm not sure what else could be causing this other than a bug in android or jsoup?
======= EDIT ========
I'm using Jsoup 1.6.1
Here's the stack trace from eclipse:
03-01 00:43:22.459: E/AndroidRuntime(392): FATAL EXCEPTION: AsyncTask #1
03-01 00:43:22.459: E/AndroidRuntime(392): java.lang.RuntimeException: An error occured while executing doInBackground()
03-01 00:43:22.459: E/AndroidRuntime(392): at android.os.AsyncTask$3.done(AsyncTask.java:200)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.lang.Thread.run(Thread.java:1096)
03-01 00:43:22.459: E/AndroidRuntime(392): Caused by: java.lang.NullPointerException
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.readln(HttpURLConnectionImpl.java:1279)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl$ChunkedInputStream.readChunkSize(HttpURLConnectionImpl.java:404)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl$ChunkedInputStream.<init>(HttpURLConnectionImpl.java:340)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getContentStream(HttpURLConnectionImpl.java:1175)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequestInternal(HttpURLConnectionImpl.java:1754)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequest(HttpURLConnectionImpl.java:1649)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:1374)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:381)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:364)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:143)
03-01 00:43:22.459: E/AndroidRuntime(392): at org.jsoup.helper.HttpConnection.get(HttpConnection.java:132)
03-01 00:43:22.459: E/AndroidRuntime(392): at com.karwosts.PortfolioMap.GoogleFinance.SendHttpRequest(GoogleFinance.java:138)
03-01 00:43:22.459: E/AndroidRuntime(392): at com.karwosts.PortfolioMap.GoogleFinance.getDocument(GoogleFinance.java:78)
03-01 00:43:22.459: E/AndroidRuntime(392): at com.karwosts.PortfolioMap.GoogleFinance.GetPortfolioList(GoogleFinance.java:36)
03-01 00:43:22.459: E/AndroidRuntime(392): at com.karwosts.PortfolioMap.GooglePortfolioSelector$AsyncPortfolioRetriever.doInBackground(GooglePortfolioSelector.java:134)
03-01 00:43:22.459: E/AndroidRuntime(392): at com.karwosts.PortfolioMap.GooglePortfolioSelector$AsyncPortfolioRetriever.doInBackground(GooglePortfolioSelector.java:1)
03-01 00:43:22.459: E/AndroidRuntime(392): at android.os.AsyncTask$2.call(AsyncTask.java:185)
03-01 00:43:22.459: E/AndroidRuntime(392): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-01 00:43:22.459: E/AndroidRuntime(392): ... 4 more
From your stack trace I'm guessing you're encountering this bug (15554) on an Android 2.1 (or other "old" version) - you should be able to download the document using the Apache HTTP client - which works a lot better on older Android implementations (since HttpURLConnection is/was a buggy piece of shit).