Android: adding Android library as maven dependency in project

I created an Android library. It has all the main code. I also created a project called App1. I referenced the library through maven in App1. I also made a link in the Project-> Properties-> Android-> Reference to the library.

When I create a project via cygwin using " mvn install ", I get the following error.

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2. 3.2:compile (default-compile) on project App1: Compilation failure: Compil ation failure: [ERROR] \LIBRARYPROJECT\Branding-Private\App1\src\main\java\comxyz\main\AApplication.java:[3,42] cannot find symbol [ERROR] symbol : class AApplication 

** This AAplication class is in the library project. He cannot refer to it. This project was able to reference it without maven before. After using maven, it cannot reference it.

Can anyone help?

Thanks, Sneha

+4
source share
2 answers

You can try the maven-android-plugin ApkLib .

+3
source

You need to install the library project in the local repository because the help library is not built when using maven.

1) Install the library in the local repository as follows:

-Dfile means where your .jar is located.

 mvn install:install-file \ -DgroupId=com.admogo \ -DartifactId=AdsMOGO-SDK \ -Dpackaging=jar \ -Dversion=1.0 \ -Dfile=AdsMOGO-SDK-Android.jar \ -DgeneratePom=true 

2) Add the dependency to the pom.xml file as follows:

 <dependency> <groupId>com.admogo</groupId> <artifactId>AdsMOGO-SDK</artifactId> <version>1.1</version> </dependency> 
0
source

Source: https://habr.com/ru/post/1394161/


All Articles