Cocos2d-x 2 common problems and solutions in Android platform compilation

Source: Internet
Author: User

I. Eclipse when importing a compiled Android project, Tip: Cocos2dxactivity cannot is resolved to a type

Workaround:

This problem occurs after Eclipse imports the project, in fact there is a project.properties file in the project with one line of configuration information:

    1. android.library.reference.1 =. /.. /cocos2dx/platform/android/java  
It means that the project under the Cocos2dx/platform/android/java folder of the upper ancestor folder (that is, the root directory of the Cocos2d-x engine) is referenced in the import project from.. /.. /This path can be seen in two points:

1. The generated project cannot be moved to another directory, only the root directory of the COCOS2DX engine.

2. When importing to eclipse, you cannot select the Copy Project into workspace option.

There are two ways of doing this:

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 and import via the import option.

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

Two. Using Cocos run-p Android compile error, unable to compile, error The main information is summarized as follows:

-dex:
[DX] unexpected top-level EXCEPTION:
[DX] merged Dex A (6 Defs/2.0kib) with Dex B (Defs/107.9kib). Result I
S-Defs/129.7kib. Took 0.0s
[DX] com.android.dex.DexException:Multiple dex files define Lcom/chukong
/cocosplay/client/cocosplayclient;
    Importafter Cocos2dx/platform/android/java this project, Project.Properties will become two lines,

android.library.reference.1=. /cocos2d/cocos/platform/android/java
Android.library.reference.2=. /.. /.. /cocos2d-x-3.6/cocos/platform/android/java

Here is the repetition, causing the above error, when compiling, the second line to comment out:

android.library.reference.1=. /cocos2d/cocos/platform/android/java
#android. library.reference.2=. /.. /.. /cocos2d-x-3.6/cocos/platform/android/java





Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Cocos2d-x 2 common problems and solutions in Android platform compilation

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.