Qt for Android debugging issues - android

I have setup a kit in Qt Creator to deploy my applications to Android. Looked at https://wiki.qt.io/Qt_for_Android_known_issues, and ended up with:
Qt Creator 4.3.1
Qt 5.9.1
NDK: r10e
SDK: r25.2.5
I deploy to a tablet running Android 5.1.1.
"Run" Works fine. My applications is deployed, started, and crashes hard. Therefor I'd like to debug, but that does not go so well. Before my app even starts I get the error "Connecting to remote server failed:
Attaching to process 6285 failed"
ADB logcat:
I/Qt ( 5981): qt start
D/houdini ( 5981): [5981] Added shared library /data/data/org.qtproject.example.gui/qt-reserved-files/plugins/bearer/libqandroidbearer.so for ClassLoader by Native Bridge.
D/houdini ( 5981): [5981] Added shared library /data/data/org.qtproject.example.gui/qt-reserved-files/plugins/position/libqtposition_android.so for ClassLoader by Native Bridge.
I/QtPositioning( 5981): Positioning start
I/Qt JAVA ( 5981): DEBUGGER: extra parameters: Bundle[{debug_ping=true, gdbserver_socket=/data/data/org.qtproject.example.gui/debug-socket, qml_debug=true, gdbserver_command=/data/data/org.qtproject.example.gui/lib/libgdbserver.so --multi +/data/data/org.qtproject.example.gui/debug-socket, qmljsdebugger=port:38509,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector, ping_socket=org.qtproject.example.gui.ping_pong_socket}]
I/Qt JAVA ( 5981): DEBUGGER: removing gdb socket /data/data/org.qtproject.example.gui/debug-socket
I/Qt JAVA ( 5981): DEBUGGER: starting /data/data/org.qtproject.example.gui/lib/libgdbserver.so --multi +/data/data/org.qtproject.example.gui/debug-socket
I/Qt JAVA ( 5981): DEBUGGER: gdbserver started
I/Qt JAVA ( 5981): DEBUGGER: waiting for socket at /data/data/org.qtproject.example.gui/debug-socket, attempt 0
W/libgdbserver.so( 6001): type=1400 audit(0.0:13): avc: denied { module_request } for kmod="personality-8" scontext=u:r:untrusted_app:s0 tcontext=u:r:kernel:s0 tclass=system permissive=0
I/Qt JAVA ( 5981): DEBUGGER: waiting for socket at /data/data/org.qtproject.example.gui/debug-socket, attempt 1
I/Qt JAVA ( 5981): DEBUGGER: socket ok
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Debug socket accepted
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
I/Qt JAVA ( 5981): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 5981): DEBUGGER: go to sleep
D/AndroidRuntime( 6008): >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
D/AndroidRuntime( 6008): CheckJNI is OFF
W/art ( 6008): Could not create mount namespace.
W/ ( 6008): Failed to bind-mount /system/lib/x86/cpuinfo as /proc/cpuinfo: Operation not permitted
E/ ( 6008): Cannot create code cache directory ./code_cache: Read-only file system.
I/Build ( 6008): Restore serial number.
D/AndroidRuntime( 6008): Calling main entry com.android.commands.am.Am
I/ActivityManager( 2911): Force stopping org.qtproject.example.gui appid=10080 user=0: from pid 6008
I/ActivityManager( 2911): Killing 5981:org.qtproject.example.gui/u0a80 (adj 0): stop org.qtproject.example.gui
I/libprocessgroup( 2911): Killing pid 6001 in uid 10080 as part of process group 5981
D/ActivityManager( 2911): cleanUpApplicationRecord -- 5981
I/ActivityManager( 2911): Force finishing activity 3 ActivityRecord{1325d u0 org.qtproject.example.gui/org.qtproject.qt5.android.bindings.QtActivity t20}
W/ActivityManager( 2911): Spurious death for ProcessRecord{90e0893 5981:org.qtproject.example.gui/u0a80}, curProc for 5981: null

Try this:
get the installation folder for your app:
adb shell run-as <package name of your app> /system/bin/sh -c pwd
then change the file attributes on that folder:
adb shell run-as <package name of your app> chmod "a+x" <output of previous command>
You can get your package name from the android manifest file. After that, debugging from Qt Creator should work fine - or it did for me.

Related

Unable to see device and events log in DebugView

