How to Use Eclipse to Debug JNI code (Java & C/C++) - java

While I can debug my application with the Eclipse JDT debugger for Java code and GDB for C code, I would prefer to use a single tool for all my debugging. I found several projects that enable "mixed-mode" debugging in Eclipse and include support for single stepping between Java and native code.
Intel's Integrated Debugger for Java/JNI Environments
Mariot Chauvin's Summer of Code Project: Support Seamless Debugging between JDT & CDT
Unfortunately, one claims to be pre-release quality and the other is currently unmaintained.
Are there any plug-ins that bring mixed mode debugging functionality to Eclipse in a reliable way or should I continue to use two separate debuggers?

For those looking to debug NDK/JNI code in the Eclipse Juno release, it is essentially built into the software after installing the Android plugins and CDT plugins. You may have issues though since there is a problem that was introduced with the C/C++ Development tools (CDT 8.1) that as of 7/24/12 has not been fixed. For details on the issue see the following link. If you just want to debug, keep reading.
http://code.google.com/p/android/issues/detail?id=33788
If it is working correctly, you simply set your breakpoints in the C and Debug As -> Android Native Application. Unfortunately, you can not debug the java and C at the same time. If the problem is in the Java and you want to debug you do so by clicking Debug As -> Android Application.
If it is not working correctly, and you want to figure out how to get it correctly, the following packages worked for me.
Android DDMS 20.0.1.v201207132230-403220
Android Development Tools 20.0.1.v201207132230-403220
Android Hierarchy Viewer 20.0.1.v201207132230-403220
Android Native Development Tools 20.0.1.v201207132230-403220
Android Traceview 20.0.1.v201207132230-403220
Autotools support for CDT (Incubation) 3.0.1.201202152032
C/C++ Development Tools 8.0.2.201202111925
C/C++ Development Tools SDK 8.0.2.201202111925
C/C++ Library API Documentation Hover Help (Incubation)
Eclipse SDK 4.2.0.I20120608-1400
Tracer for OpenGL ES 20.0.1.v201207132230-403220
The android packages came from setting Work With: option on the Eclipse Help->Install New Software... dialog to
dl-ssl.google.com/android/eclipse/
The older 8.02... CDT packages came from setting the Work With: option to the Indigo release packages.
download.eclipse.org/releases/indigo
If installed, you will need to remove the Android tools, and the new version of the CDT prior to installing the old version of the CDT. Once the 8.02... version of CDT is installed, you can install the Android tools and commence debugging.
Ensure you use the Build command "ndk-build NDK_DEBUG=1"
Autotools may not be required but since it is installed I have it listed.
Note that stepping through the code can be quirky sometimes.

I don't think there is anything available today which will fix it, but I know that Doug Schaefer has this pretty high on his list of things he wants to get done. Keep an eye on his blog for updates on that.

ARM itself seems to have a toolkit: http://ds.arm.com/ds-5-community-edition/
Requires Eclipse 4.4 ("Luna").

With the new Android ADT bundle (as of 05/12/2013), there is no longer a need for the older 8.02 software package. If you find yourself editing text files to get the debugging working, you are following old directions that no longer apply. Use the android ADT and Debug As-> Android Native Application. You may still need to set NDK_DEBUG=1 if its not already done in the setup.

Eclipse Sequoyah 1.0 has android ndk features..Eclipse 3.6 release train and 3.5 release early June.

Related

Can I develop Android apps without an IDE?

