【发布时间】:2017-02-20 15:44:02
【问题描述】:
我正在尝试在 Android Studio 2.2 中加载旧的 c 项目(适用于 android 5.1,API 22)。源代码包括使用 android 记录器。当我在工作室构建项目时。工作室报一些错误:
Error:(34, 21) error: '__android_log' was not declared in this scope
Information:(84, 5) in expansion of macro 'LOGD'
Warning:(35, 79) warning: format '%s' expects argument of type 'char*', but argument 10 has type 'void*' [-Wformat=]
Information:(91, 9) in expansion of macro 'LOGI'
Error:(34, 35) error: expected ';' before '_print'
Information:(102, 5) in expansion of macro 'LOGD'
Error:(34, 21) error: '__android_log' was not declared in this scope
Information:(107, 5) in expansion of macro 'LOGD'
...
我尝试将日志库添加到 Gradle 脚本中
productFlavors {
fat {
dimension "abi"
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86"
versionCode = 0;
ldLibs.addAll(["log"]) // <- not working
}
minSdkVersion 21
targetSdkVersion 22
}
armv7a {
dimension "abi"
ndk {
abiFilter "armeabi"
versionCode = 1;
ldLibs "log" // <- not working neither
}
minSdkVersion 21
targetSdkVersion 22
}
}
但工作室报错:Error:(71, 0) Could not get unknown property 'ldLibs' for ProductFlavor_Decorated。
有人知道如何在android studio 2.2 中添加日志库吗?
谢谢。
【问题讨论】:
标签: c android-studio android-ndk android-gradle-plugin