Ionic app crashes on Android emulator and device - android

I'm building an app using the Ionic framework and AngularJS. It used to run fine, now it crashes as soon as it starts in both the emulator and an Android device. What is weird is that it runs fine in the Ionic View app (http://view.ionic.io/). The logcat says that the error is a NullPointerException.
What really worries me is that I didn't do any big changes, and another app started to fail as well. How can Ionic Cordova fail like that?
The complete logcat for the part of the crash says:
--------- beginning of crash
E/AndroidRuntime( 2227): FATAL EXCEPTION: main
E/AndroidRuntime( 2227): Process: com.ionicframework.notpush921844, PID: 2227
E/AndroidRuntime( 2227): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ionicframework.notpush921844/com.ionicframework.notpush921844.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
E/AndroidRuntime( 2227): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime( 2227): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 2227): at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 2227): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 2227): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2227): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2227): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 2227): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2227): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2227): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 2227): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 2227): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
E/AndroidRuntime( 2227): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:169)
E/AndroidRuntime( 2227): at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:95)
E/AndroidRuntime( 2227): at org.apache.cordova.PluginManager.init(PluginManager.java:84)
E/AndroidRuntime( 2227): at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:116)
E/AndroidRuntime( 2227): at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:138)
E/AndroidRuntime( 2227): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:209)
E/AndroidRuntime( 2227): at com.ionicframework.notpush921844.MainActivity.onCreate(MainActivity.java:32)
E/AndroidRuntime( 2227): at android.app.Activity.performCreate(Activity.java:5937)
E/AndroidRuntime( 2227): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 2227): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime( 2227): ... 10 more
W/ActivityManager( 1219): Force finishing activity com.ionicframework.notpush921844/.MainActivity
I/WindowManager( 1219): Screenshot max retries 4 of Token{f511ccd ActivityRecord{230d3264 u0 com.ionicframework.notpush921844/.MainActivity t61 f}} appWin=Window{1adfb8c9 u0 Starting com.ionicframework.notpush921844} drawState=4
E/ActivityManager( 1219): Invalid thumbnail dimensions: 576x576
D/OpenGLRenderer( 1219): Render dirty regions requested: true
D/Atlas ( 1219): Validating map...
D/ ( 1219): HostConnection::get() New Host Connection established 0x9de19530, tid 2264
I/OpenGLRenderer( 1219): Initialized EGL, version 1.4
D/OpenGLRenderer( 1219): Enabling debug mode 0
W/EGL_emulation( 1219): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 1219): Failed to set EGL_SWAP_BEHAVIOR on surface 0x9de3eb40, error=EGL_SUCCESS
W/ActivityManager( 1219): Activity pause timeout for ActivityRecord{230d3264 u0 com.ionicframework.notpush921844/.MainActivity t61 f}
W/EGL_emulation( 1475): eglSurfaceAttrib not implemented
W/OpenGLRenderer( 1475): Failed to set EGL_SWAP_BEHAVIOR on surface 0xb0a93b40, error=EGL_SUCCESS
W/OpenGLRenderer( 1475): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
W/OpenGLRenderer( 1475): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
W/OpenGLRenderer( 1475): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
I/iu.UploadsManager( 1746): End new media; added: 0, uploading: 0, time: 28 ms
V/ConfigFetchTask( 1746): ConfigFetchTask getDeviceDataVersionInfo(): ABFEt1ViXdAKZc6rqCAOLFv7YJuwVLSY9_n4gaUyYMJPnZLeFSYFobS5FdRKHo-hnBvGnh1pycqXDTZLbzD-k5JtupkV7UW73Ugga_ju-VhYkvWRtl_Jn90jZhoDq_QYlbboOgPzzxDKH54r4FIa2bH3M1p-U8uzShc-PuRzDfha4UOokdUFujGIG2kLo5vTf6UKiU8mrJ_i-n_s1sm2CNkFb7o3Q7f_N1keqlCKSvXmpOQwTd0C7WGOOCYVnk7105hhiah5iLKl_0ZmwnXt9YnD2hVSUAQyDJPeLsFPksOqBpS6WQgtxBQ
I/GoogleURLConnFactory( 1746): Using platform SSLCertificateSocketFactory
W/ActivityThread( 1746): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
I/ActivityManager( 1219): Waited long enough for: ServiceRecord{39917cb u0 com.android.calendar/.alerts.InitAlarmsService}
I/ConfigFetchService( 1746): fetch service done; releasing wakelock
I/ConfigFetchService( 1746): stopping self
W/ActivityManager( 1219): Activity destroy timeout for ActivityRecord{230d3264 u0 com.ionicframework.notpush921844/.MainActivity t61 f}
I/CheckinService( 1746): Done disabling old GoogleServicesFramework version
I/ConfigService( 1598): onDestroy
D/TaskPersister( 1219): removeObsoleteFile: deleting file=61_task.xml
D/InitAlarmsService( 2008): Clearing and rescheduling alarms.
I/ActivityManager( 1219): Killing 1538:com.android.printspooler/u0a42 (adj 15): empty #17
W/libprocessgroup( 1219): failed to open /acct/uid_10042/pid_1538/cgroup.procs: No such file or directory
W/AudioTrack( 1219): AUDIO_OUTPUT_FLAG_FAST denied by client
I/Process ( 2227): Sending signal. PID: 2227 SIG: 9
I/ActivityManager( 1219): Process com.ionicframework.notpush921844 (pid 2227) has died
D/OpenGLRenderer( 1219): endAllStagingAnimators on 0xa2fe5880 (RippleDrawable) with handle 0x9deaf750
W/InputMethodManagerService( 1219): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#2a47c778 attribute=null, token = android.os.BinderProxy#344958d4