Is it possible to develop Android apps using only the Android SDK, without any IDE like Android Studio?
Yes, see the Google SDK documentation.
However, with the current toolchain and documentation it'll be an uphill struggle. I'm trying to do this too (for a dev who lives in Vim and Unix tools, Android Studio is needlessly slow and bloated).
The main issues I've found so far:
The SDK documentation gives instructions to create an Ant-driven project, but the SDK is now geared towards using Gradle. If you're working through the Google documentation in a linear fashion, you'll find subsequent lessons have you issue Gradle build instructions. For your Ant-built project.
There is very little documentation on how to actually create a Gradle-built project from the command line. The command line I use is:
android create project --target android-22 --name MyProjectName --path my_project/ --activity MyProject --package com.example.android.myproject --gradle --gradle-version 1.2.2
The --gradle-version actually refers to the Gradle Android plugin version, not the version of Gradle itself. Finding this out wasn't easy.
Even if you get it to create a project properly, it probably won't build without further manipulation. One of the generated files (project/build.gradle) has an invalid directive name (runProguard - I'm guessing it's now deprecated). That must be changed to minifyEnabled before the project will build. And using the Gradle plugin 1.2.2, the file project/gradle/wrapper/gradle-wrapper.properties has the Gradle distribution incorrectly listed as gradle-1.2.2-all.zip. This should be gradle-2.2.1-all.zip.
These are files generated by the SDK with errors.
The documentation is focussed on IDE-based development. Once you get past the initial few pages on creating and managing a project using the command line, it's very IDE-focussed.
Instructions on things like changing an app Theme are difficult or impossible to follow as they omit steps that the IDE performs for you.
In general, fully IDE-less development for Android (at least in Java, using the official SDK) is very painful. And my personal opinion is that IDE-based development is equally painful (slow, bloated, ugly on high-DPI screens under Linux and evidently full of magic that's a pain to replicate on the command line).
Edit: I should add that the above refers to using SDK tools v24.2, SDK Platform-tools v22, SDK Build-tools v22.01 and Android API 22 (5.1.1).
For android the basic debugging environments are:
ADB
DDMS
Java Debugger
You can try with them.
More details are here : http://developer.android.com/tools/debugging/debugging-projects-cmdline.html
Writing an Android app on Notepad is what I do on my Windows Laptop.
First you configure your laptop as follows:
Download development Kits: Download a Java Development Kit 1.6 for Windows and an Android Development Kit . Similarly try downloading older version of Android kit GUI version of Kit Manager so that you can download essentials. Using kit Manager download Android-23 platform build tools. Android Studio may have slower performance, so try to avoid it.
Configure Kits: Set Windows PATH variable by right clicking My Computer -> Properties -> Advanced System Settings or change the appropriate settings in your Control Panel. PATH should include the Java's compiler executable
file in Java directory, and the android.bat file of Android Kit.
Download Build-Tool: (recommended, but Ant can be used too.) These
programs configure the command-line tools for easy usage for our
convenience. I downloaded version 2.2.1 as it can use old
Java & old Android.
I've also written about these instructions on my GitHub Page.
For the development of Android apps one doesn't even need a PC, and not even the Android SDK. One can develop them completely on a mobile Android device, so an emulator isn't necessary either.
For that one needs to the app Termux on the device, and the toolchain script apkbuilder, which stitches together all APK building programs that come with the Termux packages aapt, apksigner, clang, cmake, d8, ecj and unzip, including the OpenJDK.

Which Eclipse works flawlessly with ADT?

There are many Eclipse versions out there. e.g.:Indigo,Juno,Kepler,Luna,Mars. Which of these works best with ADT? There are many such questions on Stack Overflow, but they are all 4-5 years old. I am looking for something more recent.
I reached your question as I was wondering about this myself, since I found "the official IDE for Android" (Android Studio 1.1.0 Build 135.1740770) pretty horrible:
It doesn't work well with multi-module imported projects.
Its Logcat output format is several years backwards compared with that of Eclipse
What I do know is that back then, when Google still supported Eclipse as "official", it released a nice integrated bundle (adt-bundle-windows-x86_64.zip) that was based on Juno (
Eclipse Classic 4.2.2). It worked very well with ADT v21 and SDK Tools v21 (note: ADT and SDK are totally different things, their version numbers don't have to necessarily be identical).
Right now (as of 2015-05-01), you can download ADT 23.0.6 (March 2015) which is designed to work with SDK Tools r24.1.2.
Right now (as of 2015-05-01), you can also download Eclipse Kepler (4.3.2) and Luna (4.4.2). It is very tempting to always use the latest & greatest but I vaguely recall problems with it?. The Google Plugins for Luna & Kepler are really for web applications, not for Android.
So in the meanwhile (until Android Studio catches up with the maturity and the features the Eclipse+ADT has), I am going to stick with the final version of the ADT Bundle. It is still using Juno (
Eclipse Classic 4.2.2), so I guess this is the most stable/reliable Eclipse+ADT combo.
If you have additional information on seamless & flawless development for Android with an Eclipse version higher than Juno, I would love to learn more about it.
In my test with Linux Mint 17, ADT 23.0.7 works best with Eclipse Luna (4.4). The Android layout editor has various graphical glitches in Eclipse Mars (4.5), for example most of GUI widgets palette do not show up until you hover your mouse cursor and you get error-report popup constantly in bottom-right of the screen.
EDIT:
Google has deleted the download link of ADT, so ADT 23.0.7 is now officially the final version. Therefore, I can conclude that the last supported Eclipse version is Luna (4.4).
In the case you want to download the final ADT, the link is below:
https://dl.google.com/android/ADT-23.0.7.zip
Refer to the "Troubleshooting ADT Installation" section of Installing the Eclipse Plugin (Web Archived) for instructions. Note that you have to select ADT-23.0.7.zip instead of ADT-23.0.6.zip.
Which of these works best with ADT?
That would depend on what version of ADT you are using. To know more about which versions of Eclipse supports what all ADT version refer to ADT Plugin Release Notes.
I don't think there is any "best" eclipse version to work with an ADT. Just go for the latest Eclipse version that can use the ADT version you intent to use.
Also as per the documentation
Note: If you have been using Eclipse with ADT, be aware that Android Studio is now the official IDE for Android, so you should migrate to Android Studio to receive all the latest IDE updates. For help moving projects, see Migrating to Android Studio.
It depends, i think you should have to use Android Studio, Android studio is official IDE for android.
if you want to go with eclipse, i have good experience with helios, but it depends which version of ADT you are using.

How to setup subversion (and which - e.g. subcliplse / subversive) for android / java eclipse on LAN [without internet connection / (url/uri)]

I didn't knew what is subversion.
When came to know it's importance for more than one developer. The question arose.
How to set it up for use.
We are developing in Eclipse for Android. Details of installation:
Android DDMS 22.6.2.v201403212031-1085508
Android Developer Tools 22.3.0.v201310242005-887826
Android Development Tools 22.6.2.v201403212031-1085508
Android Hierarchy Viewer 22.6.2.v201403212031-1085508
Android Native Development Tools 22.6.2.v201403212031-1085508
Android Traceview 22.6.2.v201403212031-1085508
JavaHL 1.7.4 Win32 Binaries (Optional) 2.3.0.I20120316-1700
Native JavaHL 1.7 Implementation (Optional) 2.3.0.I20120520-1700
Subversive Revision Graph (Optional) (Incubation) 0.7.9.I20120210-1700
Subversive SVN Connectors 2.3.0.I20120520-1700
Subversive SVN Integration for the Mylyn Project (Optional) (Incubation) 0.7.9.I20110602-1700
Subversive SVN JDT Ignore Extensions (Optional) (Incubation) 0.7.9.I20111119-1700
Subversive SVN Team Provider (Incubation) 0.7.9.I20120520-1700
Subversive SVN Team Provider Localization (Optional) (Incubation) 0.7.9.I20120316-1700
Subversive SVN Team Provider Sources (Incubation) 0.7.9.I20120520-1700
SVNKit 1.7.4 Implementation (Optional) 2.3.0.I20120520-1700
Tracer for OpenGL ES 22.6.2.v201403212031-1085508
Eclipse for Java details of installation:
Eclipse Standard/SDK 2.0.2.20140224-0000
Swing Designer 1.7.0.r43x201405021531
Swing Designer Documentation 1.7.0.r43x201405030444
SWT Designer 1.7.0.r43x201405021526
SWT Designer Core 1.7.0.r43x201405021519
SWT Designer Documentation 1.7.0.r43x201405030426
SWT Designer SWT_AWT Support 1.7.0.r43x201405021546
SWT Designer XWT Support (requires Eclipse WTP/WST) 1.7.0.r43x201405021548
WindowBuilder Core 1.7.0.r43x201405021445
WindowBuilder Core Documentation 1.7.0.r43x201405021506
WindowBuilder Core UI 1.7.0.r43x201405021455
WindowBuilder GroupLayout Support 1.7.0.r43x201405021517
WindowBuilder Java Core 1.7.0.r43x201405021448
WindowBuilder XML Core (requires Eclipse WTP/WST) 1.7.0.r43x201405021458
I have tried my best. There is no proper help available anywhere that could explain me everything to set up SVN from scratch.
After googling a lot I came to conclusion to either use subclipse or subversive (no TortoiseSVN as it doesn't support eclipse 100%).
Again had to google a lot to get subversive plugin installed in eclipse.
After getting it installed, I started -
trying with import project -> SVN -> Project from SVN.
On clicking next it asks for URL.
We have not posted our files any where on internet.
We want to use subversion on LAN.
This led me to install iis (internet information service) in windows 7
But I could not manage to sync all my tryings.
It would be very helpful if experienced one's could write or redirect me to clear my question which are as follows
Am i correct about using subclipse or subversive and not tortoise svn?
If so, which SVN we should use for?
Eclipse for Android applications
Eclipse for Java applications
How to use that selected SVN on LAN (without posting our source code files over internet)
If we are supposed to use IIS on windows
How to get our files from IIS site to subversion management?
I have genuinely tried to find step by step information. But couldn't.
Please explain step by step.
Time will take it's own course on us.
Till than let us know the basics.
I was new to Eclipse / Java.
Here is a good explanation to what is subversion control.
After being with eclipse for a long time i decided to go with 'subclipse' and found out this webpage that answered my question no.3.
http://grumpygeekwrites.wordpress.com/2013/10/08/the-idiots-guide-to-setting-subversion-svn-server-on-windows/
What was asked in Q.4 and Q.5 wasn't required.
Eclipse and subversion are two totally different things.
On a SVN server, you can keep any kind of file (Best practices suggest to store mostly source code but in any king of languages).
You can install Tortoise on your computer AND subclipse/subversive on Eclipse, it works fine and it allow you to store files that are not related to an Eclipse project.
With Tortoise, you will see all your sync files in your OS explorere whereas with the Eclipse plugins, you can only see it in the "Team" view.
Anyway, subversion and subclipse works for Ecplise. they are not dependant of the other plugins you use in Eclipse like Android DK.
Here is an exemple on how to create a SVN repository: http://hamrotechtips.blogspot.fr/2008/03/setup-of-local-lan-svn-server.html

RegisterActivity: cannot be resolved to a type, AppEngine

I have set up my computer with windows 8.1 completely new (formatted), to be sure to have a working system.
I have installed Eclipse and the plugins the following way:
download and unpack eclipse Kepler
install JDK
install android SDK
install android SDK-plugins in eclipse
in android sdk: install all extras, API 19, in tools: Android SDK Tools, Android SDK-Platform Tools, Android SDK Build Tools (only newest, 19.0.3)
install all google plugins for kepler(Google App Engine Tools for Android, Google Plugin for eclipse, GWT Designer for GPE, SDKs)
Now, is everything set up correctly, to use google app engine correctly?
When I create a new app engine connected android project, google creates a bugged project.
I have 50 errors, of which 49 can be resolved by changing the Java version from 1.4 to 1.7 in the app engine project (Properties: Java Compiler and Project Facet)
However in the non-appengine project, in the MainActivity I get following error:
RegisterActivity cannot be resolved to a type.
How to solve this? I did not do anything by myself yet, I only created a project and I already have an error...
You are very thorough, which is good. Your development installation appears to have flaws, and you might be trying to make it run before you have seen it walk. You need to divide and conquer the potential problems. Initially simplify what you aim to create.
To pinpoint the errors, try the two standard tutorials before starting on your own design: first build and deploy an AppEngine project without Android components, and only after that works, build and deploy an Android to AppEngine project. Somewhere along that process your errors will show up, and then you should have a more specific piece of source code to show and discuss in this question.
Yesterday, a new version of Android SDK (22.6.2) was released. Apparently, the problem with RegisterActivity was solved in this update. Now I can create an Appengine connected Android Project without any errors!

Does Android SDK (Android Development Tools ) alter the Java SDK?

I want to develop a Windows application using Java SDK and eclipse, also I want to develop an Android app while using the same PC and eclipse. Is it possible to do both as I`m not sure if I set up eclipse and install the Android Development Tools (ADT) will I still be able to develop the Windows application at the same time???
No - all ADT does is use the existing JDK environment :)
You can just download the Android Development Tools from the Android website.
The Android Development Tools is nothing more than Eclipse modified with the ADT Plug in preinstalled.
In it, you have the option to create both Android projects and plain old Java projects.
So, downloading the Android Development Tools alone will give you everything you need.
If you already had Eclipse set up, installing the ADT yourself into it will not take away any functionality from Eclipse, it will just add ADT functionality on top of it.
No, it does not alter it.
You will have the Android SDKs on their own folders and has nothing to do with JDK.

Categories