NDK

Cygwin+Eclipse+Android NDK ---Windows

一世执手 提交于 2019-12-03 21:41:37
近几天看JNI的问题,都说要怎么编译,要输入很多命令行的东西。我觉得既然有IDE应用开发环境,就会有相应的JNI开发,很方便的不必输入什么命令行的。 SDK应用常用的编译环境是Eclipse,然后就想像SDK一样开发NDK程序。下面是我从网上搜来的一些步骤: 1.环境问题:Windows下用Eclipse编程,编译含Jni代码的程序,需要Cygwin和Android NDK开发包。 安装过程,查看以下链接:[1-6步骤] http://www.cnblogs.com/skyseraph/archive/2012/03/16/2400567.html 这样,就完成了Cygwin和NDK的环境安装,并检测了可用性。 2.然后,我想在Eclipse上编译,而不是在Cygwin下输入命令编译。 下面的一个文档是我从网上下到的,后来找不到出处了,好像很多地方都有这个文档,我也懒得去找出处了,我把用到的部分帖在这里。 这是一个编译NDK中的一个Sample的过程,根据自己的操作稍微做了修改: 1、 Eclipse 下调试 samples 选择 new—>project-->androidproject from existing Code 接下来如下图所示-> Next 接下来选择Source Code的位置(此处的解释是可以选择拷贝 samples 目录下 hello-jni 到自己的

NDK can't find the application directory

久未见 提交于 2019-12-03 17:39:26
如图错误说是: Android NDK: Could not find application project directory ! Android NDK: Please define the NDK_PROJECT_PATH variable to point to it. 说明没有找到ndk程序的路径。而我的ndk程序都是放在E:\android-ndk-r10b\samples目录下的。 解决方法:通过-c指定程序的路径 使用命令:ndk-build -C your_project_path 来源: oschina 链接: https://my.oschina.net/u/266531/blog/626628

【NDK】NDK初入门

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 13:15:43
下载地址: http://blog.csdn.net/lanergaming/article/details/39855033 http://www.androiddevtools.cn/ 配置ndk: jni头文件需要用到javah命令: 开始生成步骤: 1、 可以发现上面出现找不到类文件的问题 2、解决方法:找到sdk里的android.jar目录 3、会发现项目里多了jni的目录和.h头文件 4、配置下ndk的环境变量 5、验证下是否配置成功 6、项目添加.mk文件,可以参考google的hello-jni的demo,直接copy过来改下 地址: https://github.com/googlesamples/android-ndk/tree/android-mk 文件如图,直接copy到自己的工作目录jni文件夹下,修改下即可 修改说明: # Copyright (C) 2009 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the

how to build ndk application?

匿名 (未验证) 提交于 2019-12-03 10:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: hi how to build ndk application...now i am using linux os and i am new for android application please tell me simply.... 回答1: This should hopefully help you out: http://www.jondev.net/articles/Using_NDK_r4_with_the_Android_SDK_in_Netbeans Shows you how to build a simple 'Hello World' app using the NDK. 回答2: Be aware that the NDK will not let you build applications. It will only let you build a shared library object ( .so ) that your SDK application will open at runtime in order to execute native code. Instead of the standard way to build and

Android NDK Load CPU

匿名 (未验证) 提交于 2019-12-03 10:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Write a program using the Android NDK. The program uses a few libraries. All this is very heavy CPU to 90%. How can I find out which of the libraries of most loads the CPU? is there for this special techniques or tools? EDIT: That's what I got: [user@localhost HelloNDK]$ ./remotegdb.sh Package name is org.divenvrsk.android.hellondk Found running pid: 7726 Device CPU ABIs: armeabi-v7a armeabi Using app_out directory: /home/user/Dropbox/HelloNDK/obj/local/armeabi-v7a 68 KB/s (5680 bytes in 0.080s) Pulled /home/user/Dropbox/HelloNDK/obj/local

NDK OpenGL undefined reference to glVertexPointer

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When compiling the following C code with ndk-build in Terminal (I'm running Ubuntu): #include <jni.h> #include <GLES/gl.h> #include <GLES/glext.h> #include "org_opengldrawinjni_DrawinJNI.h" JNIEXPORT void JNICALL Java_org_opengldrawinjni_DrawinJNI_Draw (JNIEnv *envptr, jobject jobj) { GLfloat vertices[] = { 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 }; GLubyte indices[] = { 0, 1, 2 }; glVertexPointer(3, GL_FLOAT, 0, vertices); glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, indices); } with this Android.mk file: LOCAL_PATH := $(call my

Using “exec()” with NDK

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I remember reading somewhere that it isn't advisable to use "exec" within the C code, compiled by NDK. What is the recommended approach? Do we try and push the EXEC code up to the Java-space; that is, so the JNI (or application) spawns the new process, (and where relevant passes the results back down to the NDK)? 回答1: First off, it's not recommended to use either fork or exec . All of your code is generally supposed to live in a single process which is your main Android application process, managed by the Android framework. Any

android ndk: are -fPIC and -pie mututally exclusive?

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm building Unison (a file synchronization executable) for Android using the Android r10e NDK, but this isn't really an Android question. Android > 5.0 (SDK 21) requires executables to be position-independent. So I pass -pie to arm-linux-androideabi-gcc while compiling, which works: % hardening-check ./unison ./unison: Position Independent Executable: yes ... This works fine on Android 5.0 devices. Android > 6.0 (SDK 21) still requires executables to be position-independent, but also requires executables to be built without text relocations

difference between ndk-bundle and android-ndk-r15c

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: are there any difference between ndk-bundle obtained donloading the ndk from SDK manager and android-ndk-r15c from android developers? I'm not able to compile a project cloned from git-hub, in the description is write that I need android-ndk-r8c... I'm using ndk-bundle, is the same?? 回答1: Yes, ndk-bundle directory contains exactly same NDK as what you can download from https://developer.android.com/ndk/downloads/index.html . But if the project is tuned for r8c , you may have some work to do to tune it for r15c . This does not mean that you

android Flurry integration with NDK app

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My Android application comprises two parts: frontend written in Java and game written in C++ using NativeActivity NDK stuff. I have a problem integrating Flurry into my application. Flurry works fine from within Java part, but crashes from within C++. More specifically, call jni_env->FindClass("com/flurry/android/FlurryAgent"); results in ClassNotFoundException . jni_env variable is not broken because I am able to get some Intent params using it. FlurryAgent.jar is added to libs dir and into .classpath . I've even checked 'Order and Export'