It turns out the problem was caused by adding Phonegap's PushPlugin. I just had to remove android platform with ionic platform rm android and then add it again with ionic platform add android. Works fine now in both emulator and device.

Related

Genymotion: "Unfortunately <app> has stopped"

I've created an application in React Native that works fine in iOS. I've copied the code over to the Android portion of it, and separated out the platform-specific components. When I hit a certain component, the app crashes with an "Unfortunately has stopped".
There are no logs, no error in the console, nothing. What do I look for and where can I look? Logs? Somewhere in code?
In ~/genymotion-log/Google Nexus 6<...>-logcat.txt, I see the following:
05-15 23:50:14.379 D/OpenGLRenderer( 620): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-15 23:50:14.380 D/Atlas ( 620): Validating map...
05-15 23:50:14.429 I/OpenGLRenderer( 620): Initialized EGL, version 1.4
05-15 23:50:14.429 D/ ( 620): HostConnection::get() New Host Connection established 0xaf31ca40, tid 1876
05-15 23:50:14.463 D/OpenGLRenderer( 620): Enabling debug mode 0
05-15 23:50:14.489 W/EGL_emulation( 620): eglSurfaceAttrib not implemented
05-15 23:50:14.490 W/OpenGLRenderer( 620): Failed to set EGL_SWAP_BEHAVIOR on surface 0x9e45dfc0, error=EGL_SUCCESS
05-15 23:50:14.490 W/EGL_emulation( 941): eglSurfaceAttrib not implemented
05-15 23:50:14.490 W/OpenGLRenderer( 941): Failed to set EGL_SWAP_BEHAVIOR on surface 0xb43e44a0, error=EGL_SUCCESS
05-15 23:50:14.952 I/ActivityManager( 620): Killing 1492:com.android.onetimeinitializer/u0a10 (adj 15): empty #17
05-15 23:50:15.219 W/OpenGLRenderer( 941): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
05-15 23:50:15.440 W/ResourceType( 724): No package identifier when getting value for resource number 0x00000000
05-15 23:50:15.442 W/PackageManager( 724): Failure retrieving resources for com.bidsmart: Resource ID #0x0
05-15 23:50:18.400 W/AudioTrack( 620): AUDIO_OUTPUT_FLAG_FAST denied by client
05-15 23:50:18.424 I/Process ( 1805): Sending signal. PID: 1805 SIG: 9
05-15 23:50:18.463 D/OpenGLRenderer( 620): endAllStagingAnimators on 0xa1a6f780 (RippleDrawable) with handle 0xaf3be470
05-15 23:50:18.468 I/ActivityManager( 620): Process com.bidsmart (pid 1805) has died
05-15 23:50:18.472 W/InputMethodManagerService( 620): Got RemoteException sending setActive(false) notification to pid 1805 uid 10061
No fix, but the reason is I'm pushing too much data from the server to the client. Once I ran adb logcat, I got this:
java.lang.OutOfMemoryError: Failed to allocate a 2470012 byte allocation with 48508 free bytes and 47KB until OOM.
Turns out I'm pushing my images over and over to the client until it breaks. iOS can handle it but RN can't.
Link to StackOverflow related thread: Android:java.lang.OutOfMemoryError: Failed to allocate a 23970828 byte allocation with 2097152 free bytes and 2MB until OOM

