Migrating Eclipse Android Project With Ndk And Gstreamer Usage To Android Studio
I have a perfectly working android project in Eclipse, the project includes NDK support and uses Gstreamer. When I migrate the project from Eclipse to Android Studio all sorts of p
Solution 1:
I suggest to move to AS but keep the NDK build "the traditional way". My main argument to defend this approach is that the experimental plugin is still a "moving target": the DSL changes all the time, and its limitations require workarounds that change with every release of the experimental plugin. The second reason is that 3 party tools like Fabric will not work with the experimental plugin.
For the non-experimental plugin, you can use the following piece in build.gradle:
def ndkBuild = android.ndkDirectoryimport org.apache.tools.ant.taskdefs.condition.Osif (Os.isFamily(Os.FAMILY_WINDOWS)) {
ndkBuild += '.cmd'
}
task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
commandLine '$ndkBuild', 'NDK_PROJECT_PATH="$jniSrc/..'
}
task cleanNative(type: Exec, description: 'Clean JNI object files') {
commandLine '$ndkBuild', 'clean', 'NDK_PROJECT_PATH="$jniSrc/..'
}
clean.dependsOn'cleanNative'
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
}
tasks.all {
task -> if (task.name.contains('compileDebugNdk') || task.name.contains('compileReleaseNdk')) task.enabled = false
}
Post a Comment for "Migrating Eclipse Android Project With Ndk And Gstreamer Usage To Android Studio"