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.
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 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?
I need to use Android API 21 (Lollipop) classes. I am using maven to build my Android project. I know I need to define dependency in order to build my project. So I defined the following one:
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
<version>4.1.1.4</version>
</dependency>
But the above latest artifact doesn't contain the support for Android API 21, also maven central repository shows me there is no artifact available for Android API 21 (Lollipop).
In order to make the maven build work, I am thinking to get the artifact jar & install it in my local maven repository.
My question is where can I download the android.jar artifact of Android API 21 (Lollipop) ? If there is no place to download it, what could be a workaround for my maven build?
I'm not sure if there are better ways to solve this from a Maven point of view, but since the question was where you can download the android.jar artifact, here's a solution to that. You can download the stand-alone Android SDK tools and then use SDK Manager to download your desired version of the Android SDK. Once you've downloaded it you'll find the android.jar under ./platforms/android-21/
Where I can find the Google Analytics Android lib groupId and archetype for my projects pom?
I've been searching for it for a couple of hours, and I can't find any clue...(
P.S. I found something on GitHub, but it seam like it uses an third-party repository (when I try to run mnv install or compile it gives me an error):
<dependency>
<groupId>com.google.android.analytics</groupId>
<artifactId>analytics</artifactId>
<version>2</version>
</dependency>
You can install all missing android libs using maven-android-sdk-deployer.
It installs all extras in local maven repository from android sdk folder. Usage is quite simply: download and run mvn install. Deployer itself doesn't support optional dependencies other than sdk version. You must install all jars via SDK Manager at first.
Update: Upon writing this answer Google has landed updates to SDK Manager and included 2 maven repositories in it: Google Repository and Android Support Repository. All you have to do is add them to repositories list in pom.xml. It provides following artifacts:
support library (v4, v13)
gridlayout (v7)
google play services (3.1.36)
As you can see it doesn't have analytics artifacts, so you still need maven-android-sdk-deployer
Starting with Google Analytics SDK v4, Google Analytics is part of Google Play Services.
There's no need for a separate dependency anymore.
https://developers.google.com/analytics/devguides/collection/android/changelog
I have an Android Project where I need to build multiple versions of the same application from the same sources.
To do this, I use the android plugin for Maven
Each version must be able to include ads from admob. So in my POM I added this dependancy
<dependency>
<groupId>com.admob.android</groupId>
<artifactId>ads</artifactId>
<version>20101109-ANDROID-3312276cc1406347</version>
<scope>system</scope>
<systemPath>THE_PATH\libs\admob-sdk-android.jar</systemPath>
</dependency>
I don't get any errors at build time but, when I execute the application I get this exception
java.lang.ClassNotFoundException: com.admob.android.ads.AdView
So apparently the package is not properly included ?
You can NOT use system scope for runtime required libraries. Deploy the jar into your local repository or your repository server (using e.g. mvn install:installFile ..) and remove scope and systemPath from the dependency declaration.
Update: As of the latest releases my Maven Android SDK Deployer can do the install of the AdMob jar from the SDK into your local Maven repository or repository server for you.
To use the Maven Android SDK Deployer, do the following:
Clone the repo:
git clone https://github.com/mosabua/maven-android-sdk-deployer.git
Go to your SDK Manager and install all APIs (this may take a while if you haven't done it yet)
Make sure you have the correct environment variable set for ANDROID_HOME. For Windows this might be:
set ANDROID_HOME=c:/android-sdk-windows
Run the installer:
c:\Tools\maven-android-sdk-deployer>mvn install
After you have done this you can just use all the android dependencies from your pom.xml, e.g.
<dependency>
<groupId>com.google.android.admob</groupId>
<artifactId>admob</artifactId>
<version>6.4.1-r11</version>
</dependency>
(There's a whole list on the github page)