setSupportActionBar() Makes my app disfunction

For some reason when i put the line setSupportActionBar(MyToolBarVariable)... It goes on to my Genymotion Emulator.. But when it opens the app, it says :
Unfourtuanetly "AppName" has Stoped
But if i delete the setSupportActionBar() Everything works fine... Whats the problem here.. Im going to post MainActivity.java file.. If you need to see others please tell me so below. Thanks for helping!
package com.example.amanuel.zoo4;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setContentView(R.layout.activity_main);
}
}
Here is the LOGCAT When i press the app in my emulator!
04-06 02:09:02.522 652-1011/? I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.amanuel.zoo4/.MainActivity (has extras)} from uid 10008 on display 0
04-06 02:09:02.721 3360-3360/? I/art: Late-enabling -Xcheck:jni
04-06 02:09:02.762 652-1021/? I/ActivityManager: Start proc 3360:com.example.amanuel.zoo4/u0a63 for activity com.example.amanuel.zoo4/.MainActivity
04-06 02:09:02.815 652-667/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.activityPaused(android.os.IBinder) from ActivityManagerService.java:6439 waiters=1 for 136ms
04-06 02:09:02.978 3360-3360/? W/System: ClassLoader referenced unknown path: /data/app/com.example.amanuel.zoo4-2/lib/x86
04-06 02:09:03.170 3360-3360/? D/AndroidRuntime: Shutting down VM
04-06 02:09:03.178 3360-3360/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.amanuel.zoo4, PID: 3360
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.amanuel.zoo4/com.example.amanuel.zoo4.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.support.v7.widget.Toolbar.getTitle()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.support.v7.widget.Toolbar.getTitle()' on a null object reference
at android.support.v7.internal.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:94)
at android.support.v7.internal.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:87)
at android.support.v7.internal.app.ToolbarActionBar.<init>(ToolbarActionBar.java:77)
at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:198)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:96)
at com.example.amanuel.zoo4.MainActivity.onCreate(MainActivity.java:13)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
04-06 02:09:03.193 652-1021/? W/ActivityManager: Force finishing activity com.example.amanuel.zoo4/.MainActivity
04-06 02:09:03.500 652-1021/? I/WindowManager: Screenshot max retries 4 of Token{75d8954 ActivityRecord{722f0a7 u0 com.example.amanuel.zoo4/.MainActivity t42 f}} appWin=Window{450aeec u0 Starting com.example.amanuel.zoo4} drawState=1
04-06 02:09:03.514 652-652/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=0 for 299ms
04-06 02:09:03.639 652-666/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12502 waiters=1 for 216ms
04-06 02:09:03.640 652-652/? W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService$UiHandler.handleMessage(android.os.Message) from ActivityManagerService.java:1397 waiters=1 for 111ms
04-06 02:09:03.814 652-1641/? I/OpenGLRenderer: Initialized EGL, version 1.4
04-06 02:09:04.021 652-666/? W/ActivityManager: Activity pause timeout for ActivityRecord{722f0a7 u0 com.example.amanuel.zoo4/.MainActivity t42 f}
04-06 02:09:04.129 652-1641/? W/EGL_emulation: eglSurfaceAttrib not implemented
04-06 02:09:04.130 652-1641/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xd60610a0, error=EGL_SUCCESS
04-06 02:09:04.198 652-667/? I/Choreographer: Skipped 32 frames! The application may be doing too much work on its main thread.
04-06 02:09:04.303 652-981/? I/ActivityManager: Killing 1792:com.android.keychain/1000 (adj 15): empty for 3078s
04-06 02:09:04.763 652-668/? E/BluetoothAdapter: Bluetooth binder is null
04-06 02:09:04.825 652-667/? I/Choreographer: Skipped 37 frames! The application may be doing too much work on its main thread.
04-06 02:09:07.697 3360-3360/? I/Process: Sending signal. PID: 3360 SIG: 9
04-06 02:09:07.732 652-679/? I/ActivityManager: Process com.example.amanuel.zoo4 (pid 3360) has died
04-06 02:09:07.771 652-1641/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0xde8f0df0
04-06 02:09:07.844 652-1641/? D/OpenGLRenderer: endAllStagingAnimators on 0xda3b2380 (RippleDrawable) with handle 0xdc57f670
04-06 02:09:07.852 652-652/? W/art: Long monitor contention event with owner method=void android.view.WindowManagerGlobal.removeView(android.view.View, boolean) from WindowManagerGlobal.java:349 waiters=0 for 102ms
04-06 02:09:07.854 652-1164/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#bc8dc8f attribute=null, token = android.os.BinderProxy#4b639cb
04-06 02:09:08.200 652-671/? W/AppOps: Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
04-06 02:09:12.630 308-647/? W/AudioFlinger: write blocked for 9842 msecs, 14 delayed writes, thread 0xf1e00000
04-06 02:09:18.081 100-100/? D/Genyd: Received Set Clipboard
04-06 02:09:18.081 100-100/? D/Genymotion: Received Set Clipboard
Try putting setContentView(R.layout.activity_main); before trying to instantiate the Toolbar.

