有个老项目,为解决Google要求64位支持的问题,准备把cocos升级一下,然后发现不需要,据说只要编译64位版本就可以。依稀记得当时删了arm64-v8a的。
Google的教程: https://developer.android.com/distribute/best-practices/develop/64-bit#test\_your\_app\_on\_64-bit\_hardware 里面说了3种情况,用Gradle编译、CMake编译、ndk-build编译,不同。 cocos2dx根据我测试发现是ndk-build模式,取决于gradle.properties里的配置PROP_APP_ABI。
// Your app’s build.gradle
apply plugin: ‘com.android.app’
android {
compileSdkVersion 27
defaultConfig {
appId "com.google.example.64bit"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86\_64'
// ...
帖子:[Support for 64bit on cocos2d-x on Android](https://discuss.cocos2d-x.org/t/critical-support-for-64bit-on-cocos2d-x-on-android/45516/14):
in Application.mk:
APP_ABI := armeabi armeabi-v7a arm64-v8a
In gradle.properties:
PROP_APP_ABI=armeabi-v7a:arm64-v8a
In build.gradle(Module: myapp):
abiFilters ‘armeabi-v7a’, ‘arm64-v8a’
我实际进行的操作:
1. 修改配置加arm64-v8a
PROP_APP_ABI=armeabi-v7a:arm64-v8a
2. 升级了Gradle和studio,升级了最低sdk到16和编译sdk到28 3. 重写了一些java代码,deprecated method 4.
APP_STL := c++_static
arguments ‘NDK_TOOLCHAIN_VERSION=clang’
6. 所有compile不支持了,改成implementation或者api
dependencies {
implementation fileTree(dir: ‘../java/libs’, include: [‘*.jar’])
}
技术内容转载请注明来源,个人日记不允许转载,欢迎指出任何有错误或不够清晰的表达。可以邮件至 mousebomb@gmail.com