How to use debugger in android or Java? - java

I am trying to create a simple android application. This is the first time I am coding for android and Java. I have installed android sdk on win 7 machine. I have never used a debugger. I want a resource to learn use of debugger in android from basic. If it is same as Java, Kindly provide me a link to learn java debugger from basic. Thanks in advance.

I hope you are using eclipse to develop an Android app. If not the please do that.
Here is a information to debug an Android app.

Have you tried just playing around with the Eclipse debugger?
Try:
Click on the left-hand margin next to code you want to investigate, setting a "breakpoint"
Click on the bug icon to run your application in Debug mode.
When your application arrives at that line of code, Eclipse will pop up a dialog confirming a change to the debug perspective.
Play with the step-next/step-out buttons in the debugger.

Related

IntelliJ JNI debugging

I have an android application which does some real time sound processing. Since this task is time critical, I wrote the code that does the processing in C++, the rest of the application is Java. Android Studio supports JNI debugging no questions asked which made it easy for me to write the code. Then, I left the code alone and decided in the meanwhile to get rid of Android Studio and to use IntelliJ instead.
Now, I had an issue in the native code and wanted to debug the C++ code, when I suddenly realized that I was unable to set breakpoints in the C++ code.
I also tried to set a breakpoint in the java code just before the native call and hoped that by hitting "Step in" it would go inside the native code but instead, InteliJ just skipped over it.
Also, the run configuration with dual debugging enabled (which I created in Android Studio back then) does not seem to work (Android Studio used to load a ton of libraries when launching the native debugger, IntelliJ does not do that).
This seems odd to me, as - according to JetBrain's official blogpost - IntelliJ has all of Android Studio's features except for the project setup wizard. What am I missing here?
Btw I am aware of this question but its answers are outdated.

How to automate the android phone back button using appium on emulator

I have recently started working on test automation for a native mobile application on Android using Appium(java client library). I haven't been able to figure out any means to automate or create a gesture for using the Phone back button to go back to the previous page of the app. Is there any driver function that can be used? I tried following code,
driver.sendKeyEvent(AndroidKeyCode.BACK);
by checking other posts, but it did not work for me. Can anyone suggest a solution?
you need to use following code for go back.
driver.pressKeyCode(AndroidKeyCode.BACK);

How to make an Android app without using Android Studio?

I downloaded the Android studio and installed it. When I launched it, it's all "graphical". My screen reader is reading nothing on it.
I'd prefer if I could use my Notepad app, but the "stand alone" tutorials are too tiresome, and not many tutorials on the web have instructions making apps using Notepad. I wanted to know if there is an alternate IDE, or another way to code Android apps?
The Java IDE Eclipse is also not very compatible with my screen reader. I use JAWS screen reader by Freedom Scientific. I used to code Java desktop software using my Notepad, so I'm familiar with programming using Notepad.
Also, if I somehow figure out how to make Android apps using Notepad, how am I going to test them? Do I need a phone? I'm sorry for all these beginner questions, but I'm a beginner :)
You can follow this link:
http://developer.android.com/tools/building/building-cmdline.html
If you only want to build, not run, you don't need a phone. If you want test without a phone you can use an emulator by running"AVD Manager.exe" in Android SDK folder.
The good thing since the transition to android studio is that now the building of an android project is done using Gradle and can be piloted entirely by command line. So technically, you don't need an IDE at all.
Basically, every project has at least a build.gradle file that contains the instructions to build it. You only have to launch Gradle with the appropriate command to compile your app.
Yelliver mentionned the tools to build the app from the command line, there are also tools to create the project structure and the basic build files: http://developer.android.com/tools/projects/projects-cmdline.html (this documentation appears not to be entirely up-to-date, though, as it mentions the old project.properties format)
Having a phone to run your app is certainly going to be nicer and faster to develop. The emulator is far from perfect, quite slow, and sometimes not responsive. It is also easier to install other apps on your phone than on the emulator, in case your app interacts with other apps.
I wrote two small scripts for Android development without using Android Studio. They are building apk and installing it on the connected device and opening the logcat with the output of the installed application. This two scripts not even near to complete when to think all the features of the Android Studio but they are allowing to at least run the project on your phone.

Opening default google maps crashing program in all API's except 8

I am not sure what I am doing wrong. The following code I use in an on click listener for a button and it works great in API8, now that I am checking compatibility its crashing everywhere else. What am I doing wrong?
startActivity(getPackageManager().getLaunchIntentForPackage("com.google.android.apps.maps"));
I figured out the issue. The emulator used with the AVD manager must be the google API version not the android version. The latter does not have the maps app installed.

Android: Installing Wikitude on Android Emulator

I'm trying to write some apps using wikitude, and I'm having some problems running even the example.
I've put the sample ( BasicOpenARDemo ) that comes with the SDK inside eclipse and tried to run it, where I encountered the next error: "wikitude was not found on the system. Please press the ok-button to access the Android market and download wikitude."
First question- I don't understand- Why am I approached to download the utility when I have a standalone sample inside my eclipse? Doesn't the core files behind Wikitude come with the SDK or the sample itself?
The next question will be - after some googling, I've found that in order to install this "Android market" I need to follow the manual that comes in the 9th message in the next thread (the message that was written by ronni.rasmussen) -
http://forum.xda-developers.com/archive/index.php/t-529170.html
Well, I've followed it, and now when I try to press the OK button that comes after the "wikitude was not found on the system..." message, I get redirected to the Android market, where I find Wikitude, but when I try to download it- I get a "Download was unsuccessful. Please try again" error message. How do I fix that?
One more thing that I don't understand- How come it's written in this offline Android market that the available wikitude version is for android 1.5 and no longer maintained?
As you can see- I'm quite baffled here. Hope someone could clear this up for me.
I was with the exact same problem. The problem was that installing Wikitude from the market (following the link you provided) does not guarantee to have the system requirements supported in the virtual device, therefore it gives an error when you run the BasicOpenARDemo, if it let you install it at all.
The solution was creating an AVD with an GoogleAPI (it includes maps support, I used the level 10 API for Android 2.3.3, it didn't work for the level 8 API), adding the camera, accelerometer, compass, GPS, etc., support to the virtual device (I did this via Eclipse). Then I downloaded the .apk for Wikitude and installed it via command line (.adb).

Categories

Resources