1
我正嘗試在Android Studio 2.2中加載一箇舊的c項目(用於android 5.1,API 22)。源代碼包括使用android記錄器。當我在工作室製作這個項目時。該工作室報告一些錯誤:錯誤:「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'
...
我試圖登錄庫添加到搖籃腳本
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中添加日誌庫?
謝謝。
感謝您的回覆丹。我試圖將targetSdkVersion更改爲21.但仍具有相同的構建錯誤。我還檢查了ndk-bundle/platforms/android-22//lib liblog.so在那裏。所以我認爲這個問題一定是由於缺少Gradle配置引起的。 –
r0ng