I'm trying to setup analytics with firebase on my react native app.
I have tried mutiples solutions from different forum like StackOverflow or Github.
Here's what I put in my code :
import analytics from '#react-native-firebase/analytics';
analytics().logEvent('TEST_EVENT');
And here's the solutions I try :
In GoogleService-Info make IS_ANALYTICS_ENABLED become true instead of false
Used the following command to see my events in the debug view:
adb shell setprop debug.firebase.analytics.app .none. //disable
adb shell setprop debug.firebase.analytics.app [app_name] //enable
See the logs with the following commands:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
And here's my logs :
09-08 18:21:23.401 V/FA (26224): Connecting to remote service
09-08 18:21:23.456 D/FA (26224): Connected to remote service
09-08 18:21:23.457 V/FA (26224): Processing queued up service tasks: 1
09-08 18:21:23.469 V/FA-SVC ( 3653): Logging event: origin=app,name=TEST_EVENT,params=Bundle[{ga_event_origin(_o)=app, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-8052166940190804487}]
09-08 18:21:23.488 V/FA-SVC ( 3653): Upload scheduled in approximately ms: 500
09-08 18:21:23.489 V/FA-SVC ( 3653): Unscheduling upload
09-08 18:21:23.490 V/FA-SVC ( 3653): Scheduling upload, millis: 500
09-08 18:21:23.492 V/FA-SVC ( 3653): Background event processing time, ms: 24
(...) " Bunch of informations, i don\'t want this to be too long. " (...)
09-08 18:21:39.578 V/FA (32176): Connecting to remote service
09-08 18:21:39.610 V/FA (32176): Connection attempt already in progress
09-08 18:21:39.620 V/FA (32176): Connection attempt already in progress
09-08 18:21:39.620 D/FA (32176): Setting app measurement enabled (FE): true
09-08 18:21:39.621 D/FA (32176): Updating Scion state (FE)
09-08 18:21:39.637 V/FA (32176): Connection attempt already in progress
09-08 18:21:39.637 D/FA (32176): Connected to remote service
09-08 18:21:39.637 V/FA (32176): Processing queued up service tasks: 4
09-08 18:21:39.654 V/FA-SVC ( 3653): Saving default event parameters, appId, data size: com.google.android.youtube, 2
09-08 18:21:44.657 V/FA (32176): Inactivity, disconnecting from the service
I'm sure it's not a problem from my phone bc when I run ./adb devices
I can see my phone:
List of devices attached
MUN0219130000631 device
Even on the side of Firebase, i got the firebase authentification and real-time database which works very well.
But in debug View console, I am unable to see the logs or even device available.
Firebase screenshot
Thanks in advance for your time !
p.s: It's my first post on StackOverflow, be kind and let me know if i can do it better next time

Android studio 1.5.1 debug error “Connection refused”. Debug port is busy [duplicate]

This question already has answers here:
Android studio debug error "Connection refused"
(2 answers)
Closed 7 years ago.
I'm getting this error continuously, while trying to debug on emulator.
I've tried the following solutions with no success:
1) make sure ports 8600+ are open with with kill .
2) add debuggable true on debug build types.
3) restart Android studio and my mac.
4) Added permission
<uses-permission android:name="android.permission.SET_DEBUG_APP" />
OS:- Yosemite
Android Studio:- 1.5.1
API Used:- 23
Message on Emulator:-
Console trace:-
Device connected: emulator-5554
Device is ready: Nexus_5_API_23_x86 [emulator-5554]
Target device: Nexus_5_API_23_x86 [emulator-5554]
Installing APK: /Users/Abhishek/AndroidStudioProjects/Sunshine/app/build/outputs/apk/app-debug.apk
Uploading file to: /data/local/tmp/sunshine.messy.com.sunshine
Installing sunshine.messy.com.sunshine
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/sunshine.messy.com.sunshine"
pkg: /data/local/tmp/sunshine.messy.com.sunshine
Success
Launching application:
sunshine.messy.com.sunshine/sunshine.messy.com.sunshine.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "sunshine.messy.com.sunshine/sunshine.messy.com.sunshine.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Debug port is busy
Debug port is busy
Debug port is busy
Debug port is busy
Debug port is busy
Debug port is busy
Debug port is busy
Debug port is busy
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=sunshine.messy.com.sunshine/.MainActivity }
Logcat trace:-
01-30 11:28:43.185 2416-2416/sunshine.messy.com.sunshine I/art: Not late-enabling -Xcheck:jni (already on)
01-30 11:28:43.228 2416-2416/sunshine.messy.com.sunshine W/ActivityThread: Application sunshine.messy.com.sunshine is waiting for the debugger on port 8100...
01-30 11:28:43.233 2416-2416/sunshine.messy.com.sunshine I/System.out: Sending WAIT chunk
To overcome this issue, I realised that I had recently changed the Computer Name of my Mac.
Having changed the Computer Name back to what it was (System Preferences -> Sharing -> Computer Name), I can now debug apps through Android Studio again.

