12

I'v got such problem:

[2013-11-18 14:38:50 - HelloJni] Unknown Application ABI: 
[2013-11-18 14:38:50 - HelloJni] 
[2013-11-18 14:38:50 - HelloJni] Unable to detect application ABI's

This problem occures on every project, which I am trying to debug 'as native'. I have seen this, this and this topics, but this solutions have not brought any effect in my case.

On other computer or on a VM the same project runs fine with the same settings.

Manifest

 ...
<uses-sdk 
    android:minSdkVersion="14"
    android:targetSdkVersion="14" />
<application android:label="@string/app_name"
             android:debuggable="true">
 ...

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.cpp
include $(BUILD_SHARED_LIBRARY)

Verison in Project options also has been set to api-14.

I'v also downloaded new version of eclipse, sdk, ndk. I cleaned all system-wide variables and PATH elements. My machine runs under win7x64.

PS. Problem occures only if I am trying to debug, when i build and run it - it runs great.

Edit1 this is my ndk-build DUMP_APP_ABI outline

c:\Users\Usr\workspace\HelloJni>D:\ndk\ndk-build.cmd DUMP_APP_ABI
armeabi

c:\Users\Usr\workspace\HelloJni>

Edit2 Important notice. I'v tried to run debug as native on different machines with next steps git clone -> import to ide -> Debug as native. All machines have nearly the same configuration (Win7 is common for all of them). This problem was only on my computer. I'v tried different IDEs(eclipse+cdt, adt), cleaned path, checked line endings. Finnaly I desided to develop native part of code under linux VM. It was my solution. Also I didn't need cygwin anymore to crosscompile some libraries.

Community
  • 1
  • 1
