I have a third-party library that comes with .jar and .so files.
I configured pom.xml as follows:
<dependency> <groupId>com.abc.def</groupId> <artifactId>sdc</artifactId> <version>1.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.abc.def</groupId> <artifactId>sdc</artifactId> <version>3</version> <scope>compile</scope> <type>so</type> </dependency>
Using this configuration, I successfully tested the Intellij and apk files under an object containing a structure like lib / armeabi / sdc.so
However, after I made mvn clean package , the generated apk file did not contain the sdc.so file, and after installing the apk file on the Android device, the lib folder is empty.
Search over the Internet and did not find an answer.
Btw, I add <nativeLibrariesDirectory>${project.basedir}/libs</nativeLibrariesDirectory> to pluginManagement, as mentioned. Native libraries (.so files) are not added to the android project , but they do not help.
Update:
If someone is facing the same problem as me, so the SO file is not copied, try manually copying the file this way:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.1</version> <executions> <execution> <id>copy</id> <phase>prepare-package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.abc.def</groupId> <artifactId>libdef</artifactId> <version>2.1.3</version> <type>so</type> <destFileName>libdef.so</destFileName> </artifactItem> </artifactItems> <outputDirectory>${project.build.directory}/libs/armeabi</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build>
source share