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?
Related
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 ;)
I work on android project. Firstly I have generated pom.xml to convert it into maven project. In pom.xml, I have to use Google Play Service Library as a library project for displaying map so that I have added dependency of Google Play Service Library in pom.xml. but when I am using mvn clean install command, It will throw warning
The POM for com.google.android.gms:google-play-services:jar:$(google-p
lay-services-version) is missing, no dependency information available
with error message :-
Failed to execute goal on project AndroidMap: Could not resolve dependencies for project com.androidMap:AndroidMap:apk:3.0.1-SNAPSHOT: Failure to
find com.google.android.gms:google-play-services:jar:$(google-play-services-vers
ion) in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of googlePlayService has
elapsed or updates are forced -> [Help 1]
Here is my code:
<properties>
<google-play-services-version>6.5</google-play-services-version>
</properties>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<version>$(google-play-services-version)</version>
<scope>provided</scope>
</dependency>
I need to include appcompat-v7 in a maven build. Please note this is a question about a library with resources and not a jar. It's currently an aar artifact. The documentations on the SDK Deployer does not cover version 23.1.0 or version 23.0.1. I need to know what dependency needs to be in pom to include the compatibility library. Its either aar or apklib, and or also the include of a jar file as well. If anyone has got this working I would appreciate it if you would share the correct pom dependency. This problem appears to have been solved here:
How can I add an apklib dependency to your android maven project?
but this solution expressed in latest Android would be:
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v7-appcompat</artifactId>
<version>23.1.0</version>
<type>apklib</type>
</dependency>
This does not work now because apklib is not what is there. It is aar and changing type to aar does not seem to work either. Resulting in lots of conflicts or missing classes or class conflicts. I can think of no more commonly needed library from SDK Deployer than this. So could someone please answer the quesiton. In addition, I think the documentation of the deployer should reflect current versions, not just versions that are years old. Thanks.
The documentation of the SDK deployer references all dependencies that are custom created in addition to the ones from the repositories of the SDK itself. You can run the deployer and deploy all the components into a repository manager like Nexus and then search there or you can browse the local file system repository in ~/.m2/repository. For example look in the directory ~/.m2/repository/com/android/support/appcompat-v7/
In your case you probably want to use something like
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>23.1.1</version>
<type>aar</type>
</dependency>
This is all mentioned in the docs. And the deployer is open source and I do accept pull requests ;-)
I am building my android app with Maven (ok... trying to build), after several errors I got to this one :
[ERROR] Failed to execute goal on project AndroidPro: Could not resolve dependencies for project com.kowalsk.android.recipe:AndroidPro:apk:1.0.0-SNAPSHOT: Could not find artifact com.google.android:android:jar:4.0.3 in central (http://repo.maven.apache.org/maven2) -> [Help 1]
I used maven-android-sdk-deployer and downloaded all needed libraries, but it haven't solved the problem.
When using maven-android-sdk-deployer : the stub for android libraries will be installed in your local maven repo with the groupId android (i.e. not com.google.android)
The groupId com.google.android is the official groupId used by google to publish some versions of android API. I don't know why only few versions are available (probably because maven wasn't the build tool choose by google for the android platform). We can hope that in a near future (mainly because google choose gradle as new build tool): all versions will be available with the groupId com.google.android in central repo.
In my local repo, the stubs installed with maven-android-sdk-deployer have also a special version number with _rX appended. So to use the 4.0.3 I have the following dependency :
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>4.0.3_r3</version>
<scope>provided</scope>
</dependency>
See the link Maven Android Jar, maven repository does not have the version you mentioned in your pom 4.0.3
use any version mentioned in the link.
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