Android Studio debugger stops unexpectedly - android

I'm not being able to debug my app as after setting a breakpoint and debugger stops at it, it then stops suddenly after two or three seconds and app exits with no aparent reason.
I've tried setting the breakpoint at different locations to ensure no other background process is interfering with it, for example at the very beginning of onCreate in splash activity, but the same happens, debugger stops as expected and after a few seconds app exits and debugging session ends unexpectedly.
I've tried updating Android Studio and Gradle to latest version (my AS is 3.6.1) and Gradle 5.6.4 (plugin version is 3.6.1) to no avail. Also tried uninstalling/reinstalling the app to no avail too and lastly I've tried "Invalidate caches and restart" option in Android Studio but it neither worked.
I'm not being able to debug and don't know what else to try / do.
My mobile is a Huawei Mate 20 Lite, and I've also tried rebooting the phone with no success.
Here is my "Logcat" as soon as debugger stops and app exits (app figures as com.mycompany.myapp):
2020-03-06 19:20:39.719 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:39.722 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:39.724 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:39.777 2462-5966/? E/HwNaturalBase: [Binder:2462_10]: clearDataByOwner ignore: Found null values with the given ownerPkgName is[com.mycompany.myapp].
2020-03-06 19:20:39.778 2334-4531/? E/AwareLog: GameSdkConfigReader: GameSdkLog: idNameMap: null
2020-03-06 19:20:39.809 847-861/? E/AwareLog: iawared: GetFileContent open /proc/14267/task/14277/cpuset fail errno(2)!
2020-03-06 19:20:39.815 14269-14269/? E/ssioncontrolle: Not starting debugger since process cannot load the jdwp agent.
2020-03-06 19:20:39.817 838-838/? E/Thermal-daemon: [shell_frame] temp_new :29 temp_old :28
2020-03-06 19:20:39.817 1408-1927/? E/ProcessInfoCollector: getProcessInfo: failed to find this proc
2020-03-06 19:20:39.818 838-838/? E/Thermal-daemon: Report temperature: [shell_frame] temp :29 report_threshold:1
2020-03-06 19:20:39.820 838-838/? E/Thermal-daemon: [ap] temp_new :36 temp_old :35
2020-03-06 19:20:39.821 838-838/? E/Thermal-daemon: Report temperature: [ap] temp :36 report_threshold:1
2020-03-06 19:20:39.855 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:39.857 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:39.865 2033-2033/? E/HwLauncher: PowerSaveLauncherModel onPackageChanged: not inPowerSaveLauncher
2020-03-06 19:20:39.865 2033-2033/? E/HwLauncher: StreetModeLauncherModel onPackageChanged: not inStreetModeLauncher
2020-03-06 19:20:39.889 653-1175/? E/BufferQueueProducer: [com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher#1]:1338: disconnect: not connected (req=1)
2020-03-06 19:20:39.890 653-2692/? E/BufferQueueProducer: [com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher#0]:1338: disconnect: not connected (req=1)
2020-03-06 19:20:39.908 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:39.912 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:39.942 577-14300/? E/ResolverController: No valid NAT64 prefix (123, <unspecified>/0)
2020-03-06 19:20:42.444 1408-8027/? E/WifiService: enforceCanAccessScanResults: hiding ssid and bssidLocation mode is disabled for the device
2020-03-06 19:20:42.456 1408-1602/? E/WifiService: enforceCanAccessScanResults: hiding ssid and bssidLocation mode is disabled for the device
2020-03-06 19:20:42.468 2033-2033/? E/HwLauncher: HwAppMarketDownloadModel handleInstallAction op: 2
2020-03-06 19:20:42.663 7452-7525/? E/HSM_UI: SecurityBroadcastReceiver:SecurityBroadcastReceiver the rainbow is not enabled!
2020-03-06 19:20:42.789 577-14311/? E/ResolverController: No valid NAT64 prefix (123, <unspecified>/0)
2020-03-06 19:20:42.956 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:42.963 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:43.173 653-2692/? E/BufferQueueProducer: [Waiting For Debugger: com.mycompany.myapp#0]:1338: disconnect: not connected (req=1)
2020-03-06 19:20:43.185 1408-7773/? E/InputDispatcher: Window handle Window{d9a7484 u0 Waiting For Debugger: com.mycompany.myapp} has no registered input channel
2020-03-06 19:20:43.201 1408-2090/? E/InputDispatcher: Window handle Window{d9a7484 u0 Waiting For Debugger: com.mycompany.myapp} has no registered input channel
2020-03-06 19:20:43.611 14186-14323/com.mycompany.myapp E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile#563b55d
2020-03-06 19:20:43.616 14186-14323/com.mycompany.myapp E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile#fa4bed2
2020-03-06 19:20:43.650 577-14328/? E/ResolverController: No valid NAT64 prefix (123, <unspecified>/0)
2020-03-06 19:20:44.824 838-838/? E/Thermal-daemon: [ap] temp_new :37 temp_old :36
2020-03-06 19:20:44.828 838-838/? E/Thermal-daemon: Report temperature: [ap] temp :37 report_threshold:1
2020-03-06 19:20:45.312 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:45.842 8205-10507/? E/HSC_SEC: VirusPkgParser:parse InputStream is null
2020-03-06 19:20:45.985 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:45.987 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:46.733 879-996/? E/ScreemCommon: <LOGMGR> <logCaptureFilter> [not the beta version or delimitation frozen, no need to capture log]
2020-03-06 19:20:46.733 879-996/? E/ScreemCommon: ### JankSchedHwRead error!
2020-03-06 19:20:46.734 879-996/? E/ScreemCommon: ### ScreemSchedDlmRead read failed!
2020-03-06 19:20:46.735 879-996/? E/ScreemCommon: ### ScreemSchedDlmRead error!
2020-03-06 19:20:46.737 879-996/? E/ScreemCommon: update dlm info failed
2020-03-06 19:20:46.996 2258-2450/? E/HwCHRWifiRSSIGroupSummery: updatArpSummery mRSSI:-1 HwCHRWifiRSSIGroup [rssi_index=4, rtt_tcp_packets=0, rtt_tcp_duration=0, rtt_lan_duration=5066, rtt_lan_failures=0, rtt_lan_succ=396, rtt_lan_max=324, rtt_lan_min=4,same_area_frequency=0,adjacent_area_frequency=0]
2020-03-06 19:20:47.212 2258-2258/? E/CHR_ChrModemStatistics: sensors invalid
2020-03-06 19:20:47.471 2334-17416/? E/AppInfoMgr: not find pkgs by uid: 0
2020-03-06 19:20:49.008 642-642/? E/WifiHAL: enter wifi_get_link_stats
2020-03-06 19:20:49.013 1408-1610/? E/WificondControl: Noise: 0, Snr: 0, Chload: -1
2020-03-06 19:20:49.393 1408-1431/? E/ActivityTaskManager: app boot failure event send
2020-03-06 19:20:49.443 879-3232/? E/LOGSERVER_UTILS: [ZeroHung]sentEvent: result->scope length:3, wpName length:2
2020-03-06 19:20:49.443 879-3232/? E/LOGSERVER_UTILS: [ZeroHung]sentEvent: recoverSolution length:10, recoverResult length:7, keyLog length:31
2020-03-06 19:20:49.479 879-3232/? E/iMonitor: [ZeroHung]appendFile: open /data/log/reliability/appeye/history.log.0 failed
2020-03-06 19:20:49.484 879-998/? E/ScreemHealth: Get an unregisted msg 3.
2020-03-06 19:20:49.512 1408-1587/? E/WindowManager: win=Window{c946538 u0 com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
2020-03-06 19:20:49.512 1408-1587/? E/WindowManager: win=Window{b8371be u0 com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
2020-03-06 19:20:49.533 2334-4108/? E/AwareLog: SPKSchedFeature: Uid has been sent, ignore.
2020-03-06 19:20:49.602 1408-1587/? E/ZRHungService: BF and NFW forceStop package: com.mycompany.myapp
2020-03-06 19:20:49.630 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:49.637 1899-4895/? E/HsmCoreServiceImpl: onTransact in code is: 102
2020-03-06 19:20:49.637 2334-4531/? E/AwareLog: GameSdkConfigReader: GameSdkLog: idNameMap: null
2020-03-06 19:20:49.638 3259-3259/? E/NfcNci: NfcUtils error: APP do not have nfc permission
2020-03-06 19:20:49.652 21186-21228/? E/AppLifeChangeSensor: CAWARENESS: activityResumed mAppLifeChangeCallback is null
2020-03-06 19:20:49.653 1899-11648/? E/DollieAdapterService: notifyActivityState pkg:com.huawei.android.launcher/com.huawei.android.launcher.unihome.UniHomeLauncher state:2 fg:true mUid:10074
2020-03-06 19:20:49.657 1408-1432/? E/WindowManager: icon is null!!
2020-03-06 19:20:49.832 838-838/? E/Thermal-daemon: [ap] temp_new :36 temp_old :37
2020-03-06 19:20:49.833 838-838/? E/Thermal-daemon: Report temperature: [ap] temp :36 report_threshold:1
2020-03-06 19:20:50.168 21235-14119/? E/TotemWeather: DeviceStateServiceListener:lastLocation is null
Edit 1:
Inspecting Logcat I can guess that maybe "ZRHungService" is causing the problem, but cannot find any information about this service.
E/ZRHungService: BF and NFW forceStop package: com.mycompany.myapp
Edit 2:
I've tried debugging in a virtual device with success, but the problem is I'm debugging the copy of a file in downloads to cache dir and in virtual device I don't have that file, so I think that's not an option :(

I am getting the same issue if anyone from Huawei, or users of them have found real solutions yet. It's only just started happening on my Mate 20 Pro since it was updated to Android 10 a few days ago.
Here are my logcat lines for the app. Dies after 3-4 secs of being on a breakpoint :
2020-03-10 20:22:24.228 711-981/? E/BufferQueueProducer: [Waiting For Debugger: digital.key.testapp#0]:1338: disconnect: not connected (req=1)
2020-03-10 20:22:24.249 1108-2438/? E/InputDispatcher: Window handle Window{b4506fa u0 Waiting For Debugger: digital.key.testapp} has no registered input channel
2020-03-10 20:22:24.422 8057-8106/digital.key.testapp E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile#77e0f7
2020-03-10 20:22:30.622 1108-1817/? E/ZRHungService: BF and NFW forceStop package: digital.key.testapp
I have found one temporary solution. Set a debug app in your devleoper options on your phone and tell it to wait for debugger. Then launch it and you can attach the debugger from Android Studio and all works well.
Settings -> System and Updates -> Developer Options
Under Debugging find 'Select debug app' and choose your app
Tick ON 'Wait for debugger'
Run app from app drawer
In Android Studio choose attach debugger instead and breakpoints no longer crash
.

Huawei Mate 20 Lite solution I don't know how and why does this work, it's not a scientific method.
For those who doesn't work Captain Wizard's solution, I have found a weird approach for this issue. Some requirments presented above should be considered.
Normal run the app
As fast as you can, go to Run -> Attach to process.. You have to choose this option from the run menu, NOT "Attach Debugger to Android Process" as it will not work.
A pop-up appears, choose the option that appears.
Something finally shows up, don't pay attention to it.
Choose "Attach Debugger to Android Process" icon.
Now, the debugging process should not stop after a few seconds.

Related

Debugging Xamarin.Forms App on Android Oreo Fails

Every time I run to debug app on my Nexus 6P (Android Oreo), the app will get deployed, starts briefly and then exits and Visual Studio (2015) will stop debug process and show following message
Android application is debugging.
Couldn't connect to logcat, GetProcessId returned: 0
Checking Logcat shows lots of errors, 2 of which are predominant
Time Device Name Type PID Tag Message
09-29 13:03:50.240 Huawei Nexus 6P Error 11451 o.mz java.lang.NoClassDefFoundError: o.ʖ
at o.ʷ.ˏ(:363)
at o.Г.ॱ(:247)
at o.Г.ˋ(:141)
at o.ץ.ˎ(:406)
at o.ץ.ˋ(:4352)
at o.ץ.ॱ(:244)
at o.ץ.ˊ(:142)
at o.ᴄ.ॱ(:476)
at o.Ḯ.ˋ(:3890)
at o.Ḯ.ॱ(:3784)
at o.mz$If.onMessage(:3899)
at okhttp3.internal.ws.RealWebSocket$1.onMessage(:62)
at okhttp3.internal.ws.WebSocketReader.readMessageFrame(:242)
at okhttp3.internal.ws.WebSocketReader.processNextFrame(:108)
at okhttp3.internal.ws.RealWebSocket.readMessage(:97)
at okhttp3.ws.WebSocketCall.createWebSocket(:152)
at okhttp3.ws.WebSocketCall.access$000(:41)
at okhttp3.ws.WebSocketCall$1.onResponse(:97)
at okhttp3.RealCall$AsyncCall.execute(:126)
at okhttp3.internal.NamedRunnable.run(:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
and the 2nd and most dominant error is
Time Device Name Type PID Tag Message
09-29 13:04:34.666 Huawei Nexus 6P Error 3759 QC-QMI linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]

Many Errors in LogCat on Android Device

I have a Nexus 4 with Android 6.0 and i have connected it in Developer Mode to my Android Studio to see what the Log-File output looks like. The LogCat sends many errors:
1. 02-25 09:15:46.787 548-623/? E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0,00 rxSuccessRate=0,00 targetRoamBSSID=any RSSI=-53
2. 02-25 09:15:46.787 548-623/? E/WifiStateMachine: WifiStateMachine L2Connected CMD_START_SCAN source -2 226, 227 -> obsolete
3. 02-25 09:15:36.955 3609-3609/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!
4. 02-25 09:15:28.154 195-218/? E/ANDR-PERF-LOCK: Failed to apply optimization for resource: 4 level: 0
5. 02-25 09:15:27.479 548-623/? E/WifiStateMachine: cancelDelayedScan -> 227
6. 02-25 09:15:27.483 548-623/? E/native: do suspend true
7. 02-25 09:14:42.632 188-31249/? E/ACDB-LOADER: Error: ACDB AudProc vol returned = -8
8. 02-25 09:16:36.436 1596-1596/? E/ctxmgr: [PowerConnectionProducer]Could not write powerInfo=Plug state: 2 BatteryLevel: 0.85, status=Status{statusCode=unknown status code: 7503, resolution=null}
What are all these errors? They are appearing over and over again in different orders and are appearing independent from each other.
The Error:
02-25 09:18:36.981 3609-3609/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!
Appears each 10 seconds even when there is no app active and all background proceses of all apps are killed.
Many apps running the background log the actions being done. Some of them also raises errors. WifiStateMachine gives data about your Wifi connection, PowerConnectionProducer gives data about your battery and so on. You will get errors similar to these on all devices.
This is no reason to worry, unless you have an error associated with your own app.
These are system logs,which you see after connecting your device.
This Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress.
Please refer to TransactionTooLarge

Android M API 23 emulator Unfortunately, browser has stopped

I am trying to launch browser on Android M Emulator. It keeps on crashing on every launch.
10-14 13:34:12.934: I/ActivityManager(1294): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=com.android.browser cmp=com.android.browser/.BrowserActivity bnds=[372,692][460,800] (has extras)} from uid 10007 on display 0
10-14 13:34:13.046: I/ActivityManager(1294): Start proc 5514:com.android.browser/u0a17 for activity com.android.browser/.BrowserActivity
10-14 13:34:13.131: W/System(5514): ClassLoader referenced unknown path: /system/app/Browser/lib/x86
10-14 13:34:13.451: E/chromium(5514): [ERROR:browser_main_loop.cc(698)] GLSurface::InitializeOneOff failed
10-14 13:34:13.591: D/WebViewTimersControl(5514): onBrowserActivityResume
10-14 13:34:13.591: D/WebViewTimersControl(5514): Resuming webview timers, view=com.android.browser.BrowserWebView{2900a61 VFEDHVC.. ......I. 0,0-0,0}
10-14 13:34:13.861: I/ActivityManager(1294): Displayed com.android.browser/.BrowserActivity: +833ms
10-14 13:34:14.377: A/DEBUG(962): pid: 5514, tid: 5559, name: GpuThread >>> com.android.browser <<<
10-14 13:34:14.500: I/WindowState(1294): WIN DEATH: Window{bd73c76 u0 com.android.browser/com.android.browser.BrowserActivity}
10-14 13:34:14.556: I/ActivityManager(1294): Process com.android.browser (pid 5514) has died
10-14 13:34:14.560: W/ActivityManager(1294): Force removing ActivityRecord{1b3e625 u0 com.android.browser/.BrowserActivity t25}: app died, no saved state
Settings -> Apps -> Browser. then goto permission and enable storage permission to be enabled.because the storage permission is closed default.Just open it!
Edit the Android Virtual Device settings inside you AVD manager that you are using and try starting your emulator with the "Use Host GPU" option enabled, this will help to fix your error with the browser.
For downloading files with the browser make sure you also add enough size to your SD Card option. After editing both settings, start Android and goto: Settings -> Apps -> Browser.
(If needed force to stop the browser) then goto permission and enable storage permission to be enabled. This will fix your error with the browser when downloading files.

Google Play Games Service (GPGS) Realtime Multiplayer (RTMP) never matches on Android (iOS works)

We are trying to implement GPGS RTMP C++ and running into a strange issue. We are following the default example used in ButtonClicker and actually have it working just fine between iOS devices. However when we try the same code using two Android devices quick match never fully completes.
Using the Android build we can create a room but once the quick game matching starts to take place both devices get a room status change callback with the status of CONNECTING. They remain stuck that way and we receive no other notifications past that point in any callbacks. Again the same code is working when run on iOS and we assume everything has been set up correctly in the developer console since we have access to Google play and are able to achieve a successful room creation on both devices.
Also if I try to connect an Android to an iOS device I get the same behavior on the Android side, but the iOS device quickly shows the Android player's status change to disconnected in the OnConnectedSetChanged callback.
I have also rebuilt/reimported the android SDK projects (made sure we had latest SDK), made sure we are using 1.3 of the c++ project. Also using NDK 9d and Cocos2d-x v2.2.6
Just in case the following is a clue/red alert to someone who has got the answer. The other odd issue we are having with GPGS is achievements (in total or progress) they won't post/retain progress (no errors), but leaderboards do retain and progress... Maybe this is related.
We have also tried builds via alpha and beta distributions via google play (signed and zip aligned)
EDIT: Adding more information
Here is our logs from an Android to Android match:
02-19 18:24:44.252: D/cocos2d-x debug info(27707): jni:isConnected is defined.
02-19 18:24:44.262: D/DA2(27707): isConnected() called.
02-19 18:24:44.272: D/cocos2d-x debug info(27707): isConnected(true) JNI Done.
02-19 18:24:44.272: I/DA2_GPGStateManager(27707): Entering GPGSStateManager::IsAuthorized()
02-19 18:24:44.272: D/cocos2d-x debug info(27707): Checking if user is GPGS authorized: YES
02-19 18:24:46.492: D/cocos2d-x debug info(27707): created a room 1
02-19 18:24:46.492: D/cocos2d-x debug info(27707): MY PLAYER ID IS: p_CP2QiKTYldGO5wEQAQ : Player Y
02-19 18:24:46.812: D/cocos2d-x debug info(27707): OnRoomStatusChanged
02-19 18:24:46.812: D/cocos2d-x debug info(27707): GPG Room status changed to CONNECTING.
02-19 18:24:49.542: D/dalvikvm(27707): threadid=34: thread exiting, not yet detached (count=0)
02-19 18:24:49.542: V/GamesNativeSDK(27707): Detaching from JVM on thread main_dispatch
EDIT: Adding more information
Here is our logs from an Android to iOS match from the iOS log perspective:
Cocos2d: OnRoomStatusChanged
Cocos2d: GPG Room status changed to CONNECTING.
2015-02-19 01:41:08.790 dam[20540:2466970] INFO: OP: 1
2015-02-19 01:41:08.791 dam[20540:2466970] INFO: CALL_STATE_CHANGED_OP: New state: 1
2015-02-19 01:41:08.792 dam[20540:2466970] ERROR: peer_capabilities must not be null in PeerStateMachine::WaitingForConnectionData
2015-02-19 01:41:08.793 dam[20540:2466970] INFO: PeerStateMachine: WaitingForOutgoingRemoteConnectionNoSessionId-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 transitionTo WaitingForConnectionData-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2
2015-02-19 01:41:09.070 dam[20540:2466970] INFO: OP: 6
2015-02-19 01:41:09.071 dam[20540:2466970] INFO: CALL_STATE_CHANGED_OP: New state: 6
2015-02-19 01:41:09.072 dam[20540:2466970] INFO: PeerStateMachine: Not handled -- invoking default handler for:7002
2015-02-19 01:41:09.072 dam[20540:2466970] ERROR: - unhandledMessage: message.type=7002
2015-02-19 01:41:09.073 dam[20540:2466970] INFO: OP: 14
2015-02-19 01:41:09.074 dam[20540:2466970] INFO: CALL_STATE_CHANGED_OP: New state: 14
2015-02-19 01:41:09.075 dam[20540:2466970] INFO: PeerStateMachine: Not handled -- invoking default handler for:7002
2015-02-19 01:41:09.077 dam[20540:2466970] ERROR: - unhandledMessage: message.type=7002
2015-02-19 01:41:09.194 dam[20540:2466969] INFO: Connection status: CONNECTION_ESTABLISHED reporting ? 0
2015-02-19 01:41:09.195 dam[20540:2466970] INFO: PeerStateMachine: WaitingForConnectionData-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 transitionTo ConnectedState-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2
Cocos2d: OnRoomStatusChanged
Cocos2d: GPG Room status changed to ACTIVE.
Cocos2d: PLAYER: Player X STATUS:2 IN ROOM: Y
Cocos2d: PLAYER: Player 6459 STATUS:2 IN ROOM: Y ID:p_CIuY5fK73c-kKRAB
2015-02-19 01:41:18.936 dam[20540:2466970] INFO: OP: 13
2015-02-19 01:41:18.937 dam[20540:2466970] INFO: CALL_STATE_CHANGED_OP: New state: 13
2015-02-19 01:41:18.938 dam[20540:2466969] INFO: Attempting to reconnect to: p_CIuY5fK73c-kKRAB
2015-02-19 01:41:18.938 dam[20540:2466970] INFO: PeerStateMachine: ConnectedState-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 transitionTo EntryState-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2
2015-02-19 01:41:18.940 dam[20540:2466969] INFO: Attempting to reconnect to: p_CIuY5fK73c-kKRAB
2015-02-19 01:41:18.941 dam[20540:2466969] INFO: Waiting for connection from p_CIuY5fK73c-kKRAB
2015-02-19 01:41:18.943 dam[20540:2466970] INFO: PeerStateMachine: Setting peer 1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 capabilities to 0
2015-02-19 01:41:18.944 dam[20540:2466970] ERROR: peer_capabilities must not be null in PeerStateMachine::WaitingForOutgoingRemoteConnectionNoSessionId
2015-02-19 01:41:18.945 dam[20540:2466970] INFO: PeerStateMachine: EntryState-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 transitionTo WaitingForOutgoingRemoteConnectionNoSessionId-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2
2015-02-19 01:41:18.946 dam[20540:2466970] ERROR: No session mapped for 1211971051
2015-02-19 01:41:18.947 dam[20540:2466970] ERROR: - unhandledMessage: message.type=7008
2015-02-19 01:41:18.948 dam[20540:2466970] INFO: OP: 1
2015-02-19 01:41:18.949 dam[20540:2466970] INFO: CALL_STATE_CHANGED_OP: New state: 1
2015-02-19 01:41:18.951 dam[20540:2466970] ERROR: peer_capabilities must not be null in PeerStateMachine::WaitingForConnectionData
2015-02-19 01:41:18.953 dam[20540:2466970] INFO: PeerStateMachine: WaitingForOutgoingRemoteConnectionNoSessionId-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 transitionTo WaitingForConnectionData-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2
2015-02-19 01:41:19.262 dam[20540:2466970] INFO: PeerStateMachine: Not handled -- invoking default handler for:6010
Cocos2d: OnConnectedSetChanged
Cocos2d: PLAYER: Player X STATUS:2 IN ROOM: N
Cocos2d: PLAYER: Player 6459 STATUS:4 IN ROOM: N
Cocos2d: GPGSRealtimeMultiplayerManager::disconnect() called.
Cocos2d: REMOVE PLAYER: Player X ID:p_CIedtPyuzNqXkwEQAQ
Cocos2d: GPGSRealtimeMultiplayerManager::disconnect() called.
2015-02-19 01:41:19.262 dam[20540:2466970] ERROR: - unhandledMessage: message.type=6010
Cocos2d: REMOVE PLAYER: Player 6459 ID:p_CIuY5fK73c-kKRAB
Cocos2d: GPGSRealtimeMultiplayerManager::disconnect() called.
2015-02-19 01:41:19.268 dam[20540:2466970] INFO: PeerStateMachine: Not handled -- invoking default handler for:6004
2015-02-19 01:41:19.269 dam[20540:2466969] INFO: Disconnecting all peers
2015-02-19 01:41:19.270 dam[20540:2466969] ERROR: Transitioning to LeavingRoomState with invalid player id!
Cocos2d: GPG Multiplayer room left unsuccessfully! (now what?)
Cocos2d: GPG Multiplayer room left unsuccessfully! (now what?)
2015-02-19 01:41:19.337 dam[20540:2466970] INFO: PeerStateMachine: WaitingForConnectionData-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2 transitionTo EntryState-1j89l5beklypm389fttwl6uuy0#public.talk.google.com/games_andrB648F1B2
2015-02-19 01:41:19.339 dam[20540:2466970] INFO: OP: 12
2015-02-19 01:41:19.340 dam[20540:2466970] INFO: CALL_STATE_CHANGED_OP: New state: 12
2015-02-19 01:41:19.341 dam[20540:2466970] ERROR: No session mapped for 3259690520
2015-02-19 01:41:19.341 dam[20540:2466970] ERROR: - unhandledMessage: message.type=7008
Cocos2d: LOBBY ROW DEALLOC
2015-02-19 01:41:19.556 dam[20540:2467034] VERBOSE: Request had Apiary Status Code: 0
Cocos2d: GPG Multiplayer room left successfully (Quick Game/Invite)
2015-02-19 01:41:19.585 dam[20540:2466970] INFO: PeerStateMachine: Not handled -- invoking default handler for:6010
2015-02-19 01:41:29.271 dam[20540:2466415] ERROR: - unhandledMessage: message.type=48
2015-02-19 01:41:29.587 dam[20540:2466415] ERROR: - unhandledMessage: message.type=48
I will post Android perspective logs as soon as I collect some. We are using the zip aligned and all the log prints are stripped.
On Android the room state change was not announced like it was on iOS.
specifically the callback for:
IRealTimeEventListener::OnRoomStatusChanged
The solution was to examine any callback and check for a state change. To be completely sure we were keeping track of last known room state whenever a room participant change occurs.
In our case OnParticipantStatusChanged was the most critical.
Luckily it is a simple system and only a handful of callbacks with a room reference exist... O.o
We are able to play games between Android to Android and Android to iOS this way... Seems like a work around to track state this way, but maybe it will help someone! v1.2 and v1.3 both behaved this way.
I figured this out when I modified the minimalist app (that runs in every version supported) to include operations from the Button Clicker sample app (which required later versions of Android to leverage JUI for the ui components.) It was a complete accident that I sent data and noticed it was received... I am glad I was paying attention.

chariotsolutions phonegap-nfc plugin rebooting on scan

I am using PhoneGap build and the chariotsolutions NFC plugin to scan NFC cards, and it was working. However, it started failing after PhoneGap build went down. I can only guess that PhoneGap build is now using a newer version of the plugin. A clean build still makes it crash internally on scan of a card.
I created a new Cordova project with the latest build using the cordova CLI, and installed the chariotsolutions plugin. It is still failing with only the bear bones project, which is outside of PhoneGap build now.
Hardware and software: Android Nexus 7 running Android 4.4.2
Cordova version 3.3
Bear bones project code contains only this onDeviceReady:
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
console.log('v0.0.3');
document.addEventListener('resume', app.resume, false);
document.addEventListener('pause', app.pause, false);
// Read NDEF formatted NFC Tags
nfc.addNdefListener (
function (nfcEvent) {
console.log('nfcEvent '+JSON.stringify(nfcEvent));
var tag = nfcEvent.tag,
ndefMessage = tag.ndefMessage;
// dump the raw json of the message
// note: real code will need to decode
// the payload from each record
console.log(JSON.stringify(ndefMessage));
// assuming the first record in the message has
// a payload that can be converted to a string.
console.log(nfc.bytesToString(ndefMessage[0].payload).substring(3));
},
function () { // success callback
console.log("Waiting for NDEF tag");
},
function (error) { // error callback
console.log("Error adding NDEF listener " + JSON.stringify(error));
}
);
},
ADB output on launch of the app:
I/ActivityManager( 512): Start proc com.test.myapp for activity com.test.myapp/.myappname: pid=17325 uid=10037 gids={50037, 3003}
I/CordovaLog(17325): Changing log level to DEBUG(3)
I/CordovaLog(17325): Found start page location: index.html
D/Whitelist(17325): Unlimited access to network resources
D/CordovaActivity(17325): CordovaActivity.onCreate()
V/WebViewChromium(17325): Binding Chromium to the background looper Looper (main, tid 1) {4211c938}
I/chromium(17325): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserProcessMain(17325): Initializing chromium process, renderers=0
W/chromium(17325): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
D/libEGL (17325): loaded /system/lib/egl/libEGL_tegra.so
D/libEGL (17325): loaded /system/lib/egl/libGLESv1_CM_tegra.so
D/libEGL (17325): loaded /system/lib/egl/libGLESv2_tegra.so
D/CordovaWebView(17325): CordovaWebView is running on device made by: asus
D/JsMessageQueue(17325): Set native->JS mode to 2
D/CordovaActivity(17325): CordovaActivity.init()
D/CordovaWebView(17325): >>> loadUrl(file:///android_asset/www/index.html)
D/PluginManager(17325): init()
D/CordovaWebView(17325): >>> loadUrlNow()
I/CordovaLog(17325): Changing log level to DEBUG(3)
I/CordovaLog(17325): Found start page location: index.html
D/Whitelist(17325): Unlimited access to network resources
D/CordovaActivity(17325): Resuming the App
D/CordovaActivity(17325): CB-3064: The errorUrl is null
D/SoftKeyboardDetect(17325): Ignore this event
D/OpenGLRenderer(17325): Enabling debug mode 0
D/SoftKeyboardDetect(17325): Ignore this event
I/ActivityManager( 512): Displayed com.test.myapp/.myappname: +813ms
D/AndroidRuntime(17309): Shutting down VM
D/dalvikvm(17309): GC_CONCURRENT freed 97K, 15% free 589K/688K, paused 0ms+2ms, total 5ms
D/CordovaActivity(17325): onMessage(onPageStarted,file:///android_asset/www/index.html)
D/CordovaLog(17325): file:///android_asset/www/index.html: Line 25 : Viewport target-densitydpi is not supported.
I/chromium(17325): [INFO:CONSOLE(25)] "Viewport target-densitydpi is not supported.", source: file:///android_asset/www/index.html (25)
D/CordovaWebViewClient(17325): onPageFinished(file:///android_asset/www/index.html)
D/CordovaActivity(17325): onMessage(onPageFinished,file:///android_asset/www/index.html)
D/CordovaActivity(17325): onMessage(spinner,stop)
D/CordovaNetworkManager(17325): Connection Type: wifi
I/chromium(17325): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/chromium(17325): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
D/CordovaNetworkManager(17325): Connection Type: wifi
D/CordovaActivity(17325): onMessage(networkconnection,wifi)
D/CordovaLog(17325): file:///android_asset/www/js/index.js: Line 58 : onDeviceReady v0.0.3
I/chromium(17325): [INFO:CONSOLE(58)] "onDeviceReady v0.0.3", source: file:///android_asset/www/js/index.js (58)
D/NfcPlugin(17325): execute registerNdef
D/CordovaLog(17325): file:///android_asset/www/js/index.js: Line 83 : Waiting for NDEF tag
I/chromium(17325): [INFO:CONSOLE(83)] "Waiting for NDEF tag", source: file:///android_asset/www/js/index.js (83)
D/NfcPlugin(17325): execute init
D/NfcPlugin(17325): Enabling plugin Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.test.myapp/.myappname }
D/NfcDispatcher( 769): Set Foreground Dispatch
D/NfcPlugin(17325): parseMessage Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.test.myapp/.myappname }
D/NfcPlugin(17325): action android.intent.action.MAIN
D/CordovaLog(17325): file:///android_asset/www/plugins/com.chariotsolutions.nfc.plugin/www/phonegap-nfc.js: Line 18 : Initialized the NfcPlugin
I/chromium(17325): [INFO:CONSOLE(18)] "Initialized the NfcPlugin", source: file:///android_asset/www/plugins/com.chariotsolutions.nfc.plugin/www/phonegap-nfc.js (18)
D/CordovaActivity(17325): onMessage(spinner,stop)
ADB output when I scan a card. Seems to pause the app at matched single TECH for some reason, and then reloads Cordova running the onDeviceReady again.
D/NativeNfcTag( 769): Check NDEF Failed - status = 255
D/NativeNfcTag( 769): Check NDEF Failed - status = 255
D/NfcDispatcher( 769): dispatch tag: TAG: Tech [android.nfc.tech.MifareClassic, android.nfc.tech.NfcA, android.nfc.tech.NdefFormatable] message: null
I/ActivityManager( 512): START u0 {flg=0x10008000 cmp=com.android.nfc/.NfcRootActivity (has extras)} from pid 769
D/dalvikvm( 512): GC_FOR_ALLOC freed 564K, 15% free 18611K/21744K, paused 145ms, total 145ms
D/dalvikvm( 512): GC_FOR_ALLOC freed 283K, 15% free 18573K/21744K, paused 144ms, total 144ms
I/NfcDispatcher( 769): matched single TECH
D/CordovaActivity(17325): Paused the application!
D/CordovaWebView(17325): Handle the pause
D/NfcPlugin(17325): onPause Intent { }
D/NfcPlugin(17325): stopNfc
D/NfcDispatcher( 769): Set Foreground Dispatch
D/CordovaLog(17325): file:///android_asset/www/js/index.js: Line 48 : -- pause event fired --
I/chromium(17325): [INFO:CONSOLE(48)] "-- pause event fired -- ", source: file:///android_asset/www/js/index.js (48)
I/ActivityManager( 512): START u0 {act=android.nfc.action.TECH_DISCOVERED cmp=com.widgapp.NFC_ReTAG_FREE/com.widgapp.NFC_ReTag_dispatch_other (has extras)} from pid 769
V/receiver Tag discovered: (15520): TAG: Tech [android.nfc.tech.MifareClassic, android.nfc.tech.NfcA, android.nfc.tech.NdefFormatable] mifare tagid: 8A0924F9
I/ActivityManager( 512): START u0 {flg=0x4000000 cmp=com.widgapp.NFC_ReTAG_FREE/.automode (has extras)} from pid 15520
D/NfcDispatcher( 769): Set Foreground Dispatch
D/NfcDispatcher( 769): Set Foreground Dispatch
D/dalvikvm(15520): GC_CONCURRENT freed 224K, 4% free 7810K/8072K, paused 4ms+3ms, total 42ms
W/InputMethodManagerService( 512): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#429d7908 attribute=null, token = android.os.BinderProxy#427e6bf8
I/CordovaLog(17325): Changing log level to DEBUG(3)
I/CordovaLog(17325): Found start page location: index.html
D/Whitelist(17325): Unlimited access to network resources
D/CordovaActivity(17325): Resuming the App
D/CordovaActivity(17325): CB-3064: The errorUrl is null
D/NfcPlugin(17325): onResume Intent { }
D/NfcDispatcher( 769): Set Foreground Dispatch
D/CordovaLog(17325): file:///android_asset/www/js/index.js: Line 41 : -- resume event fired --
I/chromium(17325): [INFO:CONSOLE(41)] "-- resume event fired -- ", source: file:///android_asset/www/js/index.js (41)
D/NativeNfcTag( 769): Tag lost, restarting polling loop
D/dalvikvm(15037): GC_CONCURRENT freed 475K, 7% free 8271K/8824K, paused 3ms+4ms, total 40ms
D/dalvikvm(15037): WAIT_FOR_CONCURRENT_GC blocked 30ms
D/Finsky (15037): [1] 5.onFinished: Installation state replication succeeded.
Any help would be appreciated.
The reason it's not working is because the application is looking for an NDEF tag, but you're scanning a non-NDEF tag.
D/NativeNfcTag( 769): Check NDEF Failed - status = 255
D/NativeNfcTag( 769): Check NDEF Failed - status = 255
D/NfcDispatcher( 769): dispatch tag: TAG: Tech [android.nfc.tech.MifareClassic, android.nfc.tech.NfcA, android.nfc.tech.NdefFormatable] message: null
To read a non-NDEF tag, you'll need to add nfc.addNdefFormatableListener or nfc.addTagDiscoveredListener. You can use one event handler, e.g. app.onNFC, for multiple tag types.
You could also use NXP Tag Writer to write a message to the tag, which will also format it as NDEF.
Note that devices with the Broadcom NFC chipset won't read Mifare Classic tags, so you might get errors about non-NDEF messages even when reading a NDEF message on a Mifare Classic tag.
My Nexus 7 (original version) has the NXP NFC chipset. Your code worked, after I removed console.log('nfcEvent '+JSON.stringify(nfcEvent));. The event can't be stringified because of circular references. I think the second generation Nexus 7 uses the Broadcom NFC chipset.

Categories

Resources