Use ADB, mobile project can't show print log (SOLVED)

Did you bundle a debug version? Does it work if you build and run locally from the editor?

Defold doesn’t have such a naming standard, so I’m curious what your code looks like?

1 Like

On my PC, use Ctrl + B, working right.

this’s my project code

Maybe i need install other software? like Cocos, i must install VS2017.

@Mathias_Westerdahl Hi, i use Object::Function target to main.script file and init function.

In here, this not rigorous, if you are troubled, I am sorry.

The code looks ok, as proven by you mention that it works fine on PC.

How do you install and run the .apk on your Android device?

You don’t need to install any additional tools.

1 Like

I use QQ (Tencent chat software) send my .apk file, remove old app, install and open new app.

Manually all.

You haven’t answered this question. Can you please confirm that you selected Debug in the Android bundle dialog.

Yes, I selected:

Hi, I add a sound compoment on app init function, the sound is right work.

Well I’m really at a loss and I can’t explain why you don’t see the log entries. Have you tried another phone? Can you share the APK?

I use my old phone to test. not show print info, and sound is right again.

This’s test .apk: armv7-android/Mobile game1

I bundled an Android debug version, installed it and ran it with logcat enabled:

11

MALLTM4314:/Users/bjornritzl/Downloads/armv7-android
$ adb install Mobile\ game1/Mobile\ game1.apk 
Success

MALLTM4314:/Users/bjornritzl/Downloads/armv7-android
$ adb logcat -s defold
--------- beginning of system
--------- beginning of main
06-17 07:01:43.255 28940 28980 W defold  : WARNING:CRASH: Number of modules exceeds capacity
06-17 07:01:43.256 28940 28980 I defold  : INFO:DLIB: Log server started on port 40063
06-17 07:01:43.268 28940 28980 I defold  : INFO:ENGINE: Engine service started on port 8001
06-17 07:01:43.268 28940 28980 I defold  : INFO:ENGINE: Defold Engine 1.2.156 (67b68f1)
06-17 07:01:43.279 28940 28980 I defold  : INFO:ENGINE: Loading data from: dmanif:game.dmanifest
06-17 07:01:43.303 28940 28980 I defold  : INFO:ENGINE: Initialised sound device 'default'
06-17 07:01:43.303 28940 28980 I defold  : 
06-17 07:01:43.350 28940 28980 D defold  : DEBUG:SCRIPT: init!
06-17 07:01:43.362 28940 28980 I defold  : INFO:DLIB: SSDP: Started on address 172.19.23.12
06-17 07:01:43.606 28940 28980 E defold  : ERROR:PROFILER: Could not open /proc/stat

As you can see the print() is visible in the log. No idea why it is not working for you.

2 Likes

Can you give me your .apk file?

I want try it. I’m confused too, :sweat_smile:

Sure, here it is:

Mobile game1.apk.zip (6.0 MB)

I can’t get log again, this is my PC show log, has some differences, maybe can help somebody find error:

Administrator@WIN-L4PTHILI1QB MINGW64 ~/Desktop
$ adb logcat -s "defold"
--------- beginning of main
06-18 14:36:35.495  3669  3700 W defold  : WARNING:CRASH: Number of modules exceeds capacity
06-18 14:36:35.498  3669  3700 I defold  : INFO:DLIB: Log server started on port 49350
06-18 14:36:35.524  3669  3700 E defold  : ERROR:DLIB: ../src/dlib/socket.cpp( 278 ): SOCKET: Unknown result code 19
06-18 14:36:35.524  3669  3700 E defold  :
06-18 14:36:35.524  3669  3700 E defold  : ERROR:DLIB: Unable to add broadcast membership for ssdp socket. No network connection? (-1000)
06-18 14:36:35.524  3669  3700 W defold  : WARNING:ENGINE: Unable to create ssdp service (-1)
06-18 14:36:35.524  3669  3700 I defold  : INFO:ENGINE: Engine service started on port 8001
06-18 14:36:35.524  3669  3700 I defold  : INFO:ENGINE: Defold Engine 1.2.156 (67b68f1)
06-18 14:36:35.542  3669  3700 I defold  : INFO:ENGINE: Loading data from: dmanif:game.dmanifest
06-18 14:36:35.582  3669  3700 I defold  : INFO:ENGINE: Initialised sound device 'default'
06-18 14:36:35.582  3669  3700 I defold  :