MVVMCross 3.5.1 and xamarin android does not work

I have a question: is there somebody that use MVVMCross 3.5.1 with Api level android 21 and xamarin studio 5.9.3? I have a problem: I reference mvvmcross in an android app. I have a splashscreen and a firstview. When I tried to start with emulator I don't have any problem with level 15 emulator but when I tried it with the last version (Api 21) the app after splashscreen is closed without any error (not open the firstview).
Is there a solution?
UPDATE
I tried with logcat. In the following I attached the log:
W/AudioTrack( 394): AUDIO_OUTPUT_FLAG_FAST denied by client
I/ActivityManager( 394): START u0 {act=android.intent.action.MAIN cat=[android.
intent.category.LAUNCHER] flg=0x10000000 cmp=com.nowhere.nowhere/md51f5aeae0dbe3
fa3acab67292d41114d1.SplashScreen (has extras)} from uid 10007 on display 0
I/Choreographer( 824): Skipped 67 frames! The application may be doing too muc
h work on its main thread.
I/art ( 1716): Not late-enabling -Xcheck:jni (already on)
I/ActivityManager( 394): Start proc com.nowhere.nowhere for activity com.nowher
e.nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen: pid=1716 uid=10056 g
ids={50056, 9997, 3003} abi=armeabi-v7a
I/Choreographer( 394): Skipped 32 frames! The application may be doing too muc
h work on its main thread.
F/MonoDroid( 1716): shared runtime initialization error: dlopen failed: library
"/data/app/Mono.Android.DebugRuntime-1/lib/arm/lib/libmonosgen-2.0.so" not found
I/Zygote ( 66): Process 1716 exited cleanly (1)
I/ActivityManager( 394): Process com.nowhere.nowhere (pid 1716) has died
I/art ( 1731): Not late-enabling -Xcheck:jni (already on)
I/ActivityManager( 394): Start proc com.nowhere.nowhere for activity com.nowher
e.nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen: pid=1731 uid=10056 g
ids={50056, 9997, 3003} abi=armeabi-v7a
F/MonoDroid( 1731): shared runtime initialization error: dlopen failed: library
"/data/app/Mono.Android.DebugRuntime-1/lib/arm/lib/libmonosgen-2.0.so" not found
I/Zygote ( 66): Process 1731 exited cleanly (1)
I/ActivityManager( 394): Process com.nowhere.nowhere (pid 1731) has died
I/art ( 1746): Not late-enabling -Xcheck:jni (already on)
I/ActivityManager( 394): Start proc com.nowhere.nowhere for activity com.nowher
e.nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen: pid=1746 uid=10056 g
ids={50056, 9997, 3003} abi=armeabi-v7a
F/MonoDroid( 1746): shared runtime initialization error: dlopen failed: library
"/data/app/Mono.Android.DebugRuntime-1/lib/arm/lib/libmonosgen-2.0.so" not found
I/Zygote ( 66): Process 1746 exited cleanly (1)
I/ActivityManager( 394): Process com.nowhere.nowhere (pid 1746) has died
W/ActivityManager( 394): Force removing ActivityRecord{27f513c9 u0 com.nowhere.
nowhere/md51f5aeae0dbe3fa3acab67292d41114d1.SplashScreen t8}: app died, no saved
state
W/WindowManager( 394): Failed looking up window
W/WindowManager( 394): java.lang.IllegalArgumentException: Requested window and
roid.view.ViewRootImpl$W#3c7a1def does not exist
W/WindowManager( 394): at com.android.server.wm.WindowManagerService.wi
ndowForClientLocked(WindowManagerService.java:8412)
W/WindowManager( 394): at com.android.server.wm.WindowManagerService.wi
ndowForClientLocked(WindowManagerService.java:8403)
W/WindowManager( 394): at com.android.server.wm.WindowManagerService.re
moveWindow(WindowManagerService.java:2558)
W/WindowManager( 394): at com.android.server.wm.Session.remove(Session.
java:186)
W/WindowManager( 394): at android.view.ViewRootImpl.dispatchDetachedFro
mWindow(ViewRootImpl.java:2920)
W/WindowManager( 394): at android.view.ViewRootImpl.doDie(ViewRootImpl.
java:5390)
W/WindowManager( 394): at android.view.ViewRootImpl$ViewRootHandler.han
dleMessage(ViewRootImpl.java:3223)
W/WindowManager( 394): at android.os.Handler.dispatchMessage(Handler.ja
va:102)
W/WindowManager( 394): at android.os.Looper.loop(Looper.java:135)
W/WindowManager( 394): at android.os.HandlerThread.run(HandlerThread.ja
va:61)
W/WindowManager( 394): at com.android.server.ServiceThread.run(ServiceT
hread.java:46)
W/InputMethodManagerService( 394): Window already focused, ignoring focus gain
of: com.android.internal.view.IInputMethodClient$Stub$Proxy#14f4aa0b attribute=n
ull, token = android.os.BinderProxy#5c9e508
I/Choreographer( 824): Skipped 56 frames! The application may be doing too muc
h work on its main thread.
D/TaskPersister( 394): removeObsoleteFile: deleting file=8_task.xml
UPDATE 2
The bind does not work. Inside the view..
UPDATE 3
I put the code in this repo:
https://onedrive.live.com/redir?resid=1E563B1D1AD8A1C!15847&authkey=!AII01sfuzToQiUQ&ithint=file%2czip
I used this configuration for the test:
1. Nexus 5,
2. Android 5.0-API Level 21,
3. CPU/ABI, I have chosen Google APIs Intel Atom(x86_64),
4. Use Host GPU.
UPDATE 4
new link for code: http://1drv.ms/1MZWf45
Thanks
Alessandro
I found the problem. The problem was the emulator. I tried to change the configuration and now run without problem.
Thanks
Al.

