Cocos2dx v4 build android bundle error

Hi everyone, here im trying to build my current project into a android bundle with cocos2dx v4. The reason i want build this project into a bundle, because this project will support multi languange. Unfortunately, I got this error while compiling x86_64.

Build command failed.
Error while executing process E:\Products\sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C E:\Products\Shared\MyGame\Games\proj.android\app.cxx\cmake\debug\x86_64 MyGame}
ninja: Entering directory `E:\Products\Shared\MyGame\Games\proj.android\app.cxx\cmake\debug\x86_64’

ninja: error: ‘E:/Products/Shared/cocos2d/external/Box2D/prebuilt/android/x86_64/libbox2d.a’, needed by ‘…/…/…/…/build/intermediates/cmake/debug/obj/x86_64/libMyGame.so’, missing and no known rule to make it

I dont know why my android studio build x86 and x86_64, while in my build.properties i just set

PROP_APP_ABI=armeabi-v7a:arm64-v8a

here my app/build.grade
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.internal.os.OperatingSystem
import com.android.build.OutputFile

apply plugin: 'com.android.application'

android {
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = true
        }
        abi {
            enableSplit = true
        }
    }

    compileSdkVersion 29

    defaultConfig {
        applicationId "com.myCompany.myGame"
        minSdkVersion PROP_MIN_SDK_VERSION
        targetSdkVersion PROP_TARGET_SDK_VERSION
        versionCode 001
        versionName "1.0.0"
        multiDexEnabled true

        externalNativeBuild {
            cmake {
                targets 'MyGame'
                arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
                cppFlags "-frtti -fexceptions -fsigned-char"
            }
        }

        ndk {
            abiFilters = []
        }

    }

    sourceSets.main {
        java.srcDir "src"
        res.srcDir "res"
        manifest.srcFile "AndroidManifest.xml"
        assets.srcDir "assets"
    }

    externalNativeBuild {
        cmake {
            path "../../CMakeLists.txt"
        }
    }

    signingConfigs {

        release {
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                storeFile file(RELEASE_STORE_FILE)
                storePassword RELEASE_STORE_PASSWORD
                keyAlias RELEASE_KEY_ALIAS
                keyPassword RELEASE_KEY_PASSWORD
            }
        }
    }

    buildTypes {
        release {
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                signingConfig signingConfigs.release
            }
        }

        debug {
            debuggable true
            jniDebuggable true
            renderscriptDebuggable true
        }

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    dynamicFeatures = [":feature_JA", ":feature_AR", ":feature_VI", ":feature_ES", ":feature_FR", ":feature_KO", ":feature_MS", ":feature_PT", ":feature_RU", ":feature_TH", ":feature_ZH_rHK", ":feature_ZH_rTW"]
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // -----------  mandatory libs -----------------------
    implementation project(':libcocos2dx')

    // minSdkVersion 21
    implementation 'com.android.support:multidex:1.0.3'

    // ----------- IAP Billing -----------------------
    implementation 'com.android.billingclient:billing:3.0.0'

    // ----------- firebase -----------------------
    // Add the dependency for the Firebase SDK for Google Analytics
    implementation 'com.google.firebase:firebase-analytics:17.5.0'

    // Add the dependencies for any other desired Firebase products
    implementation 'com.google.firebase:firebase-messaging:20.3.0'
    implementation 'com.google.firebase:firebase-config:19.2.0'


    // ----------- admob mediation -----------------------
    // SDK Admob

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-ads:19.7.0'

    def lifecycle_version = "2.0.0"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"

    implementation 'com.google.android.play:core:1.3.4'
}

task cleanAssets(type: Delete) {
    delete 'assets'
}

task copyAssets {

    copy {
        from '../../Resources/'
        into 'assets/'
    }
}

clean.dependsOn cleanAssets
preBuild.dependsOn copyAssets

apply plugin: 'com.google.gms.google-services'

got stuck in this case for 2 days, Any help would be appreciated, Thanks.

That is definitely not correct. It should be like this (straight out of the template-generated project):

        ndk {
            abiFilters = []
            abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
        }

Otherwise it won’t be using the PROP_APP_ABI setting in the build.properties file.

I see …Thanks !

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.