3. x packaging APK is relatively convenient.
First, you must configure the environment for Android and Java. Let me talk about a few things that are easy to ignore.
The proj. Android/JNI/Android. mk file must be modified.
Under normal circumstances, you only need to add your own classes as follows:
LOCAL_SRC_FILES := hellocpp/main.cpp ../../Classes/AppDelegate.cpp ../../Classes/Stage.cpp ../../Classes/player.cpp
It should be noted that if we use the extension library, such as the controlbutton callback, we need to add the following replacement in Android. mk. We can find that the developer has already added the extension in the MK file.
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
# LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
# $(call import-module,extensions)
In the MK file, the well number is a comment. We need to remove the last two annotations to activate these two references. You only need to remove the well number. (When writing # include "extensions/cocos-ext.h", to write full, avoid not found)
In the main directory of the project, you can use the Cocos compile-P Android -- AP 20 command to package it.
The generated APK is in the publish file.
For Java and Android environment configuration, see the official website ~
Considerations for cocos2dx3. X Project rewriting (additional article) 3.x APK Packaging