Johnny Doe
  • 3,280
  • 4
  • 29
  • 45
  • Have you found a fix? I also trying to debug HelloJNI and I get same error. I wish to post question but do not know what I can add. Just draw attention. – Max Jan 06 '14 at 21:39
  • 1
    Unfortunately, i didn't find proper solution for this error. Look at the label `edit2` above. I hope it'll help you. – Johnny Doe Jan 08 '14 at 12:11
  • 1
    I started similar [question](http://stackoverflow.com/questions/20981845/ndk-build-dump-app-abi-returns-2-lines-on-windows) Could you confirm that you have new line after `ndk-build DUMP_APP_ABI` I am wondering if every Windows users has that bug or it is something like bad unzipper. HelloJni sample is coming from NDK. I have not used any line of my own code and I have not edited anyfiles. Just put break point, compiled and debug as native application – Max Jan 08 '14 at 12:16
  • 1
    One difference could be that on your machine, unlike the others, you had `cygwin` installed. **cygwin** could interfere to produce the extra empty line. – Alex Cohn Jan 08 '14 at 14:05
  • 1
    possible duplicate of [Unable to detect application ABI's when trying to debug NDK](http://stackoverflow.com/questions/12733125/unable-to-detect-application-abis-when-trying-to-debug-ndk) – bahrep Dec 01 '14 at 14:50

6 Answers6

11

On Windows especially, it could be because one of the files (project.properties, Application.mk, Android.mk, or AndroidManfest.xml) has wrong line endings (CRLF). You run ndk-build DUMP_APP_ABI and make sure the output is clean.

All use of $(info …) or $(__ndk_info), etc. should be disabled for this target.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • Execution of 'ndk-build DUMP_APP_ABI' return only one string 'armeabi', there are no warnings or errors. – Johnny Doe Nov 18 '13 at 14:58
  • Maybe there is a newline after armeabi? – Alex Cohn Nov 18 '13 at 19:00
  • Yes, there is a new line. I'v added full outline to the question. But i thought win console adds this newline after execution of each command 'ls', for example, or 'cd'. In linux terminal does not past any new line after command execution. – Johnny Doe Nov 19 '13 at 06:32
  • You have no choice but find and exterminate the source of the extra newline. Sometimes, it happens because line endings are wrong, but there are infinite other ways to cause this, and some are specific to Windows. – Alex Cohn Nov 19 '13 at 07:47
  • @Alex Cohn, thanks for providing help. Every link Google digs up with the above issue has your name on it! However, I haven't been able to resolve it like you usually suggest. I, similarly to @Johnny Doe, get a new line after `armeabi-v7a` in the output of `ndk-build DUMP_APP_ABI`, and indeed this issue started after a modification to those files you mentioned (restore from Dropbox). I've replaced all line endings to UNIX style (\n only) but still there is no improvement. Do you have any experience with other specific reasons for this? – stav Feb 11 '14 at 10:47
  • @Stav, Do you have cygwin installed? – Johnny Doe Feb 11 '14 at 12:09
  • 2
    With @Alex's extremely generous help I've managed to figure this out. My Android.mk file was using an environment variable (injected by Eclipse) in order to include another make file (OpenCV.mk in my case). Removing this and just adding a hard-coded path did the magic and I can now debug native code from eclipse again. – stav Feb 11 '14 at 12:39
  • 2
    @Stav, actually, it's quite reasonable that it didn't work for you. But most likely, it had nothing to do with Dropbox, cygwin, or even Windows. Probably, output of `ndk-build DUMP_APP_ABI` when launched through Eclipse was always OK. The problem was (and still is) that Eclipse prepares different "environment" for build and for launch, and your launch environment did not have the relevant settings, therefore the Eclipse equivalent of `ndk-gdb` failed. – Alex Cohn Feb 11 '14 at 21:22
5

When eclipse print 'Unknown Application ABI'

ABI detection logic placed in com.android.ide.eclipse.ndk plugin com.android.ide.eclipse.ndk.internal.NdkHelper class. In fact, it looks at output of command

make --no-print-dir -f $NDK_ROOT/build/core/build-local.mk -C $PROJECT_ROOT DUMP_APP_ABI

And if output doesn't contains valid ABI you will see message (or messages) like:

[$DATE $TIME - $PROJECT] Unknown Application ABI: 
[$DATE $TIME - $PROJECT] $ANY
[$DATE $TIME - $PROJECT] Unable to detect application ABI's

How to troubleshoot this issue

First of all run manually command

make --no-print-dir -f $NDK_ROOT/build/core/build-local.mk -C $PROJECT_ROOT DUMP_APP_ABI

If output contains error fix it before. If this command works right it should produce space-separated ABIs, like this:

x86 armeabi

Especially in my case, I have missing environment variable for GStreamer. So to fix this I specified GSTREAMER_SDK_ROOT variable in Android.mk file

Community
  • 1
  • 1
CAMOBAP
  • 5,523
  • 8
  • 58
  • 93
2

I resolved "Unknown Application ABI" by doing 3 things:

  1. Replaced
    APP_ABI := all
    by
    ABI := armeabi
    in Application.mk

  2. Added
    APP_PLATFORM := android-11
    to Application.mk

  3. Launched emulator before invoking Debug As | Android Native Application. Normally Eclipse shows "Android Device Chooser" if I invoke Debug As and no device is connected. Then I can launch emulator from there. But in the bad case this did not happen. I had to invoke Windows | Android Virtual Device Manager and make sure I have a valid emulator configured and launched. Then Debug As worked OK, showed "Android Device Chooser" and executed on the chosen device (either emulator or real one). This problem was not reproducible: once Eclipse began debugging on emulator, it did not show "Unknown Application ABI" again even after I closed emulator. Also note that I had a real device connected. It is possible that communication with real device broke somehow and that caused the error.

jhnlmn
  • 381
  • 3
  • 11
1

Check your Android.mk file. The problem can appear if you are printing some debug info from Android.mk like this

$(info YOU_MESSAGE)
Puzzle
  • 173
  • 2
  • 6
0

I have encountered the same issue, "Unknown Application ABI:". And tried all the possible solutions, even want to format my windows. Finally, I find it's TortoiseGit that causes this issue. After remove TortoiseGit, the "debug as native" works pretty well.

0

I got this problem too and spent several hours to solve this issue in my environment. After several hints gathered on the Internet, I tried last option, which really worked and that is:

Eclipse or NDK (probably) interferes with git binaries. Check if git is in your Path environment variable and remove it from there (Computer > Properties > Advanced System Settings > Environment Variables)

I believe this solution might help some people.

  • I just see that hint I mentioned comes from Howard Wang's comment, thanks! – Ondřej Filip Mar 03 '15 at 06:49
  • Sounds like it could be a real reason. I have not compared `PATH` variables on different machines but my HAS `git` in it. Unfortunately, i can't check it right now but i will keep it in mind the next time i will work with NDK. – Johnny Doe Mar 04 '15 at 07:20