I ont un projet Android et nous avons utilisé le plugin Gradle expérimental pendant un certain temps. avec Android Studio 3 étant annoncé et le passage à Gradle 4, j'ai quelques questionsplug-in gradle expérimental Android et Android Studio 3
En regardant simplement personne n'a ajouté une nouvelle version gradle expérimentale dans quelques mois, et la dernière version 11 alpha est il y a 3 mois. Est-ce toujours le cas?
Y at-il une meilleure façon de faire compliqué NDK construit alors le plugin Gradle expérimental? Je l'ai fait un peu de recherche et il semble qu'il y ait un moyen d'avoir un cVérifiez fichier txt et appeler comme ils le faisaient avec ce client Samba https://github.com/google/samba-documents-provider/tree/master/app
Quand je dis compliqué à construire NDK, j'ai un certain nombre de Bibliothèques C++ que je rassemble. J'ai un tas de c personnalisé code ++, j'ai deux ou trois bibliothèques 3ème partie qui ont leur propre code ainsi que les bibliothèques partagées. Et j'ai un certain nombre de fichiers d'interface jni pour gérer tout cela.
Je raccourci cet exemple, mais j'ai 12 donc des fichiers.
model {
// this repositories section defines our list of external shared libraries
// included here are all nuance libs and python 3.5
repositories {
libs(PrebuiltLibraries) {
lib1 {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("src/main/jniLibs/${targetPlatform.getName()}/lib1.so")
}
}
lib2{
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("src/main/jniLibs/${targetPlatform.getName()}/lib2.so")
}
}
}
}
J'ai alors ce qui suit pour une section NDK
// defines the NDK build
ndk {
moduleName "myApp"
toolchain = "clang"
// We set the platform for the NDK. with the a certain device we were getting missing libraries without it
// https://github.com/android-ndk/ndk/issues/126
platformVersion="23"
// If switching to GNU, here are the values to replace with
stl "gnustl_shared"
CFlags.addAll(["-DNDEBUG"])
cppFlags.addAll(["-fexceptions", "-std=gnu++11"])
// when adding system library dependencies, they are added here
ldLibs.addAll(["log","atomic"])
// C include directories
CFlags.addAll(["-I${file("src/main/jni/lib1/inc")}".toString(),
"-I${file("src/main/jni/lib2")}".toString()
])
// C++ include directories
cppFlags.addAll(["-I${file("src/main/jni/lib1/inc")}".toString(),
"-I${file("src/main/jni/lib1")}".toString(),
"-I${file("src/main/jni/lib2")}".toString(),
"-I${file("src/main/jni/lib2/os")}".toString(),
"-I${file("src/main/jni")}".toString()
])
}
`
Puis aussi dans la gradle je liste toutes mes sources JNI
// this section is to list the NDK static/shared library dependencies
// these dependencies are defined in detail above in the repositories section
sources {
main {
jni {
dependencies {
library "lib1"
library "lib2"
library "lib3"
library "lib4"
library "lib5"
library "lib6"
library "lib7"
library "lib8"
library "lib9"
library "lib10"
library "lib11"
library "lib12"
}
}
}
}