Android - Trace - android

How can I trace the output from eclipse and the android simulator. I am used to doing it in Flash and actionscript.
In AS3 it would be:
trace('my trace statement');

You have a few options. One is the java.util.logging.ConsoleHandler class: http://developer.android.com/reference/java/util/logging/ConsoleHandler.html
ConsoleHandler console = new ConsoleHandler();
console.publish(new LogRecord(Level.INFO, "Hello logging!"));
Another option is using the Log class:
http://developer.android.com/reference/android/util/Log.html
Log.v("MyIdentifier", "Hello logging!");

In android use the Log class to provide this. Simply pick a level you want "debug, warning, info" and then use the function. ie `Log.d("tag","message");
Then this message will appear in the LogCat Eclipse window

Related

btsnooz.py not parsing android BT log

I'm trying to follow the instructions found here:
https://inneka.com/programming/android/bluetooth-hci-snoop-log-not-generated/
and here:
https://source.android.com/devices/bluetooth/verifying_debugging#debugging-with-bug-reports
I am able to get the log, run the python code to parse it and and it runs successfully (on my Mac) however when I open the file it looks like a bunch of gibberish. Which I'll paste below. Is there a special log viewer I need to open this up with? I might be doing something dumb, anyone run into this? Thanks!
‚xcƒc7f3‚xcƒc8]‚xcƒc< Ö  C‚xcƒc<˘ 
‚xcƒc#l
˘¸Ù∂§‚xcƒcAæGG‚xcƒcFDˇˇˇÃˇÔˇˇˇ¸Ú˲?˜èˇa˜ˇˇ¯ˇˇˇˇˇˇ¿‚xcƒcFÈ‚xcƒcJ∫ø˛œ˛€ˇ{á‚xcƒcKëV‚xcƒc‚SV‚xcƒc‰®m‚xcƒcÈ!m‚xcƒcÍL‚xcƒcÓn‚xcƒcÔç‚xcƒcÛè3‚xcƒcÙnz‚xcƒc˘>z‚xcƒc˙p ‚xcƒc˛Y Ä‚xcƒcˇY
‚xcƒdÍ ˚‚xcƒd‹ ‚xcƒd‡ ˇˇˇˇˇ‚xcƒd ‚ ‚xcƒd
* Ô‚xcƒd
* ‚xcƒd©* Ä‚xcƒdu/ ‚xcƒdÕ/ ˚H˚H‚xcƒd®# ‚xcƒd¡# H‚xcƒdÇ ‚xcƒd£ ‚xcƒdfˇˇˇˇˇˇø=‚xcƒd!â‚xcƒd"S‚xcƒd%ù‚xcƒd)À) ‚xcƒd.) ‚xcƒd.î. Ñ‚xcƒd2k. ‚xcƒd3.E‚xcƒd=èE‚xcƒd=ˆG‚xcƒdBøG‚xcƒdC-C‚xcƒdGC‚xcƒdGp$```
The comment at the top of the btsnooz.py script explains how to open the generated file:
This script extracts btsnooz content from bugreports and generates a
valid btsnoop log file which can be viewed using standard tools like
Wireshark.
Wireshark can be obtained from here.

ionic android unexpected token

I am using the Ionic Framework to build a mobile app for Android/iOS. I was able
to build the project for android (ionic build android). When I run the app, it will be only a white screen, that's because there is an error (when you use GapDebug, you can run apps on your phone and you will be able to debug, and see errors). Now if I run it on the desktop browser there really is NO error and everything is working. Below is the error that is shown in GapDebug:
Now when you check the code in service.js line 394:
There's nothing wrong with the code right? If I try to change line 394 to something like key : self.currentUser, there will be NO error and the app will work. What seems to be the problem here?
Not sure why you are making an object's attribute a list? If you want the key to be childQuestionSnapshot.key then remove the square brackets.
If you are trying to update a list of objects, you can do something similar to the below:
var test = [{key: 'thisguy'},{key: 'thatguy'},{key: 'myguy'}]
test.forEach(function(item){
item['key']='newguy'
})
console.log(test)
Do this instead
var updateObj = {};
updateObj[childQuestionSnapshot.key] = self.currentUser;
applicantRef.update(updateObj, function() {
console.log("applicant answers updated");
});

