Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access to https://ph0b.com/android-studio-gradle-and-ndk-integration/ #19

Open
PaulFICOT opened this issue Oct 9, 2020 · 1 comment

Comments

@PaulFICOT
Copy link

No description provided.

@pariazar
Copy link

pariazar commented Oct 9, 2020

with Android Studio, NDK support is preliminary and your *.mk files are ignored. You can make Android Studio/gradle reuse them by deactivating the default NDK integration, make it call ndk-build(.cmd) by itself, and use standard libs/ location for integrating .so files:

` import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'android'

android {
compileSdkVersion 19
buildToolsVersion "19.0.3"

defaultConfig{
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 101
    versionName "1.0.1"
}

sourceSets.main {
    jniLibs.srcDir 'src/main/libs'
    jni.srcDirs = [] //disable automatic ndk-build call
}

// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
        commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath
    } else {
        commandLine 'ndk-build', '-C', file('src/main').absolutePath
    }
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn ndkBuild
}

} `

If you need more information, here is my blog post on this topic: http://ph0b.com/android-studio-gradle-and-ndk-integration/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants