Cannot build C++ application using gradle in Android

Viewed 34

I'm an Android 11 user who is trying to build simple C++ application with gradle.

I have gcc and clang installed and working on my phone.

I used gradle init to create a C++ application using Groovy.

When i run gradle build in termux, i get the following message:

> Task :app:compileDebugCpp FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugCpp'.
> Error while evaluating property 'compilerVersion' of task ':app:compileDebugCpp'
   > No tool chain is available to build C++ for host operating system 'Linux' architecture 'aarch64':
       - Tool chain 'visualCpp' (Visual Studio):
           - Visual Studio is not available on this operating system.
       - Tool chain 'gcc' (GNU GCC):
           - Don't know how to build for host operating system 'Linux' architecture 'aarch64'.
       - Tool chain 'clang' (Clang):
           - Don't know how to build for host operating system 'Linux' architecture 'aarch64'.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed

my build.gradle file looks like this:

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample C++ project to get you started.
 * For more details take a look at the Building C++ applications and libraries chapter in the Gradle
 * User Manual available at https://docs.gradle.org/7.4.2/userguide/building_cpp_projects.html
 */

plugins {
    // Apply the cpp-application plugin to add support for building C++ executables
    id 'cpp-application'

    // Apply the cpp-unit-test plugin to add support for building and running C++ test executables
    id 'cpp-unit-test'
}

// Set the target operating system and architecture for this application
application {
    targetMachines.add(machines.linux.architecture('aarch64'))
}

Any ideas?

0 Answers
Related