How to compile C/C++ native code in Android Studio 4

I was trying to add C/C++ native code found in a project found in github (here is the link).

  1. I first moved jni folder into src/main folder

  2. I added below lines in my Gradle under android

     externalNativeBuild {
         ndkBuild {
             path 'src/main/jni/Android.mk'
         }
     } 
    
  3. When I tried to sync with Gradle I get below errors:

make: No rule to make target C:/Users/PATH_TO_PROJECT/app/libjitsi/src/main/jni/opus/celt/bands.c

, needed by 'C:/Users/PATH_TO_PROJECT/app/libjitsi/build/intermediates/ndkBuild/debug/obj/local/x86/objs-debug/jnopus/celt/bands.o'.

Stop. executing external native build for ndkBuild C:\Users\PATH_TO_PROJECT\app\libjitsi\src\main\jni\Android.mk CONFIGURE SUCCESSFUL in 8s

Can anyone help me conpile those files with clear steps on How He proceeded ?

Upvotes: 1

Views: 490

Answers (1)

I discovered that The project missed a library named Opus audio codec (here is their github repository).

  1. I downloaded the source code of opus
  2. I unzipped it. And placed all its files and folder under opus folder located at src/main/jni
  3. I deleted the win32 folder and test folder And it successfully built the project

Upvotes: 2

Related Questions