Mein Android-Projekt läuft seit einigen Jahren mit Eclipse und ADT. Das Projekt nutzt 3 vorkompilierte statische Bibliotheken (curl, ssl, und Krypto), und dann kompiliert und verknüpft statisch libxml2 in die entsprechenden Zeilen aus Android.mk sind.Erstellen von libxml2 in NDK mit Android Studio und Gradle Experimental
LOCAL_MODULE := my_shim
LOCAL_SRC_FILES := $(LOCAL_FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_CFLAGS := -DCURL_DISABLE_TYPECHECK
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lz
LOCAL_SHARED_LIBRARIES :=
LOCAL_STATIC_LIBRARIES += xml2 curl ssl crypto
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../c_module
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../libxml2/include
include $(BUILD_SHARED_LIBRARY)
include $(APP_LOCAL_PATH)/../../libxml2/Android.mk
ich jetzt Android Schalt bin Studio 2 benutzt Gradle Experimental, aber ich habe Probleme, die Gradle-Konfiguration richtig zu machen. Ich denke, ich habe es geschafft, die Abhängigkeiten von log und z und den statisch kompilierten curl-, ssl- und crypto-Bibliotheken zu sortieren, aber ich kann nicht herausfinden, wie man es erstellt und dann das libxml2-Modul statisch verknüpft.
Irgendwelche Hinweise? Das ist, was ich bisher habe:
model {
android {
...
}
android.ndk {
moduleName "my_shim"
platformVersion 19
abiFilters.addAll(["armeabi", "x86"])
CFlags.add("-DCURL_DISABLE_TYPECHECK")
ldLibs.addAll(["log", "z"])
stl "stlport_static"
}
android.sources {
main {
jni {
dependencies {
library "crypto" linkage "static"
library "curl" linkage "static"
library "ssl" linkage "static"
library "xml2" linkage "static"
}
}
}
}
repositories {
libs(PrebuiltLibraries) {
crypto {
binaries.withType(StaticLibraryBinary) {
def cryptoLibPath = "src/main/jni/includes/${targetPlatform.getName()}/libcrypto.a"
staticLibraryFile = file("${cryptoLibPath}")
}
}
}
libs(PrebuiltLibraries) {
curl {
binaries.withType(StaticLibraryBinary) {
def curlLibPath = "src/main/jni/includes/${targetPlatform.getName()}/libcurl.a"
staticLibraryFile = file("${curlLibPath}")
}
}
}
libs(PrebuiltLibraries) {
ssl {
binaries.withType(StaticLibraryBinary) {
def sslLibPath = "src/main/jni/includes/${targetPlatform.getName()}/libssl.a"
staticLibraryFile = file("${sslLibPath}")
}
}
}
}
}
Haben Sie an den sah ** hallo-Libs ** Probe von Google? https://github.com/googlesamples/android-ndk/tree/master/hello-libs. Sie demonstrieren diese Einstellung ziemlich gut. –
Dank @IgorGanapolsky - dieses Projekt bietet sicherlich mehr Beispiele als alle anderen, die ich gesehen habe. –