Can't print log messages from JNI with Android Studio

后端 未结 3 1236
有刺的猬
有刺的猬 2021-01-12 06:13

Error I\'m getting:

error: undefined reference to \'__android_log_print\'

I\'ve already added this line to my .cpp file:

3条回答
  •  走了就别回头了
    2021-01-12 06:47

    It seems that using Gradle + Android Studio the Android.mk file is ignored.

    As explained here, try adding the following directive to your build.gradle:

    android {
        defaultConfig {
            ndk {
                moduleName "modulename"
                ldLibs "log"
            }
        }
    }
    

提交回复
热议问题