gradle3android plugin,Android experimental gradle plugin & Android Studio 3

I have an Android project and we have been using the experimental Gradle Plugin for some time. with Android Studio 3 being announced and the move to Gradle 4, I have a couple of questions

In just looking no one has added a new experimental gradle release in a couple of months, and the last version 11 alpha is 3 months ago. Is this still being maintained?

Is there a better way to do complicated NDK builds then the experimental Gradle plugin? I did a little research and it looks like there is a way to have a cMake txt file and call that as they did with this Samba client

https://github.com/google/samba-documents-provider/tree/master/app

When I say complicated NDK build, I have a number of C++ libraries I'm pulling together. I have a bunch of custom c++ code, I have a couple of 3rd party libraries that have their own code as well as shared libraries. And I have a number of jni interface files to manage it all.

I shortened this example, but I have 12 so files.

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")

}

}

}

}

I then have the following for an NDK section

// 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()

])

}

`

Then also in the gradle I list all my jni sources

// 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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值