Calabash android hybrid app with IONIC framework. unable to access elements

I am trying to test a hybrid app (created with ionic cordova) with calabash.
I am not able to see any elements in the console. Any query statement returns [] Below is the code snippet of what I did. Let me know what is wrong.
D:\ionicProject\todo\platforms\android\build\outputs\apk>calabash-androi
d console android-debug.apk ADB_DEVICE_ARG=emulator-5554
Starting calabash-android console...
Loading C:/Ruby21/lib/ruby/gems/2.1.0/gems/calabash-android-0.5.15/irbrc
Running irb...
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansic
on/) to get coloured output on Windows
irb(main):001:0> start_test_server_in_background
nil
irb(main):002:0> query("webView css:'*'")
[]
irb(main):003:0> query("CordovaWebView css:'*'")
[]
First simply use query('*') and see all the result.
Then find all the element with class using
query('*', :class)
Then find all the element with class using
query('*',:id)
If you want to display only text content
query('*', :textContent)
if you know the correct view (ie webview or systemview) You can use that view name instead of *
Need to use SystemWebView instead of CordovaWebView
Example:
query("SystemWebView css:'*'")

Debugging pop up window "Missing Manifest?"

Im getting this error message. I created a new project and hit debug to test it. I added nothing and i get this pop up message. what could be my issue? I can create a new blank project wtih out the Controllers and Models projects in them it debugs just fine. But i need to use this solution provided to me.
New to mono droid any help will be apreciated.
You issue could be that none of the projects have been set to be deployed to a device.
Right click your Solution > Properties > Configuration Properties > Tick The Deploy checkbox for your Application Project if not already.
Also make sure to mark one of your activities with MainLauncher = true, otherwise Android does not know which Activity to start first. This is done in the [Activity()] attribute like so:
[Activity(Label = "Epic Activity", MainLauncher = true, Icon = "#drawable/icon")]
public class Activity1 : Activity {}
what could be my issue?
You are using Visual Studio... Android plays much nicer with Eclipse.
Kidding aside, every Android application requires an AndroidManifest.xml file. It looks like you are using MonoDroid, and there are docs about creating the manifest file.
Also, make sure you have built the project.
AndroidManifest.xml is generated as part of the build process, and the XML found within Properties\AndroidManifest.xml is merged with XML generated based on custom attributes.

Android emulator Output

I am running on helloword application as getting started with android application developement. but i cant able to see output in android emulator. it will show only android in the emulator screen. and i am just print "Hello from Brijesh". but it will not display in the emulator of the android. actually i follow the instruction in the following link.
http://developer.android.com/guide/tutorials/hello-world.html
but not getting out put.
can any one help me out.
thankx.
If i understand correctly, you would like to output some debugging messages to the screen ?
In standard java you can use the System.out.println method, but with android i suggest you use the Dalvik debugger.
Use:
Log.i("mytag","My simple message");
And se the output by using the Dalvik Debug Monitor
Start the Dalvik Debug Monitor with:
c:\android-sdk\tools\ddms.bat
Just change the foldername to where you have installed the SDK.
Now the debugger application will start (next to the emulator), and your message will be shown with green text.
You can also view System.out.println commands in the Dalvik Debug Monitor or in LogCat by creating a filter for a Log Tag containing "System.out".
If you want to print "Hello from Brijesh" through XMl then use this code.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/hello_world"
/>
And if you want to print that using java then,
TextView tv = new TextView(this);
//Set a text into view
tv.setText("Hello World");
//set the view into activity view container
setContentView(tv);

Categories

Resources