Open andrewgiang opened 11 years ago
Once NDK support gets added to the Android Gradle build system.
NDK support has been added to Gradle as of 0.7.0.
Any progress on this?
Im also in need of this.
Fortunately, library per se is really small, so I ended up copying the Java class, and the .so files to my project. But I'm still waiting for this to be upgraded.
Thank you for the tip at the moment i will wait for the aar. But I might do as you later if this is not fixed.
Hey @casidiablo , could you please explain where did you copy the Java classes and the .so files. thanks a lot! :D
I would also really appreciate aar packages.
@krngrvr09: The java files should just go into the src folder with the other java files (of course the package structure should be kept). I put the .so files in a folder called "native-libs" and use the following gradle script.
task copyNativeLibs(type: Copy) {
from(new File(getProjectDir(), 'native-libs')) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(PackageApplication) { pkgTask ->
pkgTask.jniFolders = new HashSet<File>()
pkgTask.jniFolders.add(new File(buildDir, 'native-libs'))
}
You can take a look at how I did it here
So I am putting Bypass.java
, Element.java
and Document.java
in the src folder. And, this might be a very trivial question, but where are the .so files?
You mean where you get them from? You have to compile it like described here Or do you mean where to put them? It doesnt matter as long as you modify the script accordingly (In the script and my example the folder "native-libs" is used.)
Oh yes. I got that. thank you so much for your help. :D I am now getting an error Error:(50, 0) Could not find property 'PackageApplication' on project <project_name>
. Have you encountered thisbefore, or do you know how to fix it? Thanks in advance.
Not really. Where did you add the script I posted? It should be added in the "build.gradle" file of the subproject.
Yeah, I added it there only. Is there anything else I should be aware of? I have not set up the NDK. Is that why the issue is coming? But as far as I understand, the NDK does the job of compiling the code, and putting the .so files in the required folder, which is exactly what we're skipping, right?
You have to compile them once and put them in the native-libs folder. After that the NDK isn't needed anymore.
Okay, understood. But this still doesn't solve the error posted above. Lets see. I'll keep you updated about the progress. Thanks again.
Hey! So, the build is now running successfully. I had to manually import PackageApplication
. So, now I am getting a different error: java.lang.UnsatisfiedLinkError: Native method not found: com.usebackpack.Bypass.processMarkdown:
. Any idea?
That usually means that Java could not find/load the native libraries. Are you sure they are in the APK?
Also, for an example of how I use the libs directly, take a look at https://github.com/casidiablo/github-jobs/tree/develop
Hey @casidiablo , You are not using android studio, right?
@krngrvr09 I do. But these days I use just plain IntelliJ.
@ekx Thanks for you post.
I would love that too, any updates on uploading an aar to maven central? Right now, using a git submodule and configuring it this way is not ideal.. https://github.com/RomainPiel/bypass/blob/master/platform/android/library/build.gradle
and update here?
@RomainPiel @nootfly NDK support in Gradle is very straight forward. Take a look at this article. http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/
:+1: this needs to be on gradle.
any progress on this?
I would be interested in this
:+1:
+1 gradle support
+1
+1
For your convenience, I have compiled Bypass into a gradle compatible library here: https://github.com/Commit451/bypasses
+1
really want gradle been supported.
To easily import the updated bypass library in android follow this link - https://github.com/amit-upadhyay-IT/bypass-android
Hi was wondering if you could add gradle support for this library thanks!