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:
- 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