有个老项目,为解决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。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// 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):
1 2 3 4 5 6 7 8 |
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
1 |
PROP_APP_ABI=armeabi-v7a:arm64-v8a |
2. 升级了Gradle和studio,升级了最低sdk到16和编译sdk到28
3. 重写了一些java代码,deprecated method
4.
1 |
APP_STL := c++_static |
5.
1 |
arguments 'NDK_TOOLCHAIN_VERSION=clang' |
6. 所有compile不支持了,改成implementation或者api
1 2 3 |
dependencies { implementation fileTree(dir: '../java/libs', include: ['*.jar']) } |