android not honoring trigger.io's tabs.openWithOptions for server side redirect

I've got some basic trigger.io code to open a modal dialog for oauth2 authentication:
var url_auth = "http://10.0.0.70/oauth2/authorize";
var oauth_client_id = "123";
var oauth_redirect_uri = "http://done.com/oauth2/complete";
forge.tabs.openWithOptions({
url: url_auth + "?response_type=token&client_id="+ oauth_client_id + "&redirect_url=" + oauth_redirect_uri,
pattern: oauth_redirect_uri + "*",
title: "Authorizing"
}, function(data) { ... });
When the user isn't authenticated, the server redirects to http://10.0.0.70/users to present a login form.
Running the code in an iOS6 simulator yields the correct result:
open modal dialog
server redirects to login form, presented within the dialog
user can authenticate
server redirects to oauth_redirect_uri which trigger catches and closes the dialog
When I run in an android simulator, the initial page is loaded, but then the app crashes.
I see the /oauth2/authorize url being processed on the server
all I see in the debug dialog is "subView load http://10.0.0.70:3000/users"
The more details around the error are (nothing after this in logs):
[DEBUG] Native call tabs.open with task.params: {"url":"http://10.0.0.70:3000/oauth2/authorize?response_type=token&client_id=123&redirect_url=http://www.diveboatbuddy.com/oauth2/complete","pattern":"^http://www.diveboatbuddy.com/oauth2/complete.*$","title":"Authorizing"}
[INFO] Displaying modal view.
[DEBUG] Returned: {"content":null,"callid":"0F7BA94D-08AD-439D-B44F-80BB22540CD4","status":"success"}
[DEBUG] Native call logging.log with task.params: {"message":"[FORGE] 'Successfully subscribed for push notifications'","level":20}
[INFO] [FORGE] 'Successfully subscribed for push notifications'
[DEBUG] Returned: {"content":null,"callid":"030EF36D-C17F-42E8-8F9E-0221A40153D1","status":"success"}
[INFO] subView load http://10.0.0.70:3000/users
So it looks like the server has redirected correctly, but the trigger.io app isn't rendering the new server page.
adb logcat output of the problem:
D/Forge ( 394): Returned: {"content":null,"callid":"03F62CF7-8B33-425C-ABD5-2BA64565B789","status":"success"}
D/dalvikvm( 394): GC_EXTERNAL_ALLOC freed 349 objects / 24336 bytes in 41ms
I/Forge ( 394): subView load http://10.0.0.70:3000/users
D/AndroidRuntime( 394): Shutting down VM
W/dalvikvm( 394): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 394): FATAL EXCEPTION: main
E/AndroidRuntime( 394): java.lang.NoSuchMethodError: android.webkit.WebView.removeJavascriptInterface
E/AndroidRuntime( 394): at io.trigger.forge.android.modules.tabs.ModalView$2$3.shouldOverrideUrlLoading(ModalView.java:310)
E/AndroidRuntime( 394): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:216)
E/AndroidRuntime( 394): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:323)
E/AndroidRuntime( 394): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 394): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 394): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 394): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 394): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 394): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 394): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 394): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 59): Force finishing activity io.trigger.forge1979a236289211e2bbe612313d31f141/io.trigger.forge.android.core.ForgeActivity
I/ARMAssembler( 59): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x3446c0:0x34477c] in 5998000 ns
W/ActivityManager( 59): Activity pause timeout for HistoryRecord{43f928a8 io.trigger.forge1979a236289211e2bbe612313d31f141/io.trigger.forge.android.core.ForgeActivity}
I/Process ( 394): Sending signal. PID: 394 SIG: 9
I/ActivityManager( 59): Process io.trigger.forge1979a236289211e2bbe612313d31f141 (pid 394) has died.
W/ActivityManager( 59): Scheduling restart of crashed service io.trigger.forge1979a236289211e2bbe612313d31f141/com.parse.PushService in 5000ms
I/WindowManager( 59): WIN DEATH: Window{44002988 io.trigger.forge1979a236289211e2bbe612313d31f141/io.trigger.forge.android.core.ForgeActivity paused=false}
I/ActivityManager( 59): Start proc io.trigger.forge1979a236289211e2bbe612313d31f141 for service io.trigger.forge1979a236289211e2bbe612313d31f141/com.parse.PushService: pid=422 uid=10036 gids={1015, 3003}
Has anyone come across this issue. Is there a work around or a bug?
This was fixed in v1.4.34 of the Trigger.io platform: http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-34.

