Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unknown Application ABI:" while 'debug as native application'

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.

like image 310
Johnny Doe Avatar asked Nov 18 '13 12:11

Johnny Doe


4 Answers

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.

like image 196
Alex Cohn Avatar answered Nov 17 '22 14:11

Alex Cohn


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

like image 32
CAMOBAP Avatar answered Nov 17 '22 15:11

CAMOBAP


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.

like image 42
jhnlmn Avatar answered Nov 17 '22 15:11

jhnlmn


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

$(info YOU_MESSAGE)
like image 42
Puzzle Avatar answered Nov 17 '22 15:11

Puzzle