How to include <android/bitmap.h> and other *.h NDK libraries to Titanium Android module?

转载 2013年12月04日 11:35:10

I am facing problem in including built in NDK libraries such as (bitmap.h , log.h and others) to my Native C++ Code of Titanium android Module . problem as show in following figure . alt text

In Figure when i add any library such as #include<android/bitmap.h> as show above picture ,A little yellow Question mark appear on the left side which means "Unresolved inclusion" .How to Fix it ?

NOTE : As this problem can be fix in eclipse android project but i am unable to solve this issue in Titanium android Module project

One solution which i found on Internet is to mention graphics libraries to Android.mk file as show below :

LOCAL_PATH := $(call my-dir)
 
include $(CLEAR_VARS)
 
LOCAL_MODULE    := IMGprocessing
LOCAL_SRC_FILES := IMGprocessing.cpp
 
LOCAL_LDLIBS := -ljnigraphics
include $(BUILD_SHARED_LIBRARY)
BUT still i am getting Error Messages That "<android/bitmap.h> there is no such file or directory " when i Build my android Titanium module through Ant after successfully compile my Native C++ Code through cygwin to generated binaries ... Error messages are as shown below :
[exec] "Compile++ thumb : IMGprocessing <= IMGprocessing.cpp
     [exec] jni/IMGprocessing.cpp:4:28: error: android/bitmap.h: No such file or
 directory
     [exec] jni/IMGprocessing.cpp:9:12: warning: missing whitespace after the ma
cro name
     [exec] jni/IMGprocessing.cpp: In function 'void Java_com_nextin_imagemanipu
lation_ImageProcessing_HistogramEqualization(JNIEnv*, _jobject*, _jobject*, _job
ject*)':
     [exec] jni/IMGprocessing.cpp:20: error: 'AndroidBitmapInfo' was not declare
d in this scope
     [exec] jni/IMGprocessing.cpp:20: error: expected ';' before 'info_orignal'
     [exec] jni/IMGprocessing.cpp:22: error: expected ';' before 'info_new'
     [exec] jni/IMGprocessing.cpp:27: error: 'uint32_t' was not declared in this
 scope
     [exec] jni/IMGprocessing.cpp:27: error: 'line_orignal' was not declared in
this scope
     [exec] jni/IMGprocessing.cpp:28: error: 'line_new' was not declared in this
 scope
     [exec] jni/IMGprocessing.cpp:33: error: 'info_orignal' was not declared in
this scope
     [exec] jni/IMGprocessing.cpp:33: error: 'AndroidBitmap_getInfo' was not dec
lared in this scope
     [exec] jni/IMGprocessing.cpp:38: error: 'info_orignal' was not declared in
this scope
     [exec] jni/IMGprocessing.cpp:38: error: 'ANDROID_BITMAP_FORMAT_RGBA_8888' w
as not declared in this scope
     [exec] jni/IMGprocessing.cpp:42: error: 'AndroidBitmap_lockPixels' was not
declared in this scope
     [exec] jni/IMGprocessing.cpp:46: error: 'info_new' was not declared in this
 scope
     [exec] jni/IMGprocessing.cpp:46: error: 'AndroidBitmap_getInfo' was not dec
lared in this scope
     [exec] jni/IMGprocessing.cpp:51: error: 'info_new' was not declared in this
 scope
     [exec] jni/IMGprocessing.cpp:51: error: 'ANDROID_BITMAP_FORMAT_RGBA_8888' w
as not declared in this scope
     [exec] jni/IMGprocessing.cpp:55: error: 'AndroidBitmap_lockPixels' was not
declared in this scope
     [exec] jni/IMGprocessing.cpp:60: error: 'AndroidBitmap_unlockPixels' was no
t declared in this scope
     [exec] jni/IMGprocessing.cpp:66: error: 'info_orignal' was not declared in
this scope
     [exec] jni/IMGprocessing.cpp:67: error: expected primary-expression before
')' token
     [exec] jni/IMGprocessing.cpp:67: error: expected ';' before 'pixels_orignal
'
     [exec] jni/IMGprocessing.cpp:94: error: 'info_orignal' was not declared in
this scope
     [exec] jni/IMGprocessing.cpp:139: error: 'AndroidBitmap_lockPixels' was not
 declared in this scope
     [exec] jni/IMGprocessing.cpp:144: error: expected primary-expression before
 ')' token
     [exec] jni/IMGprocessing.cpp:144: error: expected ';' before 'pixels_origna
l'
     [exec] jni/IMGprocessing.cpp:145: error: expected primary-expression before
 ')' token
     [exec] jni/IMGprocessing.cpp:145: error: expected ';' before 'pixels_new'
     [exec] jni/IMGprocessing.cpp:164: error: 'info_new' was not declared in thi
