Giter Club home page Giter Club logo

Comments (3)

nhachicha avatar nhachicha commented on July 25, 2024

Hi,

This is the convention, the module name is used to name the generated file as a result of the build process (if you build from NDK a module name hello-jni the generated shared library will be named as libhello-jni.so)

also from the http://developer.android.com/training/articles/perf-jni.html (Native Libraries Chapter)

-- The argument is the "undecorated" library name, so to load "libfubar.so" you would pass in "fubar".

from android-native-dependencies.

jersilver avatar jersilver commented on July 25, 2024

Hi Nabil,

Thank you for the quick reply.

Where this seems to become a problem is if the module name always has "lib" prefixed to the name. Here's an example:

We use SqlCipher to encrypt Sqlite DBs. SqlCipher provides native (.so) libraries that already have "lib" prefixed on the file name. For example, one of the files is "libdatabase_sqlcipher.so".

When we use the plugin, an extra "lib" is prefixed on the name, so we get "liblibdatabase_sqlcipher.so", which is not correct. I'd rather modify the plugin than change the name of the files we get from the vendor.

One suggestion/enhancement for the tool would be to check if "lib" is already prefixed on the name OR, have a parameter/option to control the prefixing.

Thanks,
~Jeremy

from android-native-dependencies.

nhachicha avatar nhachicha commented on July 25, 2024

Interesting...
AFAIK SqlCipher never made it to maven central (or any other public repo) see issue #33

so I guess you're installing manually the lib using mvn install:install
if this is the case, you need to follow the convention above, so maven will create the correct POM.xml (without the lib prefix as part of the artifact name)

Example:

  • remove previous installation of SqlCipher
rm -Rf  ~/.m2/repository/net/sqlitecipher/ 
  • install correctly the native lib
mvn install:install-file -Dfile=libdatabase_sqlcipher.so -DgroupId=net.sqlitecipher -DartifactId=database_sqlcipher -Dversion=2.1.1 -Dpackaging=so -Dclassifier=armeabi

notice how artifactId doesn't include the lib prefix

maven will create the following POM.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>net.sqlitecipher</groupId>
  <artifactId>database_sqlcipher</artifactId>
  <version>2.1.1</version>
  <packaging>so</packaging>
  <description>POM was created from install:install-file</description>
</project>

now you can use your library using the Gradle plugin as follow:

native_dependencies {
    artifact 'net.sqlitecipher:database_sqlcipher:2.1.+:armeabi'
}

Hopefully this will work for you.

from android-native-dependencies.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.