简体   繁体   中英

Disable NDK build in gradle for specific project

I have an android library project that builds lib.aar artefact and an app project that imports this lib.aar after it was built. lib.aar requires NDK 17 to be built since it has some C++ 17 code. I manage to build .aar file successfully but the app fails to compile with this message: A problem occurred starting process 'command '/Users/user/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip'' . This is caused by the fact that NDK 17 removed support for MIPS and I can't upgrade to a newer version of android studio that uses NDK 18beta

If I remove the content of '/Users/user/Library/Android/sdk/ndk-bundle' folder, deleting the NDK, then the app builds without errors and I can use lib.aar code inside the app.

So far I've tried this: How do I disable the NDK build in Android Studio 1.0.1 , this https://gist.github.com/ph0b/9e59058ac59cac104398 . Setting env variable ANDROID_NDK_HOME to a dummy folder works, the app builds, but it's kind of a hack.

Is there any way to programmatically disable NDK build for the app project without deleting NDK folder?

This is caused by the fact that NDK 17 removed support for MIPS and I can't upgrade to a newer version of android studio that uses NDK 18beta

r18 won't fix this problem either; it still doesn't have mips support. The fix to the problem is upgrading the gradle plugin version in your application to at least 3.1, which is the minimum required for NDK r17 (and, extremely unfortunately, is required for even having the NDK installed for some reason).

The other solution here would be to install NDK r16b somewhere and then point at it from the app's local.properties, letting the aar pick from the SDK. If you're just working on a local build this will work, but since local.properties shouldn't be checked in to version control it won't help others much.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM