A summary of problems in win7&cocos2dx2.2&android environment construction

Source: Internet
Author: User

On more than one computer to build the Android environment, due to environmental differences and the construction of some not pay attention to, the problems appear different, refer to the online solutions to various problems, here to do a summary:


(1) Error:cocos2dxactivity cannot is resolved to a type

After the build_native.sh runs successfully, this problem occurs after importing the project into eclipse, prompting that the following files cannot be found:

?
import org.cocos2dx.lib.Cocos2dxActivity;

Solution:

1. Simply copy the folder under the cocos2dx/platform/android/java/src folder in the root directory of the Cocos2d-x engine to the project's SRC package.

2. You can also import Cocos2dx/platform/android/java this project generates a jar file to add to the project's Libs folder.

Both of these methods will be copied to the APK when it is eventually generated.


(2) error:jni/android.mk:19: * * * Android ndk:aborting.  . Stop

android ndk:jni/android.mk:cannot Find module With tag ' cocosdenshion/android ' on import path    
Android Ndk:are you sure your ndk_module_path variable i s properly defined?    
Android ndk:the following directories were searched:    
Android NDK:        &NBSP
Jni/android.mk:19: * * * Android ndk:aborting.    .  stop.

Workaround:

In Project PROJ.ANDROID\JNI\ANDROID.MK (E:\Research\cocos2d\cocos2d-2.0-x-2.0.2\GameThieves\proj.android\jni\Android.mk ) to add a path to the file:

$ (call Import-add-path, E : \research\cocos2d\cocos2d-2.0-x-2.0.2) \
$ (call Import-add-path, E:\Research\cocos2d\cocos2d-2.0-x-2.0.2\ cocos2dx\platform\third_party\android\prebuilt) \


$ (call import-module,cocosdenshion/android) \
$ (call IMPORT-MODULE,COCOS2DX) \
$ (call import-module,extensions)


(3) Error:android Unable to resolve target ' android-8 '

Today imported an Android example program, appeared unable to resolve target ' android-8 ' error. At first I thought it was not imported package or PHONEGAP is not configured well. But the toss for a long time or error. Finally, Google only found that the original version of ADK is different.


ADK Version :---API level correspondence (note that high versions are not necessarily compatible with lower versions)

android2.3.4---
 android2.3.1---9 ===gingerbread
 android2.2---8===froyo
 android2.1---7===eclair
 android2.0.1---6=== Eclair
 android2.0---5===eclair
 android1.6---4===donut
 android1.5---3===cupcak
 android1.1---2 
 android1.0---1

Workaround:

1, modify the project.properties in the target=android-8 (if the android2.2 development of the case)

2. Right-click on the project properties, select Android on the left, and select the specific Android version on the right.
After selecting OK, right-click on the item and select Fix Project Properties under Android tools

3. If there is no default properties, build it yourself and then target=android-10


(4) Error:unable to execute Dex:multiple Dex files define

compile normally, debug with Eclipse Error: Error:unable to execute dex:multiple Dex files define

There are 5 possible ways to search the Internet, try it next to each other, here are my ways to solve the success.

Workaround:

Right-click the project folder in Eclipse, and in the Build path option, Android Dependencies, remove it to the right.


(5) E rror:program "Bash" is not found in PATH

This is Cygwin not configured.

Workaround:

1. Add Cygwin/bin to the system environment variable path

2. Right-click on Project-->properties-->c/c++ build to confirm right view option build Command:ndk-build

3. Right-click Project-->properties-->c/c++ Build-->toolchain Edit
Confirm options for right view: current Toolchain:no toolchain
Current Builder:android Builder


(6) error:this Android SDK requires Android Developer Toolkit version 22.6.3 or above. Current version is 22.3.0

Once you upgrade the SDK to start Eclipse, report this error.

Workaround:

Locate the Plugin.prop file under Android-sdk-windows\tools\lib to modify the version number, instead of the same version number as the installed ATD

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.