Android ListView throwning NullPointerException

I have an android app that gets an HTTP response from a webservice, which I process into an array of strings. I than try to display those strings in a ListView. they do not need to be clicked for any action, just displayed and be scroll-able.
When ran, Everything gets done ok, but when I try to scroll down beyond the amount of items that i have to show (because there are no more strings to display on list) I get a NullPointerException. Obviously I must be doing something wrong.
I don't quite get it. I've written a similar example as a test and it works just fine. the list in the example just scrolls and stops when there are no more items to show. The only difference I can think of is that on the original app the array gets created on a thread, and than the thread runs a runnable using a handler to display the list on the gui.
when the thread that fetches the strings and orders them to the array to display finishes, he runs this code using a handler:
scoreList = (ListView) findViewById(R.id.scorelist);
ArrayAdapter<String> myAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,scoreResult);
scoreList.setAdapter(myAdapter);
than the app crashes when trying to scroll lower than the bottom. this is the error from adb logcat:
D/AndroidRuntime( 864): Shutting down VM
W/dalvikvm( 864): threadid=1: thread exiting with uncaught exception (group=0x4
001d800)
E/AndroidRuntime( 864): FATAL EXCEPTION: main
E/AndroidRuntime( 864): java.lang.NullPointerException
E/AndroidRuntime( 864): at android.widget.ArrayAdapter.createViewFromRes
ource(ArrayAdapter.java:355)
E/AndroidRuntime( 864): at android.widget.ArrayAdapter.getView(ArrayAdap
ter.java:323)
E/AndroidRuntime( 864): at android.widget.AbsListView.obtainView(AbsList
View.java:1294)
E/AndroidRuntime( 864): at android.widget.ListView.makeAndAddView(ListVi
ew.java:1727)
E/AndroidRuntime( 864): at android.widget.ListView.fillDown(ListView.jav
a:652)
E/AndroidRuntime( 864): at android.widget.ListView.fillGap(ListView.java
:623)
E/AndroidRuntime( 864): at android.widget.AbsListView.trackMotionScroll(
AbsListView.java:2944)
E/AndroidRuntime( 864): at android.widget.AbsListView.onTouchEvent(AbsLi
stView.java:2065)
E/AndroidRuntime( 864): at android.widget.ListView.onTouchEvent(ListView
.java:3315)
E/AndroidRuntime( 864): at android.view.View.dispatchTouchEvent(View.jav
a:3766)
E/AndroidRuntime( 864): at android.view.ViewGroup.dispatchTouchEvent(Vie
wGroup.java:897)
E/AndroidRuntime( 864): at android.view.ViewGroup.dispatchTouchEvent(Vie
wGroup.java:936)
E/AndroidRuntime( 864): at android.view.ViewGroup.dispatchTouchEvent(Vie
wGroup.java:936)
E/AndroidRuntime( 864): at android.view.ViewGroup.dispatchTouchEvent(Vie
wGroup.java:936)
E/AndroidRuntime( 864): at com.android.internal.policy.impl.PhoneWindow$
DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)
E/AndroidRuntime( 864): at com.android.internal.policy.impl.PhoneWindow.
superDispatchTouchEvent(PhoneWindow.java:1107)
E/AndroidRuntime( 864): at android.app.Activity.dispatchTouchEvent(Activ
ity.java:2086)
E/AndroidRuntime( 864): at com.android.internal.policy.impl.PhoneWindow$
DecorView.dispatchTouchEvent(PhoneWindow.java:1655)
E/AndroidRuntime( 864): at android.view.ViewRoot.handleMessage(ViewRoot.
java:1785)
E/AndroidRuntime( 864): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 864): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 864): at android.app.ActivityThread.main(ActivityThrea
d.java:4627)
E/AndroidRuntime( 864): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 864): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime( 864): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 864): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:626)
E/AndroidRuntime( 864): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 59): Force finishing activity memo.ori.friend/.Highscores
W/ActivityManager( 59): Activity pause timeout for HistoryRecord{4503fed0 memo
.ori.friend/.Highscores}
W/WindowManager( 59): No window to dispatch pointer action 1
W/ActivityManager( 59): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 59): Activity idle timeout for HistoryRecord{45023af0 memo.
ori.friend/.MemoFriendActivity}
D/dalvikvm( 261): GC_EXPLICIT freed 45 objects / 2128 bytes in 108ms
W/ActivityManager( 59): Activity destroy timeout for HistoryRecord{4503fed0 me
mo.ori.friend/.Highscores}
D/SntpClient( 59): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
I/Process ( 864): Sending signal. PID: 864 SIG: 9
I/ActivityManager( 59): Process memo.ori.friend (pid 864) has died.
I/WindowManager( 59): WIN DEATH: Window{45077ce0 memo.ori.friend/memo.ori.frie
nd.MemoFriendActivity paused=false}
I/WindowManager( 59): WIN DEATH: Window{4507cf60 memo.ori.friend/memo.ori.frie
nd.Highscores paused=false}
I/UsageStats( 59): Unexpected resume of com.android.launcher while already res
umed in memo.ori.friend
W/InputManagerService( 59): Got RemoteException sending setActive(false) notif
ication to pid 864 uid 10044
W/IInputConnectionWrapper( 126): showStatusIcon on inactive InputConnection
D/SntpClient( 59): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
When ran, Everything gets done ok, but when I try to scroll down
beyond the amount of items that i have to show (because there are no
more strings to display on list) I get a NullPointerException.
Obviously I must be doing something wrong.
That exception comes from having null values in the list/array(scoreResult) that you pass to the ArrayAdapter. This is because the ArrayAdapter will call, by default,(in it's getView method which is responsible for building the list's rows) the toString method on each item from the data list if the type of that item isn't a CharSequence(you have String), to obtain a text representation of that item to show in the row.
So check the scoreResult list/array and make sure you don't have null values in it. I see you speak of an array, make sure the array is just as big as it needs for the data, if it's bigger than the data you'll have null values at its end.
request time failed: java.net.SocketException: Address fami
ly not supported by protocol
pls check what is there, somethig not good.
NullPointerException it is the beginner programmer sign: it doesn't verify the parameters and he write multiple statements in 1 line. In this case I would check the scoreResult to not be empty, but at least not null

Categories

Resources