您的位置:首页 > 移动开发 > Android开发

Android NDK配置过程中出现的问题

2016-01-19 00:00 633 查看
摘要: 初次配置NDK调试环境,遇到了非常多问题,也找了很多方法,最终的解决办法就是找到合适的版本。还有谢绝百度,越专业百度越不行

解决问题的终极大发,直接更换版本这个是一定能够成功的。

问题出现总是有原因的,就是原因太多无法解决,那么主要从两个方面解决。第一个是更新操作平台,软件平台之间的版本关系影响很大。前提是主要平台版本必须高于插件的版本,要不问题不减反增。第二就是对于工程全部采用新建然后在去配置相应的文件和环境。不要再原有的工程文件上修改。

更新Eclipse

解决办法:



更新Android SDK

解决办法:设置代理更新,下载自己需要的版本问题



更新CDT

Eclipse->Windows->Install New Software->Work With添加如下路径,并点击添加,勾选所有的文件,进行更新操作。
相应的CDT版本参见:http://www.eclipse.org/cdt/downloads.php
Helios版本: http://download.eclipse.org/tools/cdt/releases/helios
Mars版本: http://download.eclipse.org/tools/cdt/releases/8.8
解决办法1:



更新ADT

解决办法1:谷歌被墙提供国内下载的网址
http://www.androiddevtools.cn/
下载对应的离线包,然后类似更新CDT方式更新ADT

[SDK Manager] 'xcopy' 不是内部或外部命令,也不是可运行的程序。

描述:Eclipse启动SDK Manager报错
解决办法:在path环境变量下加上C:\WINDOWS\system32;或将C:\WINDOWS\system32\xcopy.exe拷贝到android sdk目录的tools下面即可正常运行

Make.exe: *** [***.o]Error 1

描述:NDK开发中显示,windows环境下NDK开发
解决办法:查找系统环境变量,找到关于Cygwin的环境变量或其他无效的环境变量删除处理。

Make.exe: *** [libs/armabi-v7a/gdbserver] Error 1

描述:控制台显示Make.exe: *** [libs/armabi-v7a/gdbserver] Error 1

图片:



解决办法1:安装ndk和eclipse修改为x86操作系统

解决办法2:降低更换NDK版本

Stray \277 in progrom

描述:Eclipse C/C++编译出现大量类似的提示
解决办法1:代码来源可能不是本软件编写,建议重新编写
解决办法2:检查使用的NDK版本是针对32位还是64位,32位正常执行,64位异常
解决办法3:软件应用系统使用了文件加密,将加密文件增加NDK编译使用的进程

Unable to resolve target android-3

描述:工程打开提示Unable to resolve target android-3
解决办法1:修改工程使用的Android平台包
解决办法2:增加Android对应的平台
解决办法3:

无NDK路径设置项

描述:Windows的
解决办法:下载ndk pulgin插件,并将文件放置在\eclipse\plugins路径下

Unable to launch cygpath. Is Cygwin on the path

描述:控制台报出了一个错误:“Unable to launch cygpath. Is Cygwin on the path?] java.io.IOException: Cannot run program "cygpath": CreateProcess error=2”,因为我的ndk是之前安装的,并没有专门设置环境变量。
图片:


解决办法1:
1、Head to the project's properties. If you're using Windows, the shortcut is Alt + Enter; or simply right-click the project name to find its properties.
Go to the C/C++ Build section; under Builder Settings tab in Build command: text box you're likely to find something similar to that below, if it's empty then type in the similar text - namely:${NDKROOT}/ndk-buildNaNd where NDKROOT, as its name implies, refers to the path where your NDK root folder exists.