SEandroid Boot Up Problems

I'm currently working on flashing SEandroid (security enhanced Android) onto a Nexus 7, but when I try to boot up, the Nexus 7 just flashes the Google screen and nothing else.
I successfully compiled the SEandroid Source code for both 4.2.1 and 4.1.2 and neither run on the Nexus.
Was wondering what some common errors could be for a device booting up, but the screen not showing anything?
I downloaded and compiled the code according to: http://selinuxproject.org/page/SEAndroid
I am using the tegra3_android_defconfig for my kernel and am using the full_grouper_userdebug.
Any help, even if not related to SEandroid would be helpful.
Here is an output from logcat:
--------- beginning of /dev/log/main
I/Netd ( 124): Netd 1.0 starting
W/InterfaceController( 124): Warning (Cannot load library: load_library(linker.cpp:745): library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library
I/installd( 130): installd firing up
I/DEBUG ( 125): debuggerd: Jun 12 2013 10:32:23
I/SurfaceFlinger( 126): SurfaceFlinger is starting
I/SurfaceFlinger( 126): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...
E/libEGL ( 126): eglGetDisplay:121 error 300c (EGL_BAD_PARAMETER)
E/libEGL ( 126): eglInitialize:137 error 3008 (EGL_BAD_DISPLAY)
Thanks in advanced.
Rookie mistake. Forgot to add in Google's proprietary drivers for the Nexus 7.
Available here for who ever needs them!
https://developers.google.com/android/nexus/drivers
thanks all

Eclipse debugger not working with Android appWidget application?

I have an appWidget project I've been working on and noticed the Eclipse debugger does not seem to be working. I thought it might be borked, so I opened up another Android project and set a breakpoint and it worked fine. In my appWidget application however, the debugger will not work no matter where I set the breakpoint. I can set the breakpoint right on a Log statement, see the message print, but there is no interruption of execution.
I read something about having to install the 'Android sources' but it seems to me that if the debugger was missing something, it wouldn't work at all. The only clue I have is Logcat is printing "Debugger has detached" which offers little help. Other posts have suggested two Eclipse processes running (ps -ef shows only one), restarting adb (I've done adb kill-server; adb start-server) or that the process crashed, which Logcat does not show:
5486 AndroidRuntime D
5486 AndroidRuntime D >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
5486 AndroidRuntime I Heap size: -Xmx48m
5486 AndroidRuntime D CheckJNI is OFF
5486 dalvikvm D creating instr width table
5486 AndroidRuntime D Calling main entry com.android.commands.pm.Pm
5486 AndroidRuntime D Shutting down VM
5486 dalvikvm D GC_CONCURRENT freed 103K, 70% free 307K/1024K, external 0K/0K, paused 0ms+0ms
5486 dalvikvm D Debugger has detached; object registry had 1 entries
5486 AndroidRuntime I NOTE: attach of thread 'Binder Thread #1' failed
That's all Logcat says when I launch the application in debug mode. Any thoughts?

AndroidRuntime thrashing

I get this series of messages about once every six or so seconds from my Android emulator's LogCat output. I haven't noticed a cause, and it doesn't always happen, but when it does, it doesn't stop until I kill the emulator. Here's the repeated message:
07-28 20:53:00.763: DEBUG/AndroidRuntime(2756): Shutting down VM
07-28 20:53:00.763: DEBUG/dalvikvm(2756): Debugger has detached; object registry had 1 entries
07-28 20:53:00.802: INFO/AndroidRuntime(2756): NOTE: attach of thread 'Binder Thread #3' failed
07-28 20:53:01.682: DEBUG/AndroidRuntime(2766): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
07-28 20:53:01.692: DEBUG/AndroidRuntime(2766): CheckJNI is ON
07-28 20:53:02.023: DEBUG/AndroidRuntime(2766): --- registering native functions ---
07-28 20:53:05.083: DEBUG/AndroidRuntime(2766): Shutting down VM
Does anyone have a clue WTF is going on here?
Looks like one of the framework-interaction shell commands is being launched repeatedly. If you type "adb shell am" you'll see similar output in the log file. Something in your development environment is going nutty.
Are you using Windows or Linux? Eclipse? The Android ADT plugin?
You can try "adb kill-server" to see if that's enough of a reset to stop whatever is going batty.

Categories

Resources