s scope
     [exec] jni/IMGprocessing.cpp:172: error: 'AndroidBitmap_lockPixels' was not
 declared in this scope
     [exec] make: *** [C:\Users\Haris\AppData\Local\Temp\/Haris/imagemanipulatio
n-generated/obj/local/armeabi/objs/IMGprocessing/IMGprocessing.o] Error 1
     [move] Moving 4 files to D:\Nextin_Company_Workspace\Workspace_Titanium\Ima
geManipulation\build\generated\jni-local
 
BUILD FAILED
C:\Users\Haris\AppData\Roaming\Titanium\mobilesdk\win32\3.0.2.GA\module\android\
build.xml:410: D:\Nextin_Company_Workspace\Workspace_Titanium\ImageManipulation\
build\generated\jni-local\libs does not exist.
 
Total time: 26 seconds
Please Help me out .. Thanks in advance .

My Environment Details are as follow:

Windows 8 64bit Professional Titanium Studio, build: 3.0.1 Python27 apache-ant-1.8.4

— asked 10 months ago by Muhammad Haris Baig
1 Comment
  • >NOTE : As this problem can be fix in eclipse android project but i am unable to solve this issue in Titanium android Module project

    How do you fix this in Eclipse Android ?

    — commented 10 months ago by Francois Stephany

1 Answer

0

SOLVED : i got the solution that how can i fix this issue in Titanium studio with Native module development.. just go to NDK Project->New->Folder->Advanced->Link to alternate location(Linked Folder) Browse the path?for example)?C:\Android\android-ndk-r8b\platforms\android-8\arch-arm\usr\include

and then click ok !! This will fix unresolved inclusion Problem :)

AndroidStudio报错: undefined reference to 'AndroidBitmap_getInfo'

Error:(425) undefined reference to AndroidBitmap_getInfo' Error:(440) undefined reference toAndro...
  • lj402159806
  • lj402159806
  • 2017年04月03日 21:35
  • 2000

Android开发过程中遇到的错误及其解决的方法

1、大感叹号:导致大感叹号的原因是项目中导入的一些包的路径找不到            解决方法:把找不路径的包remove掉,然后重新导入。     2、编译ffmpeg时遇到的错误:    ...
  • SUCHIP
  • SUCHIP
  • 2012年07月24日 17:43
  • 1270

android/bitmap.h: No such file or directory

ndk build 的时候出了这么一个错,在ndk-build 后面加上APP_PLATFORM=android-8就可以了,即ndk-build APP_PLATFORM=android-8...
  • liuhanhan512
  • liuhanhan512
  • 2012年12月27日 17:46
  • 2191

android/bitmap.h 详解

包含于jnigraphics 库,jnigraphics库是 android-8 新增的一个库,提供对Java中的 bitmap 对象的操作。 链接: LOCAL_LDLIBS += -ljnig...
  • Pwiling
  • Pwiling
  • 2015年08月13日 19:38
  • 2321

Android Bitmap深入介绍(二)--- 优化技术

这一篇主要介绍Bitmap相关的一些优化技术,包括加载图片,图片内存管理,图片缓存。...
  • xxx_zhi
  • xxx_zhi
  • 2016年06月13日 15:14
  • 3683

Android 性能优化之内存泄漏检测以及内存优化(中)

上篇博客我们写到了 Java/Android 内存的分配以及相关 GC 的详细分析,这篇博客我们会继续分析 Android 中内存泄漏的检测以及相关案例,和 Android 的内存优化相关内容。 ...
  • zhao_zepeng
  • zhao_zepeng
  • 2017年04月10日 20:49
  • 3359

c++ for Android ----- ndk 编译链接 pthread 报错

好端端的c++编译/bin/ld: error: cannot find -lpthread
  • Qyee16
  • Qyee16
  • 2014年09月29日 15:10
  • 8147

Android_NDK图片压缩之Libjpeg库使用

一、前言 Android图片压缩处理确实不如Ios,之前完全没听过libjpeg这个东西,工作闲余时间研究了了一天,总结下吧 libjpeg的介绍可以参考文章:http://blog.csdn.ne...
  • hqiong208
  • hqiong208
  • 2016年12月15日 15:59
  • 4102

MacOSX 编译Android 4.0的各种问题

之前编译过Android 4.2的源码,当时按照Android官方文档来的,并且系统环境与官方 要求基本相同,所以编译起来比较容易,可以参阅我之前的博客。 最近比较悲催的事情接二连三,有天晚上...
  • bulreed
  • bulreed
  • 2015年04月09日 00:50
  • 4004

android-----解决Bitmap内存溢出的一种方法(图片压缩技术)

我们在平常使用Bitmap的过程中经常会遇到OOM异常,为此困扰了我两三天时间,接下来把我自己的解决方法讲述一下:         首先来看看为什么使用Bitmap会导致OOM异常的,假如采用Bi...
  • hzw19920329
  • hzw19920329
  • 2016年05月27日 20:53
  • 3115
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How to include <android/bitmap.h> and other *.h NDK libraries to Titanium Android module?
举报原因:
原因补充:

(最多只允许输入30个字)