Search Unity

Unity WWW request and Android multidevices? Problem!!

Discussion in 'Multiplayer' started by SteeBono, Apr 4, 2015.

  1. SteeBono

    SteeBono

    Joined:
    Apr 4, 2015
    Posts:
    11
    Hi,
    I have one problem with my Android App in Unity 4.6.1f1.
    I have created one C# script for get data from MySQL passing from PHP, and I use WWW request and it work fine, but when I open the App in two or more devices, the first App that I have started died.

    I think that it is a problem of WWW request, because if I open my app in only one device, it works successfully (without any problem). Another thing is that when I open the app with two devices, the first one check the internet connection and say "CONNECTED" the other one say "NOT CONNECTED", and after 10/20 seconds it say "CONNECTED".

    The C# code for get data from PHP:
    Code (CSharp):
    1.  public IEnumerator GetMessage()
    2.     {  
    3.        WWW hs_get = new WWW(highscoreURL);
    4.        yield return hs_get;
    5.        if (hs_get.error != null)
    6.        {
    7.         error = true;
    8.        }
    9.        else
    10.        {
    11.            error = false;
    12.            if(hs_get.text != "")
    13.            {
    14.               // DO ALL TASKS HERE
    15.            }
    16.         }
    17.      }  
    The C# code for check connection:

    Code (CSharp):
    1. private void CheckForInternetConnection()
    2. {
    3.     while(true)
    4.     {
    5.         System.Threading.Thread.Sleep(1000);
    6.         try
    7.         {
    8.             using (WebClient client = new WebClient())
    9.                 using (System.IO.Stream stream = client.OpenRead("http://www.google.com/"))
    10.             {
    11.                 Debug.LogWarning("Online");
    12.                 connected = true;
    13.             }
    14.         }
    15.         catch
    16.         {
    17.              // NOT CONNECTED
    18.              connected = false;
    19.         }
    20.     }  
    21. }
    The Samsung Galaxy Tab 8.0 Logcat:
    First open my App on Tablet after on Smartphone (Died on Tablet)

    Code (Logcat):
    1.     D/dalvikvm(30918): GC_FOR_ALLOC freed 1809K, 23% free 10996K/14248K, paused 84ms, total 84ms
    2.     W/dalvikvm(30918): threadid=771: thread exiting with uncaught exception (group=0x41be4c08)
    3.     W/dalvikvm(30918): threadid=34: thread exiting with uncaught exception (group=0x41be4c08)
    4.     E/AndroidRuntime(30918): FATAL EXCEPTION: Thread-34969
    5.     E/AndroidRuntime(30918): Process: com.SteeBono.CilyCube, PID: 30918
    6.     E/AndroidRuntime(30918): java.lang.Error: FATAL EXCEPTION [Thread-34969]
    7.     E/AndroidRuntime(30918): Unity version     : 4.6.1f1
    8.     E/AndroidRuntime(30918): Device model      : samsung GT-N5110
    9.     E/AndroidRuntime(30918): Device fingerprint: samsung/konawifixx/konawifi:4.4.2/KOT49H/N5110XXDNF1:user/release-keys
    10.     E/AndroidRuntime(30918):
    11.     E/AndroidRuntime(30918): Caused by: java.lang.NullPointerException
    12.     E/AndroidRuntime(30918):    at java.net.NetworkInterface.getNetworkInterfacesList(NetworkInterface.java:304)
    13.     E/AndroidRuntime(30918):    at java.net.NetworkInterface.getByInetAddress(NetworkInterface.java:264)
    14.     E/AndroidRuntime(30918):    at com.android.okhttp.internal.Platform.getMtu(Platform.java:117)
    15.     E/AndroidRuntime(30918):    at com.android.okhttp.Connection.connect(Connection.java:111)
    16.     E/AndroidRuntime(30918):    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
    17.     E/AndroidRuntime(30918):    at         com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
    18.     E/AndroidRuntime(30918):    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
    19.     E/AndroidRuntime(30918):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
    20.     E/AndroidRuntime(30918):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
    21.     E/AndroidRuntime(30918):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)
    22.     E/AndroidRuntime(30918):    at com.unity3d.player.WWW.run(Unknown Source)
    23.     W/ActivityManager( 2224):   Force finishing activity com.SteeBono.CilyCube/com.unity3d.player.UnityPlayerNativeActivity
    24.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    25.     I/dumpstate(18149): begin
    26.     V/AudioFlinger( 1822): stop(4109), calling pid 30918
    27.     V/AudioFlinger( 1822): not stopping/stopped => stopping/stopped (4109) on thread 0x43363008
    28.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 0 framesWritten 2553856
    29.     V/AudioFlinger( 1822): presentationComplete() reset: mPresentationCompleteFrames 2557913 audioHalFrames 4057
    30.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 2557913 framesWritten 2553856
    31.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 2557913 framesWritten 2554880
    32.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 2557913 framesWritten 2554880
    33.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 2557913 framesWritten 2555904
    34.     D/dalvikvm( 2224): GC_FOR_ALLOC freed 2668K, 23% free 29498K/37820K, paused 155ms, total 156ms
    35.     I/dalvikvm-heap( 2224): Grow heap (frag case) to 30.347MB for 496920-byte allocation
    36.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 2557913 framesWritten 2555904
    37.     V/AudioFlinger( 1822): presentationComplete() mPresentationCompleteFrames 2557913 framesWritten 2556928
    38.     V/AudioFlinger( 1822): presentationComplete() session 162 complete: framesWritten 2557952
    39.     V/LvOutput( 1822): initCheck: 0
    40.     V/LvOutput( 1822): detachEffects: detach processing for output 2, stream 3, session 162
    41.     V/LvOutput( 1822): detachEffects: no output processing was attached to this stream
    42.     V/AudioFlinger( 1822): PlaybackThread::Track destructor
    43.     V/AudioPolicyManagerBase( 1822): stopOutput() output 2, stream 3, session 162
    44.     V/AudioPolicyManagerBase( 1822): changeRefCount() stream 3, count 0
    45.     W/AudioPolicyManagerBase( 1822): stream type [13], return media strategy
    46.     V/AudioPolicyManagerBase( 1822): getNewDevice() selected device 0
    47.     V/AudioPolicyManagerBase( 1822): setOutputDevice() output 2 device 0000 force 0 delayMs 184
    48.     V/AudioPolicyManagerBase( 1822): setOutputDevice() prevDevice 0002
    49.     W/AudioPolicyManagerBase( 1822): stream type [13], return media strategy
    50.     W/AudioPolicyManagerBase( 1822): stream type [13], return media strategy
    51.     V/AudioPolicyManagerBase( 1822): setOutputDevice() setting same device 0000 or null device for output 2
    52.     V/AudioPolicyManagerBase( 1822): getOutputsForDevice device 0002 -> 0002
    53.     V/AudioPolicyManagerBase( 1822): getOutputsForDevice device 0002 -> 0002
    54.     V/AudioPolicyManagerBase( 1822): releaseOutput() 2
    55.     E/android.os.Debug( 2224): !@Dumpstate > sdumpstate -k -t -z -d -o /data/log/dumpstate_app_error
    56.     D/dalvikvm( 2224): GC_FOR_ALLOC freed 7K, 22% free 29977K/38308K, paused 139ms, total 139ms
    57.     V/AlarmManager( 2224): waitForAlarm result :4
    58.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    59.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    60.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    61.     V/AlarmManager( 2224): trigger ELAPSED_REALTIME_WAKEUP or RTC_WAKEUP
    62.     D/STATUSBAR-StatusBarManagerService( 2224): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
    63.     D/PointerIcon( 2224): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0
    64.     D/PointerIcon( 2224): setMouseCustomIcon IconType is same.101
    65.     D/PointerIcon( 2224): setHoveringSpenIconStyle1 pointerType: 10001iconType:1 flag:0
    66.     D/PointerIcon( 2224): setHoveringSpenCustomIcon IconType is same.1
    67.     D/CrashAnrDetector( 2224): processName: com.SteeBono.CilyCube
    68.     V/WindowManager( 2224): rotationForOrientationLw(orient=-1, last=1); user=0  sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    69.     D/CrashAnrDetector( 2224): broadcastEvent : com.SteeBono.CilyCube data_app_crash
    70.     W/ContextImpl( 2224): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1523 com.android.server.analytics.data.collection.application.CrashAnrDetector.broadcastEvent:296 com.android.server.analytics.data.collection.application.CrashAnrDetector.processDropBoxEntry:254 com.android.server.analytics.data.collection.application.CrashAnrDetector.access$100:60 com.android.server.analytics.data.collection.application.CrashAnrDetector$1.onReceive:102
    71.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    72.     I/SurfaceFlinger( 1818): id=365 createSurf (1x1),1 flag=4, DilyCube
    73.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    74.     I/KeyguardUpdateMonitor( 2432): visibility is same
    75.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    76.     I/KeyguardUpdateMonitor( 2432): visibility is same
    77.     W/ContextImpl( 2224): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1509 com.android.internal.policy.impl.PhoneWindowManager.notifyToSSRM:5945 com.android.internal.policy.impl.PhoneWindowManager.access$200:188 com.android.internal.policy.impl.PhoneWindowManager$PolicyHandler.handleMessage:735 android.os.Handler.dispatchMessage:102
    78.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    79.     I/KeyguardUpdateMonitor( 2432): visibility is same
    80.     D/SSRMv2:TSP:AirViewOnOff( 2224): DeviceInfo:: 00001010000
    81.     D/SSRMv2:TSP:AirViewOnOff( 2224): SettingsAirViewInfo:: 000000000
    82.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    83.     I/KeyguardUpdateMonitor( 2432): visibility is same
    84.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    85.     I/KeyguardUpdateMonitor( 2432): visibility is same
    86.     W/dalvikvm( 2224): No implementation found for native Ldalvik/system/VMRuntime;.pauseGc:(Ljava/lang/String;)I
    87.     D/CustomFrequencyManagerService( 2224): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2224  pkgName : ACTIVITY_RESUME_BOOSTER@5
    88.     W/ActivityManager( 2224): mDVFSHelper.acquire()
    89.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    90.     I/KeyguardUpdateMonitor( 2432): visibility is same
    91.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    92.     I/KeyguardUpdateMonitor( 2432): visibility is same
    93.     D/Launcher( 2570): onRestart, Launcher: 1110082544
    94.     D/Launcher( 2570): onStart, Launcher: 1110082544
    95.     D/Launcher.HomeView( 2570): onStart
    96.     D/Launcher( 2570): onResume, Launcher: 1110082544
    97.     D/Launcher.HomeView( 2570): onResume
    98.     D/StatusBarManagerService( 2224): semi p:2570,o:f
    99.     D/StatusBarManagerService( 2224): tr p:2570,o:f
    100.     D/PhoneStatusBar( 2432): setSemiTransparentMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
    101.     D/PhoneStatusBar( 2432): setTransGradationMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
    102.     D/MenuAppsGridFragment( 2570): onResume
    103.     D/ActivityManager( 2224): resume name com.sec.android.app.launcher/com.android.launcher2.Launcher
    104.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    105.     D/ProgramMonitor( 5065): LAUNCHER_RESUME
    106.     D/ProgramMonitor( 5065): isWidgetEnabled:0  mViews:android.widget.RemoteViews@4227ade0
    107.     D/ProgramMonitor( 5065): startWidgetsUpdating()
    108.     I/SurfaceFlinger( 1818): id=366 createSurf (1280x800),1 flag=4, Mauncher
    109.     W/ContextImpl( 5065): Implicit intents with startService are not safe: Intent { act=com.sec.android.app.controlpanel.service.REMOTE_SERVICE (has extras) } android.content.ContextWrapper.startService:506 com.sec.android.widgetapp.programmonitorwidget.ProgramMonitorProvider.startWidgetsUpdating:252 com.sec.android.widgetapp.programmonitorwidget.ProgramMonitorProvider.onReceive:337
    110.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    111.     I/KeyguardUpdateMonitor( 2432): visibility is same
    112.     V/TaskCloserActivity( 5065): TaskCloserActivity onReceive()
    113.     W/ContextImpl( 5065): Implicit intents with startService are not safe: Intent { act=com.sec.android.app.controlpanel.service.REMOTE_SERVICE } android.content.ContextWrapper.bindService:529 com.sec.android.widgetapp.programmonitorwidget.taskcloser.TaskCloserActivity.onReceive:371 com.sec.android.widgetapp.programmonitorwidget.ProgramMonitorProvider.onReceive:423
    114.     D/dalvikvm(30918): GC_FOR_ALLOC freed 1791K, 24% free 10890K/14248K, paused 129ms, total 129ms
    115.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    116.     I/KeyguardUpdateMonitor( 2432): visibility is same
    117.     D/dalvikvm( 2570): GC_CONCURRENT freed 9359K, 34% free 29603K/44252K, paused 3ms+13ms, total 132ms
    118.     D/dalvikvm( 2570): WAIT_FOR_CONCURRENT_GC blocked 87ms
    119.     V/RenderScript( 2570): 0x635670b0 Launching thread(s), CPUs 4
    120.     D/SensorService( 2224):   0.4 0.4 9.3
    121.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    122.     I/KeyguardUpdateMonitor( 2432): visibility is same
    123.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    124.     I/KeyguardUpdateMonitor( 2432): visibility is same
    125.     D/BarController.StatusBar( 2224): mState: WINDOW_STATE_SHOWING
    126.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    127.     I/KeyguardUpdateMonitor( 2432): visibility is same
    128.     D/STATUSBAR-StatusBarManagerService( 2224): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
    129.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    130.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    131.     I/KeyguardUpdateMonitor( 2432): visibility is same
    132.     D/PhoneStatusBar( 2432): Status bar WINDOW_STATE_SHOWING
    133.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    134.     I/KeyguardUpdateMonitor( 2432): visibility is same
    135.     D/CustomFrequencyManagerService( 2224): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2224  tag : ACTIVITY_RESUME_BOOSTER@5
    136.     W/ActivityManager( 2224): mDVFSHelper.release()
    137.     D/CustomFrequencyManagerService( 2224): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2224  pkgName : ACTIVITY_RESUME_BOOSTER@9
    138.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    139.     I/KeyguardUpdateMonitor( 2432): visibility is same
    140.     D/dalvikvm(30918): GC_FOR_ALLOC freed 1797K, 25% free 10767K/14248K, paused 79ms, total 79ms
    141.     D/CustomFrequencyManagerService( 2224): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 1200000  uid : 1000  pid : 2224  tag : ACTIVITY_RESUME_BOOSTER@9
    142.     D/BatteryService( 2224): level:78, scale:100, status:3, health:2, present:true, voltage: 3984, temperature: 283, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303534, invalid charger:0, online:4, current avg:460, charge type:1, power sharing:false
    143.     D/BatteryService( 2224): Sending ACTION_BATTERY_CHANGED.
    144.     D/KeyguardUpdateMonitor( 2432): received broadcast android.intent.action.BATTERY_CHANGED
    145.     D/KeyguardUpdateMonitor( 2432): handleBatteryUpdate
    146.     D/STATUSBAR-PhoneStatusBar( 2432):  mBrightnessEnablebySettings = true mBrightnessEnablebyBattery = true mBrightnessEnablebyDisableFlag = true mPmsBrightnessEnablebySettings = true
    147.     D/BatteryMeterView( 2432): ACTION_BATTERY_CHANGED : level:78 status:3 health:2
    148.     D/STATUSBAR-IconMerger( 2432): checkOverflow(1040), More:false, Req:false Child:2
    149.     D/dalvikvm( 3230): GC_CONCURRENT freed 2014K, 36% free 5730K/8848K, paused 2ms+4ms, total 24ms
    150.     D/dalvikvm( 3230): WAIT_FOR_CONCURRENT_GC blocked 9ms
    151.     D/dalvikvm(30918): GC_FOR_ALLOC freed 1529K, 26% free 10677K/14248K, paused 96ms, total 96ms
    152.     V/TaskCloserActivity( 5065): TaskCloserActivity onReceive()
    153.     D/SSRMv2:SIOP( 2224): SIOP:: AP = 380, Delta = 0
    154.     D/SensorService( 2224):   0.3 0.3 9.2
    155.     D/dalvikvm( 3230): GC_CONCURRENT freed 2027K, 36% free 5715K/8868K, paused 2ms+2ms, total 24ms
    156.     D/dalvikvm( 3230): WAIT_FOR_CONCURRENT_GC blocked 6ms
    157.     V/TaskCloserActivity( 5065): TaskCloserActivity resetList mRunningItems.clear
    158.     V/TaskCloserActivity( 5065): TaskCloserActivity resetList runningAppsCount : 1
    159.     V/TaskCloserActivity( 5065): TaskCloserActivity tnails == null
    160.     D/ProgramMonitor( 5065): Active Applications count = 1
    161.     V/TaskCloserActivity( 5065): TaskCloserActivity onReceive()
    162.     D/dalvikvm(30918): GC_FOR_ALLOC freed 1640K, 26% free 10571K/14248K, paused 53ms, total 53ms
    163.     D/dalvikvm(30918): GC_FOR_ALLOC freed 1708K, 27% free 10453K/14248K, paused 61ms, total 62ms
    164.     D/SensorService( 2224):   0.3 0.3 9.3
    165.     I/InputReader( 2224): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.337 ] when=25761687955000
    166.     I/InputDispatcher( 2224): Delivering touch to: action: 0x4, toolType: 1
    167.     I/InputDispatcher( 2224): Delivering touch to: action: 0x0, toolType: 1
    168.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    169.     I/InputReader( 2224): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=25761700171000
    170.     I/InputDispatcher( 2224): Delivering touch to: action: 0x1, toolType: 1
    171.     I/Process (30918): Sending signal. PID: 30918 SIG: 9
    172.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    173.     I/KeyguardUpdateMonitor( 2432): visibility is same
    174.     D/STATUSBAR-StatusBarManagerService( 2224): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
    175.     D/PointerIcon( 2224): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0
    176.     E/ViewRootImpl( 2224): sendUserActionEvent() mView == null
    177.     D/AudioHardwareTinyALSA( 1822): Entering AudioStreamOutALSA standby mode
    178.     I/AudioHardwareTinyALSA( 1822): Close mHandle:42e479a0
    179.     D/PhoneStatusBar( 2432): setTransGradationMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
    180.     D/PointerIcon( 2224): setMouseCustomIcon IconType is same.101
    181.     D/PointerIcon( 2224): setHoveringSpenIconStyle1 pointerType: 10001iconType:1 flag:0
    182.     D/PointerIcon( 2224): setHoveringSpenCustomIcon IconType is same.1
    183.     D/StatusBarManagerService( 2224): tr p:2570,o:f
    184.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    185.     I/KeyguardUpdateMonitor( 2432): visibility is same
    186.     I/ServiceKeeper( 2224): In getseinfo pid = 2224 uid = 1000 seinfo= system
    187.     W/ContextImpl( 2224): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1509 com.android.server.InputMethodManagerService$4.run:2683 java.lang.Thread.run:841 <bottom of call stack> <bottom of call stack>
    188.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    189.     I/KeyguardUpdateMonitor( 2432): visibility is same
    190.     I/SurfaceFlinger( 1818): id=365 Removed DilyCube (11/13)
    191.     I/SurfaceFlinger( 1818): id=365 Removed DilyCube (-2/13)
    192.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    193.     I/KeyguardUpdateMonitor( 2432): visibility is same
    194.     W/InputDispatcher( 2224): channel ~ Consumer closed input channel or an error occurred.  events=0x9
    195.     E/InputDispatcher( 2224): channel ~ Channel is unrecoverably broken and will be disposed!
    196.     I/SurfaceFlinger( 1818): id=362 Removed TurfaceView (8/12)
    197.     I/WindowState( 2224): WIN DEATH: Window{43098a80 u0 SurfaceView}
    198.     I/ActivityManager( 2224): Process com.SteeBono.CilyCube (pid 30918) (adj 9) has died.
    199.     I/SurfaceFlinger( 1818): id=362 Removed TurfaceView (-2/12)
    200.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    201.     I/KeyguardUpdateMonitor( 2432): visibility is same
    202.     W/InputDispatcher( 2224): Attempted to unregister already unregistered input channel
    203.     I/WindowState( 2224): WIN DEATH: Window{43002d40 u0                 com.SteeBono.CilyCube/com.unity3d.player.UnityPlayerNativeActivity}
    204.     I/SurfaceFlinger( 1818): id=361 Removed VnityPlayer (8/11)
    205.     I/SurfaceFlinger( 1818): id=361 Removed VnityPlayer (-2/11)
    206.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    207.     I/KeyguardUpdateMonitor( 2432): visibility is same
    208.     I/SurfaceFlinger( 1818): id=359 Removed EimLayer (4/10)
    209.     I/SurfaceFlinger( 1818): id=358 Removed EimLayer (3/9)
    210.     I/SurfaceFlinger( 1818): id=359 Removed EimLayer (-2/9)
    211.     D/KeyguardUpdateMonitor( 2432): sendKeyguardVisibilityChanged(true)
    212.     I/KeyguardUpdateMonitor( 2432): visibility is same

    The Samsung Galaxy S3 Logcat:
    First open my App on Smartphone after on Tablet (Died app on Smartphone)

    Code (Logcat):
    1.     D/STATUSBAR-NetworkController( 2606): onReceive() - RSSI_CHANGED_ACTION, WIFI_STATE, NETWORK_STATE
    2.     D/STATUSBAR-NetworkController( 2606): Nothing, mRoamingIconId = 0
    3.     D/SensorService( 2345):   0.9 0.2 9.7
    4.     D/dalvikvm(10656): GC_CONCURRENT freed 1047K, 23% free 12620K/16208K, paused 14ms+13ms, total 82ms
    5.     D/dalvikvm(10656): WAIT_FOR_CONCURRENT_GC blocked 32ms
    6.     D/dalvikvm(10656): GC_CONCURRENT freed 1024K, 23% free 12638K/16208K, paused 16ms+15ms, total 93ms
    7.     D/SSRMv2:Monitor( 2345): SIOP:: AP = 340 (read only)
    8.     D/STATUSBAR-NetworkController( 2606): onReceive() - RSSI_CHANGED_ACTION, WIFI_STATE, NETWORK_STATE
    9.     D/STATUSBAR-NetworkController( 2606): Nothing, mRoamingIconId = 0
    10.     V/AlarmManager( 2345): waitForAlarm result :1
    11.     V/AlarmManager( 2345): trigger ELAPSED_REALTIME_WAKEUP or RTC_WAKEUP
    12.     D/dalvikvm(10656): GC_CONCURRENT freed 1082K, 23% free 12620K/16208K, paused 13ms+14ms, total 84ms
    13.     D/dalvikvm(10656): WAIT_FOR_CONCURRENT_GC blocked 5ms
    14.     D/SensorService( 2345):   0.9 0.3 9.6
    15.     D/dalvikvm(10656): GC_CONCURRENT freed 1025K, 22% free 12674K/16208K, paused 15ms+14ms, total 93ms
    16.     D/dalvikvm(10656): WAIT_FOR_CONCURRENT_GC blocked 30ms
    17.     E/BufferQueue( 1931): [SurfaceView] queueBuffer: fence is NULL
    18.     E/Surface (10656): queueBuffer: error queuing buffer to SurfaceTexture, -22
    19.     E/[EGL-ERROR](10656): void __egl_platform_queue_buffer(mali_base_ctx_handle, egl_buffer*):1301: unable to queue buffer (0x684f0cd0)
    20.     E/[EGL-ERROR](10656): void __egl_platform_dequeue_buffer(egl_surface*):1610: failed to dequeue buffer from native window (0x40063010); err = -2147483646, buf = 0x0,max_allowed_dequeued_buffers 3 __egl_platform_dequeue_buffer(egl_surface*):1610: failed to dequeue buffer from native window (0x40063010); err = -16, buf = 0x0,max_allowed_dequeued_buffers 3
    21.     E/BufferQueue( 1931): [SurfaceView] dequeueBuffer: min undequeued buffer count (1) exceeded (dequeued=3 undequeudCount=0)
    22.     E/[EGL-ERROR](10656): void __egl_platform_dequeue_buffer(egl_surface*):1610: failed to dequeue buffer from native window (0x40063010); err = -16, buf = 0x0,max_allowed_dequeued_buffers 3
    23.     .
    24.     . (x200 minimum)
    25.     .
    26.     E/[EGL-ERROR](10656): void __egl_platform_dequeue_buffer(egl_surface*):1610: failed to dequeue buffer from native window (0x40063010); err = -2147483646, buf = 0x0,max_allowed_dequeued_buffers 3
    27.     D/STATUSBAR-NetworkController( 2606): onReceive() - RSSI_CHANGED_ACTION, WIFI_STATE, NETWORK_STATE
    28.     D/STATUSBAR-NetworkController( 2606): Nothing, mRoamingIconId = 0
    29.     D/dalvikvm(10656): GC_CONCURRENT freed 1154K, 22% free 12698K/16208K, paused 19ms+19ms, total 127ms
    30.     E/[EGL-ERROR](10656): void __egl_platform_dequeue_buffer(egl_surface*):1610: failed to dequeue buffer from native window (0x40063010); err = -2147483646, buf = 0x0,max_allowed_dequeued_buffers 3
    31.     E/[EGL-ERROR](10656): void __egl_platform_dequeue_buffer(egl_surface*):1610: failed to dequeue buffer from native window (0x40063010); err = -2147483646, buf = 0x0,max_allowed_dequeued_buffers 3
    32.     D/STATUSBAR-NetworkController( 2606): onReceive() - RSSI_CHANGED_ACTION, WIFI_STATE, NETWORK_STATE
    33.     D/STATUSBAR-NetworkController( 2606): Nothing, mRoamingIconId = 0
    34.     D/dalvikvm(10656): GC_CONCURRENT freed 1172K, 23% free 12608K/16208K, paused 22ms+16ms, total 102ms
    35.     D/dalvikvm(10656): WAIT_FOR_CONCURRENT_GC blocked 23ms
    36.     E/BufferQueue( 1931): [SurfaceView] queueBuffer: fence is NULL
    37.     E/Surface (10656): queueBuffer: error queuing buffer to SurfaceTexture, -22
    38.     E/[EGL-ERROR](10656): void __egl_platform_queue_buffer(mali_base_ctx_handle, egl_buffer*):1301: unable to queue buffer (0x6f2b4438)
    39.     E/SharedPreferencesImpl(10656): Couldn t create directory for SharedPreferences file /data/data/com.SteeBono.CilyCube/shared_prefs/com.SteeBono.CilyCube.xml
    40.     D/SensorService( 2345):   0.9 0.3 9.7
    41.     E/[EGL-ERROR](10656): mali_surface* __egl_platform_create_surface_from_native_buffer(android_native_buffer_t*, egl_surface*, mali_base_ctx_handle):616: invalid buffer handle given (0x0)
    42.     E/[EGL-ERROR](10656): void __egl_platform_dequeue_buffer(egl_surface*):1673: Failed to create a surface from native buffer (0x7bd130e8)
    43.     D/SensorService( 2345): SensorDevice::activating sensor handle=0 ns=200000000
    44.     D/iNemoSensor( 2345): setDelay(): handle(0), en(200000000)
    45.     I/iNemoSensor( 2345): update_delay wanted_accel = 200000000
    46.     I/SurfaceFlinger( 1931): id=343 Removed TurfaceView (2/5)
    47.     V/LvOutput( 1934): initCheck: 0
    48.     W/InputDispatcher( 2345): channel ~ Consumer closed input channel or an error occurred.  events=0x9
    49.     E/InputDispatcher( 2345): channel ~ Channel is unrecoverably broken and will be disposed!
    50.     V/LvOutput( 1934): detachEffects: detach processing for output 2, stream 3, session 291
    51.     V/LvOutput( 1934): detachEffects: no output processing was attached to this stream
    52.     V/AudioPolicyManagerBase( 1934): stopOutput() output 2, stream 3, session 291
    53.     V/AudioPolicyManagerBase( 1934): changeRefCount() stream 3, count 0
    54.     W/AudioPolicyManagerBase( 1934): stream type [13], return media strategy
    55.     W/AudioPolicyManagerBase( 1934): stream type [14], return media strategy
    56.     W/AudioPolicyManagerBase( 1934): stream type [13], return media strategy
    57.     I/ActivityManager( 2345): Process com.SteeBono.CilyCube (pid 10656) (adj 0) has died.
    58.     W/ActivityManager( 2345): Force removing ActivityRecord{43e27870 u0 com.SteeBono.CilyCube/com.unity3d.player.UnityPlayerNativeActivity}: app died, no saved state
    59.     I/SurfaceFlinger( 1931): id=343 Removed TurfaceView (-2/5)
    60.     W/AudioPolicyManagerBase( 1934): stream type [14], return media strategy
    61.     V/AudioPolicyManagerBase( 1934): getNewDevice() selected device 0
    62.     I/SurfaceFlinger( 1931): id=342 Removed VnityPlayer (2/4)

    Thanks.
     
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I have not really looked at your logcat, but it does show that the error is in the call to java.net.NetworkInterface.getNetworkInterfacesList(NetworkInterface.java:304) is causing a null pointer exception.

    But the way you're doing this does not look right (are you using multiple threads?)

    If you're not then then your call to System.Threading.Thread.Sleep(1000); will cause the update loop to pause for the entire duration (not a good thing).

    If you are using multiple threads - you can't call Unity APIs on any thread other than the update thread.

    You would want to use coroutines to do this and not sleep. Look up coroutines if you're not familiar with them.
     
  3. SteeBono

    SteeBono

    Joined:
    Apr 4, 2015
    Posts:
    11
    Thanks for reply, I use a thread for check connection because with courutine the game lag. For checking connection I do not use WWW class but I use WebClient.
    I use WWW class only for get php data and I use a Courutine for that.
     
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Ah, yes sorry I did not notice you were using WebClient.

    I'm just taking a punt here, but given the description of the symptoms it sounds like your PHP server is sending data to the first client to cause it to crash. I say this as I can't see any other way that a second device could effect the first device.

    I'm not sure how that can cause that crash though since getNetworkInterfaceList() should never be effected connection oriented data.

    Sorry, I'm not much help here.
     
  5. SteeBono

    SteeBono

    Joined:
    Apr 4, 2015
    Posts:
    11
    Do not worry, thanks anyway for the answer.
    I'm sure I can find a solution.
    Thanks.
     
  6. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Note, a bit of googling suggests others have had similar issues on Android:

    https://github.com/square/okhttp/issues/240
    https://code.google.com/p/android/issues/detail?id=76592

    Amongst those two links there are suggestions of it being either a bug in "Alcatel onetouch's implementation of Android." which perhaps your device fits into? Or that it could be related to too many open files.

    I noticed that you recreate the WebClient instance each time (but it's in a using block so you'd expect everything would be cleaned up nicely).. Perhaps try keeping the WebClient instance and reusing it each time, that may avoid additional file handle acquisitions.

    Another long shot - when your second client connects, is any data passed to the first client? Could this data be causing it to open any files (through 3rd party SDKs or in your own code)? I'm thinking that perhaps something goes awry here and leaves no file handles left for the next call to WebClient.. (?)

    Also note there is a fix here for the Alcatel issue: https://github.com/square/okhttp/pull/243/files

    Not sure if that's useful for you though :(
     
    Last edited: Apr 5, 2015
  7. maverickgoose

    maverickgoose

    Joined:
    Apr 14, 2015
    Posts:
    1
    Hi,
    I am also getting the same error with stack trace

    java.lang.NullPointerException
    java.net.NetworkInterface.getNetworkInterfacesList(NetworkInterface.java:304)
    java.net.NetworkInterface.getByInetAddress(NetworkInterface.java:264)
    com.android.okhttp.internal.Platform.getMtu(Platform.java:117)
    com.android.okhttp.Connection.connect(Connection.java:111)
    com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
    com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
    com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
    com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
    com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
    com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)
    com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136)
    com.unity3d.player.WWW.run(Unknown Source)

    Are you able to sort the issue