2016-06-03 6 views
4

로그 메시지를 삽입하여 JNI C 함수를 디버깅하려고하는데 작동하지 않습니다. 여기오류 :() 정의되지 않은 '__android_log_write'참조 오류?

__android_log_write(prio, sTag, buf); 내 android.mk이다 : 나는 모든 노력을하지만 난이 오류가 :이 라인에서

Error:(61) undefined reference to `__android_log_write' 

을 나는 두 개의 파일 .gradle이

LOCAL_PATH := $(call my-dir) 
include $(CLEAR_VARS) 
# Here we give our module name and source file(s) 
LOCAL_MODULE := engine 
LOCAL_SRC_FILES := engine.c common.c effiindexb.c alertsmanager.c 
LOCAL_CFLAGS += -std=c99 
#APP_CFLAGS += -std=c99 
LOCAL_LDLIBS := -llog 
include $(BUILD_SHARED_LIBRARY) 

, 여기에 처음이다 하나 여기

apply plugin: 'com.android.model.application' 

model { 
android { 
    compileSdkVersion = 23 
    buildToolsVersion = "23.0.2" 

    defaultConfig { 
     applicationId = "com.effidriver" 
     minSdkVersion.apiLevel = 16 
     targetSdkVersion.apiLevel = 23 

    } 
    ndk { 
     moduleName "engine" 
     toolchain = 'clang' 
     CFlags.addAll(['-Wall']) 
    } 

    buildTypes { 
     release { 
      minifyEnabled = false 
      proguardFiles.add(file('proguard-rules.txt')) 
     } 
    } 

    productFlavors { 

     create("arm") { 
      ndk.abiFilters.add("armeabi") 
     } 
     create("arm7") { 
      ndk.abiFilters.add("armeabi-v7a") 
     } 
     create("arm8") { 
      ndk.abiFilters.add("arm64-v8a") 
     } 
     create("x86") { 
      ndk.abiFilters.add("x86") 
     } 
     create("x86-64") { 
      ndk.abiFilters.add("x86_64") 
     } 
     create("mips") { 
      ndk.abiFilters.add("mips") 
     } 
     create("mips-64") { 
      ndk.abiFilters.add("mips64") 
     } 
     // To include all cpu architectures, leaves abiFilters empty 
     create("all") 
    } 
    } 
    } 

dependencies { 
compile project(':library') 
compile 'com.android.support:support-v4:23.3.0' 
compile 'com.google.code.gson:gson:2.3.1' 
compile 'com.google.code.gson:gson:2.2.4' 
compile files('libs/TestFlightLib.jar') 
compile project(path: ':library') 
compile project(path: ':library') 
} 

와는 seconde .gradle입니다 :

apply plugin: 'com.android.model.library' 

model { 
android { 
    compileSdkVersion = 'Google Inc.:Google APIs:17' 
    buildToolsVersion = "24.0.0 rc3" 

    defaultConfig { 
     minSdkVersion.apiLevel = 16 
     targetSdkVersion.apiLevel = 23 
    } 

    buildTypes { 
     release { 
      minifyEnabled = false 
      proguardFiles.add(file('proguard-rules.txt')) 
     } 
    } 
} 
} 

dependencies { 
    compile 'com.android.support:support-v4:23.0.0' 
} 

나는 gradle experimental을 사용하고 있습니다. classpath 'com.android.tools.build:gradle-experimental:0.7.0'

나는 정말 인터넷을 통해 검색하고 좋은 해결책을 얻지 못했지만 여기에서 찾을 수 있기를 바랍니다. 고맙습니다!

답변

2

은 다음과 같이 모듈 Gradle을 파일 NDK 블록을 수정하려고 :

ndk { 
     platformVersion = 21; 
     moduleName "engine" 
     toolchain = "clang" 
     stl = 'gnustl_static'   
     cppFlags.addAll(['-std=c++11', '-Wall', '-D__STDC_INT64__']) 
     ldLibs.addAll(['android', 'log'])   
    } 
+0

왜'툴체인 = "그 소리는"'필요하다? –

+0

이것은 빌드 시스템이 이미 있고 크로스 컴파일러를 호출하여 Android에 지원 기능을 추가하기 만하면 유용 할 수 있습니다. –