Now, i want write game programe. let me forget the print function, Defold is good game engine as before.

:heartbeat:Thank you and other frends help! if i has new info about this question, i will back to the topic.

1 Like

Strange that you can’t get it work. I hope it magically solves itself! :slight_smile:

Are you certain it’s the correct .apk you’re running? (e.g. uninstall/reinstall/run the same package name)

If you try to use this script to launch the apk?

2 Likes

No error, No print… :joy:

Administrator@WIN-L4PTHILI1QB MINGW64 ~/Desktop
$ adb logcat -s "defold"
--------- beginning of main
06-18 18:15:24.818 20264 20288 W defold  : WARNING:CRASH: Number of modules exceeds capacity
06-18 18:15:24.820 20264 20288 I defold  : INFO:DLIB: Log server started on port 51258
06-18 18:15:24.846 20264 20288 I defold  : INFO:ENGINE: Engine service started on port 8001
06-18 18:15:24.846 20264 20288 I defold  : INFO:ENGINE: Defold Engine 1.2.156 (67b68f1)
06-18 18:15:24.862 20264 20288 I defold  : INFO:ENGINE: Loading data from: dmanif:game.dmanifest
06-18 18:15:24.899 20264 20288 I defold  : INFO:ENGINE: Initialised sound device 'default'
06-18 18:15:24.899 20264 20288 I defold  :
06-18 18:15:25.055 20264 20288 I defold  : INFO:DLIB: SSDP: Started on address 172.16.8.186

script install log:

Administrator@WIN-L4PTHILI1QB MINGW64 ~/Desktop
$ ./android_deploy.sh gamea.apk
Package name = com.example.todo
Uninstalling com.example.todo
    Success
Installing com.example.todo
    Performing Streamed Install
    Success