2、Now you must inform eclipse what NDKROOT equates to; as in, where is the NDK root path. You can do this by heading to (in your project's properties) C/C++ Build > Environment > press Add…
Now add your environment variable named NDKROOT (the Name) with the relevant path (Value). Note that you're to repeat this per NDK project. You would get a window similar to that below.



Press OK to the New variable input window and then OK again to the properties window.
解决办法2:更新eclipse
建议方法3:不要使用导入文件方式,直接采用新建,然后拷贝相应的文件到对应的目录

无Android SDK Manager选项

Eclipse->Window->Customize Prespective->Command Groups Availability-》check Android SDK and AVD Manager-》OK

ERROR: NDK path cannot contain any spaces

描述:执行设置完成NDK配置后,执行编译操作,控制台提示

解决办法:检查ndk路径是否有空格,如果有删除或用其他符号替换

Type ‘JNIEnv’ Could not be resolved

描述:编译调试时,控制台显示如下信息

解决办法:工程属性-->C/C++ General-->Paths and Symbols-->Include-->Add



设置JDK中JRE的include路径。

类似的解决办法:

Multiple markers at this line
- Syntax error
- Type 'JNIEnv' could not be resolved
- Type 'JNICALL' could not be resolved
是由于没有将jni.h导入的缘故,而这个文件在ndk的目录下面。所以,参照以下步骤:
Project Properties -> C/C++ General -> Path and Symbols
选择include标签,Add -> $Android_NDK_HOME/platforms/android-14/arch-arm/usr/include
且选中All languages.
最后Apply -> OK

Method ‘NewstringUTF’ could not be resolved

解决办法1:只是不显示问题

Go to the project's Properties -> C/C++ General -> Code Analysis. Click the "Use project settings" radio button (or "Configure Workspace Settings..." button). Disable (uncheck) the "Method cannot be resolved" checkbox. Click "Apply," "OK." Then for your project, refresh, clean, refresh, build.
There must have been something I did differently in creating the new project. Or maybe it was because of the locations of the projects, or the fact that the previous was a Library. Maybe it really is an Eclipse bug? For reference, I'm using ADT v21.1.0-569685 and NDK r8e for Windows。
解决办法2:只是不显示问题
将错误删除,并关闭C代码窗口
解决办法3:代码编写风格问题
Just switch to the right syntax and Problem will be solved C syntax
return (*env)->NewStringUTF(env, "Hello from JNI !");
C++ Syntax
return (env)->NewStringUTF("Hello from JNI !");
After switching from C to C++ syntax my problem got solved.

Building Workspace

描述:



解决办法1:检查NDKBUILDER这个路径配置是否正确,尤其是NDK的路径信息

Launching has encountered a problem

描述:





解决办法1:检查文件是否正确安装NDK开发编写相应的代码

解决办法2:在C++文件中的函数前添加extern “C”修饰,例如:



使用extern “C”

Android NDK: WARNING: APP_PLATFORM android-16 is larger than android:minSdkVersion 3 in ./AndroidManifest.xml

描述:编译过程中提示

解决办法:./AndroidManifest.xml文件中的minSdkVersion属性强制修改到对应的版本即可

Type Breakpoint attribute problem: installation failed

描述:断点提示

解决办法:GDB在Eclipse中的BUG,暂时不知道如何解决

Error:Program “****/ndk-builde” is not found in PATH

描述:编译NDK文件,然后点击取消,将会显示上述问题

解决办法1:工程-->properties-->C++ Builder-->Builder setting-->Build Common

取消use default build common,build common设置为ndk-build NDK_DEBUG=1
解决方法2:在系统的环境变量中添加上对应的路径,例如NDKROOT。那么在使用过程中修改build common为${NDKROOT}/ndk-build NDK_DEBUG=1

发现了以元素 ‘d:skin’ 开头的无效内容。此处不应含有子元素

问题描述:



解决办法1:在system-images中删除对应的系统镜像,在SDK Manager里删除Android-wear相关的image

解决方法2:进入sdk目录下,把..\android-sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml和..\android-sdk\system-images\android-22\android-wear\x86\devices.xml文件删除,再把sdk里面..\android-sdk\tools\lib\下的devices.xml拷贝到上述两个文件夹里,重启eclipse即可

解决方法3:更新eclipse版本,以便支持高版本镜像文件

egit could not detect where git is installed

描述:



解决方法1:egit是eclipse支持github的插件,装一个git for windows就好

解决方法2:勾选Do not warn again if Git cannot be found

解决办法3:


Check home directiory



解决办法1:勾选Do not show again
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: