[英]Android experimental gradle plugin & Android Studio 3
我有一個Android項目,並且一段時間以來我們一直在使用實驗性Gradle插件。 隨着Android Studio 3的發布和Gradle 4的發布,我有幾個問題
僅僅幾個月,沒有人添加新的實驗性Gradle版本,而最新的11 alpha版本是3個月前。 這仍然保持嗎?
有沒有比實驗性Gradle插件更好的方法來進行復雜的NDK構建? 我做了一些研究,看來有一種方法可以像使用此Samba客戶端一樣來獲取cMake txt文件並調用該文件https://github.com/google/samba-documents-provider/tree/master/app
當我說復雜的NDK構建時,我會收集許多C ++庫。 我有一堆自定義的c ++代碼,我有幾個第三方庫,它們都有自己的代碼以及共享庫。 我有許多jni接口文件來管理所有這些。
我簡化了這個示例,但是我有12個so文件。
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")
}
}
}
}
然后,我在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()
])
}
`
然后也在gradle中列出我所有的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"
}
}
}
}
因此,請回答我上面的問題。
宣布0.11.0之后將不再支持實驗性gradle插件。 所以不,它不再被維護。
我的項目已轉換為使用CMake。 使用最新的gradle 4.1並將所有內容轉換為CMake和CMakeLists.txt類型的構建,我們能夠在沒有實驗版gradle的情況下構建項目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.