Launching com.example.todo
Events injected: 1
## Network stats: elapsed time=35ms (0ms mobile, 0ms wifi, 35ms not connected)
PID=20264
which: no pidcat in (/c/Users/Administrator/AppData/Local/Android/Sdk/platform-tools:/c/Users/Administrator/AppData/Local/Android/Sdk/tools:/c/Users/Administrator/AppData/Local/Android/Sdk/build-tools/29.0.0:/c/Users/Administrator/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Administrator/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Ruby25-x64/bin:/c/Program Files (x86)/AMD APP/bin/x86_64:/c/Program Files (x86)/AMD APP/bin/x86:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/cmd:/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/d/Environment/php:/c/Program Files/nodejs:/c/ProgramData/ComposerSetup/bin:/c/Go/bin:/c/Program Files/MySQL/MySQL Server 8.0/bin:/c/Users/Administrator/.sdkbox/bin:/c/Python27/Scripts:/c/Python27:/c/Users/Administrator/AppData/Roaming/npm:/c/Users/Administrator/AppData/Roaming/Composer/vendor/bin:/d/MongoDB/bin:/e/Code/check:/d/Bandizip:/c/Users/Administrator/go/bin:/d/GoLand 2018.3.4/bin:/c/Users/Administrator/AppData/Local/Android/Sdk/platform-tools:/c/Users/Administrator/AppData/Local/Android/Sdk/tools:/usr/bin/vendor_perl:/usr/bin/core_perl:/e/Code/check)
Using adb logcat
--------- beginning of main
06-18 18:15:06.795  1682  2074 E HwCHRWebMonitor: WebMonitor [mNetWorkIsSuck=0 mUIDIsSuck=]  WebSpeed [WEBSENDSEGS=0  WEBRESENDSEGS=0  WEBRECVSEGS=0  WEBERRSEGS=0  WEBOUTRSTS=0  WEBESTABLISRST=0  WEBRTTDURATION=0  WEBRTTSEGS=0  WEBSRTT=340  WEBSNDDUPACKS=0  SENDSEGS=0  RESENDSEGS=0  RECVSEGS=0  ERRSEGS=0  OUTRSTS=0  ESTABLISRST=0  RTTDURATION=0  RTTSEGS=0  SNDDUPACKS=0  suckTimes=0 recovage_times=0]
06-18 18:15:06.795  1682  2074 E HwCHRWifiRSSIGroupSummery: updateTcpSummery mRSSI:-44  HwCHRWifiRSSIGroup [rssi_index=4, rtt_tcp_packets=1525, rtt_tcp_duration=6827, rtt_lan_duration=4753, rtt_lan_failures=0, rtt_lan_succ=241, rtt_lan_max=137, rtt_lan_min=3,same_area_frequency=0,adjacent_area_frequency=0]
06-18 18:15:06.814  1682  2074 E HwCHRWebMonitor: HwCHRWifiPacketCnt [mTXGood=0, mTXbad=0, mRXGood=0] rssi=-44
06-18 18:15:06.815  1682  2074 E HwCHRWebMonitor: running processName=com.example.todo
06-18 18:15:07.479   674   674 E         : [E/capacity_limit_control] not demo version, not set power control prop!
06-18 18:15:07.485  1682  1682 I TrafficMonitor: expired arrive. level:-1
06-18 18:15:07.485  1682  1682 I TrafficMonitor: during_ms:2004,period_ms:2000
06-18 18:15:07.485  1682  1682 I TrafficMonitor: count:178,rx_sum:0,tx_sum:0,rxBytes:0,during_ms:2004,rx_speed:0.0,tx_speed:0.0,rto:0.0
06-18 18:15:07.491  1682  8569 I SendBroadcastPermission: action:android.intent.action.SIG_STR, mPermissionType:0
06-18 18:15:07.491  1682  1682 I MQoS    : onSignal: mSubId=0,currDataSubID=0
06-18 18:15:07.491  1682  1682 I MQoS    : received cell-signal:5
06-18 18:15:07.496  2150  2222 I HwMobileSignalController: subId:0 phoneType:1 networktype:13 targetClass:3 masterLevel:5 slaveLevel:-1
06-18 18:15:08.329  8160  8160 E wpa_supp: RSSI=-42;LINKSPEED=72;NOISE=9999;FREQUENCY=2412;
06-18 18:15:08.331  1682  2033 E WifiConfigManager: updateConfiguration freq=2412 BSSID=18:e8:**:**:0c:34 RSSI=-42 "MissEvan"WPA_PSK
06-18 18:15:08.351  1682  2085 I HuaweiWifiWatchdogStateMachine: spd good count:0, add sc:0.0, rate:1.0
06-18 18:15:08.351  1682  2085 I HuaweiWifiWatchdogStateMachine: current mHighDataFlowRate = 1.0
06-18 18:15:08.351  1682  2085 I HuaweiWifiWatchdogStateMachine: POta txb txg rxg:0, 1, 0. Lr =0% Totpkt=1
06-18 18:15:08.352  1682  1682 I QosMonitor: queryRtt: rtt_type = 3
06-18 18:15:08.352  1682  1682 I WifiProJNI: ######### GET RTT:3 ########
06-18 18:15:08.352  1682  1682 I WifiProJNI: ######### CMD_QUERY_PKTS ########
06-18 18:15:08.352  1682  2083 I QosMonitor: postEventFromNative: msg=100,arg1=4,arg2=9
06-18 18:15:08.352  1682  2083 W WifiProJNI: poll before: g_monitor_fd =318
06-18 18:15:08.352  1682  2083 I QosMonitor: postEventFromNative: msg=100,arg1=0,arg2=9
06-18 18:15:08.352  1682  2083 W WifiProJNI: poll before: g_monitor_fd =318
06-18 18:15:08.353  1682  1682 I MQoS    : rtt=340,tcp_tx_pkts=4230770,tcp_rx_pkts=4734802
06-18 18:15:08.353  1682  4771 I MQoS    : QOS_level:0(0),DataDisable;use level-0
06-18 18:15:08.354  1682  2085 I HuaweiWifiWatchdogStateMachine: PTcp RTT:0, rtt pkt=0, tcp_rx=0, tcp_tx=0, tcp_reTran=0, rtRate=0
06-18 18:15:08.423   661   661 I cnss-daemon: RTM_NEWNEIGH message received: 28
06-18 18:15:08.423   661   661 E cnss-daemon: Stale or unreachable neighbors, ndm state: 4
06-18 18:15:08.494  1682  1682 I TrafficMonitor: update:rxPkts:0,txPkts:0,rxBytes:0,txBytes:0
06-18 18:15:08.494  1682  1682 I TrafficMonitor: start expired. level:-1
06-18 18:15:08.494  1682  1682 I TrafficMonitor: gettimer:interval=2000
06-18 18:15:09.073  2150  2150 W KeyguardUpdateMonitor: ACTION_BATTERY_CHANGED AMP: 0; Volt: 0
06-18 18:15:09.075  2549  2549 I MsgReceiver: intent action: android.intent.action.BATTERY_CHANGED
06-18 18:15:09.077  2525  2621 W QCNEJ   : |CORE| CNE received unexpected action: android.intent.action.BATTERY_CHANGED
06-18 18:15:09.092  2150  2150 W KeyguardUpdateMonitor: ChargingSpeed  Wattage: -1 ST: 5000000 --> 7500000
06-18 18:15:09.092  2150  2150 I KgBattery: BatteryInfo updated:  2lPc-1
06-18 18:15:09.092  2150  2150 W AppHandler: sendMessage with obj100
06-18 18:15:09.102  2150  2150 W HwLockScreenPanel: refreshBatteryInfo: com.android.keyguard.hwlockscreen.HwSlideUnlockScreen{d5b190a V.E...... ......ID 0,0-720,1280 #7f140401 app:id/root}
06-18 18:15:09.102  2150  2150 W SlideUnlockScreen: updateBatteryAndOwnerInfo showBatteryInfo:
06-18 18:15:09.102  2150  2150 W KgBattery: getCharge info with type: text
06-18 18:15:09.103  2150  2150 W HwLockScreenPanel: Handle message: 100
06-18 18:15:09.301  2150  2150 I NetworkSpeedManagerEx: mIsStop = false
06-18 18:15:09.304  2150  2150 I NetworkSpeedManagerEx: value=0.0speed = 0K/s
06-18 18:15:09.304  2150  2150 I NetworkSpeedManagerEx: refreshSpeed: sreen off, no need to refresh net speed!
06-18 18:15:09.323  2150  2150 I NetworkSpeedManagerEx: mIsStop = false
06-18 18:15:09.327  2150  2150 I NetworkSpeedManagerEx: value=0.0speed = 0K/s
06-18 18:15:09.327  2150  2150 I NetworkSpeedManagerEx: refreshSpeed: sreen off, no need to refresh net speed!
06-18 18:15:09.818  1682  1826 I SendBroadcastPermission: action:android.net.conn.DATA_ACTIVITY_CHANGE, mPermissionType:0
06-18 18:15:09.972  2930  2930 I iMonitor: create: 903001011
06-18 18:15:09.977   659  1095 I logserver: handle_exception_events enter
06-18 18:15:09.982  2930  2930 I iMonitor: send: 903001011
06-18 18:15:09.983  2930  2930 W PTM.PeriodCheckManager: mSendService start
06-18 18:15:09.997  2930  2996 E LogCollectService: illegal eventid
06-18 18:15:10.488   645   645 E Thermal-daemon: [ap] temp_new :30  temp_old :31
......Need more?

Hi all, I have the same issue, no debug printing, even bundled, also tried with adb logcat defold:V *:S , same result. I see this issue was marked as solved, was there ever a return on the solution? Thx.

Sorry for reviving such an old thread but at least there will be an answer now, I found what I had to do here :
For some reason I have to enable the appropriate logging level with

adb shell setprop log.tag.defold VERBOSE

And now when I launch logcat like this

adb logcat -s "defold"

it shows the print debug lines.