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

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

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

更新Eclipse

解决办法:

090638_HyjI_615762.png 

更新Android SDK

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

090638_SHHh_615762.png 

更新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

090639_Kzsx_615762.png 

更新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

图片:

090639_YAMY_615762.png 

解决办法1:安装ndkeclipse修改为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是之前安装的,并没有专门设置环境变量。

图片:090639_h7f0_615762.png

解决办法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. 

090639_gYBr_615762.png

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.

090639_sR8b_615762.png

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

090639_hDP1_615762.png 

设置JDKJREinclude路径。

类似的解决办法:

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

描述:

090639_VRNS_615762.png 

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

Launching  has encountered a problem

描述:

090639_U0U5_615762.png 

090640_lG4g_615762.png

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

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

090639_8Bet_615762.png 

使用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

描述:断点提示

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

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

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

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

取消use default build commonbuild common设置为ndk-build NDK_DEBUG=1

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

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

问题描述:

090639_Y9qE_615762.png 

解决办法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

描述:

090639_iOcK_615762.png 

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

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

解决办法3090639_dr0r_615762.png

Check home directiory

090639_002H_615762.png 

解决办法1:勾选Do not show again


转载于:https://my.oschina.net/u/615762/blog/604374

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值