Android- How to consume aar file in maven build - android

I am using gradle build for Developer environment and in production environment.
I am using maven build. In my project I am using Google play services 7.8.0,
I started using play services aar file, but maven build needs a jar file.
so how can i get the jar file or is there a way that i can consume aar file maven build?

How about Android maven plugin and:
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<version>7.8.0</version>
<type>aar</type>
</dependency>
I'm not sure if I got you right, but you should use one project management tool for all you environments. That way you avoid problems with differences in dev/release builds! Use gradle everywhere ;)

Related

Installing Sevntu in Android Studio

I am wondering how I can install Sevntu on Android Studio without using the JAR. I've added the maven url and everything works when I point to the local JAR file during the third-party configuration for Checkstyle, but is there a way to not use the JAR?
Thank you!
Unfortunately not. At the time of this writing (early 2019), you must use the JAR.
The Checkstyle plugin does not currently support build tool integration, and that is a feature that is also not on the roadmap at the moment (#107).
Since you are using maven, just include the sevntu maven plugin as a dependency with checkstyle.
Example: https://github.com/checkstyle/checkstyle/blob/c0e131dbc43a17537498432b14cc7e7743ecf407/pom.xml#L547-L551
<dependency>
<groupId>com.github.sevntu-checkstyle</groupId>
<artifactId>sevntu-checkstyle-maven-plugin</artifactId>
<version>1.32.0</version>
</dependency>

How to include compatibility v7 library maven build?

Here is error:
java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr
What is the correct procedure to include a library with resources like this?
I'm trying to include android compatibility v7 library in apk. it compiles but cannot find resources at runtime. I uploaded the compatibility library to my local repo (jar file only), and included it as a maven dependency as follows:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v13</artifactId>
<version>23.1.0</version>
</dependency>
Is this enough to get the resources included too? It just downloads a jar which is all I uploaded to my local repo. How do I include the resources as well in the maven build? If we used the maven sdk deployer instead would including the maven dependency alone be enough? or do I need to create whole project and somehow link to library? This is being built on server so I need pom to pull everything needed. How do I get it included as library not just jar?
I think you have remaining below maven tag in dependency.
please add this:
<type>jar</type>
Check this link for more.

Using Facebook Android library from Maven Central

I am trying to use com.facebook.android:facebook-android-sdk:3.23.1 in my Android Maven build.
From its pom we can see that it depends on com.android.support:support-v4:
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>[21,22)</version>
<scope>compile</scope>
</dependency>
When I install the support-v4 library using maven-android-sdk-deployer, the library is installed as aar. However, Maven defaults to looking for the jar, and I get this error message:
Failed to collect dependencies at
com.facebook.android:facebook-android-sdk:aar:3.23.1 ->
com.android.support:support-v4:jar:[21,22): No versions available for
com.android.support:support-v4:jar:[21,22) within specified range -> [Help 1]
How are people managing to use the Maven versions of this Facebook library in their projects? This question suggests just using the framework source in your project, can't we do better?

How to use new Admob with ANT

I'm tryng to setup the new AdMob SDK using instructions on this Google site for ANT (not gradle).
This answer talks about the same problem, but it was asked before google decided to do awat with .jars distribution for Admob and included it in google play services.
I am baffled that the official site does not even talks about ANT configuration at all.
Is there a way to set it up, or do I have to give up and use gradle instead ?
If you use Ant you are pretty much on your own.
You will need to :
Unpack the Google Play Services AAR
Add each of the embedded jars onto your build classpath
Add each of the embedded jars onto your DEX path
Or you can use Maven or Gradle.
If you are using Maven (my choice) then just add the following dependency to your project. NB you will want to include the android-maven-plugin in your POM too.
https://github.com/simpligility/android-maven-plugin
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services</artifactId>
<version>${play-services.verson}</version>
</dependency>

Android Eclipse project compilation errors with maven provided dependency

I'm converting an android application to be maven-based
what I've done is:
Insert pom.xml
List item
copy java classes into main/java directory and make this directory
the source path
insert the maven nature into .project file
I add the google android library dependency into pom.xml:
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
<scope>provided</scope>
</dependency>
I then realised that I don't need the android library to be included in the class path as I'm actually refering it from the pom.xml
So I removed the library, and what happend is the the project has compilation errors, though It exports the apk successfully when I right click > Run As> Maven Install, and this means that this project is a correct project from a maven perspective, so what's wrong with eclipse ??
What I found is that the Maven Dependency Library is abscent when I set the library scope as provided,
<scope>provided</scope>
but is back when I set the dependency to it's default(Compile),
<scope>compile</scope>
Though this scope makes maven fail to package as this library is a core library that must not be included, and anyway I find it a terrible solution even if it's packaging well
What am I missing here ??
NB: I'm using MotoDev IDE
It turned out that there is an issue with the android-maven-plugin with apk packaging ... will post the solution when solved

Categories

Resources