How to use new Admob with ANT - android

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>

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>

Android- How to consume aar file in maven build

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 ;)

integrating maven dependency into android Eclipse project, no JAR file

Ok, so, I'm developing an app for the Amazon FireTV, so I have to use Eclipse.
I'm trying to use this socket.io Java client library: https://github.com/nkzawa/socket.io-client.java
at the bottom of this post, i included the installation instructions, which I'm not really sure how to make work with my existing Eclipse project (I'm new to maven). so from my understanding, do i just add a pom.xml file and a test folder? Then paste in their "maven central code" into the pom.xml? Will this cause any issues with the other code in my project? Or, can I just copy and paste all their SRC code into my project, since it's MIT licensed? I'd rather learn how to do this the proper way. The project is not in JAR format, so I was thinking maybe copying the folder structure into my project then using the Project Properties, Add Library option to connect to my code? Maybe?
Their installation instructions, (available in their readme.md):
The latest artifact is available on Maven Central. Add the following dependency to your pom.xml.
<dependencies>
<dependency>
<groupId>com.github.nkzawa</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.3.0</version>
</dependency>
</dependencies>
Or to install it manually, please refer dependencies to pom.xml.
Add it as a gradle dependency for Android Studio, in build.gradle:
compile 'com.github.nkzawa:socket.io-client:0.3.0'
So, I learned that Maven Central has JAR files available for download. That way, you can just include them in your project via the Project Properties dependencies options. Without having to learn Maven.
You need to first understand how Maven works (and what pom.xml stands for). Maven is a tool that helps you automatically install dependencies (files need) for a given project. E.g if a project needs to process json files, it will need to "import" a json library which will then be a dependency for that project. When you add the dependency file above to your project, and run Maven install, it goes and fetches all the dependencies for your socket.io-client to work.
Unfortunately, Maven does work very well in building android application projects and can be fairly complex to setup correctly (from my limited experience). I would advise that you manually download the jar dependencies and then add them to your android classpath if you are not keen on investing a lot of time learning to use Maven.
To manually install the files .. you can create a default maven project (http://www.tech-recipes.com/rx/39279/create-a-new-maven-project-in-eclipse/) in eclipse, add the dependency file above to your pom.xml and run Maven-install. This will download the dependencies you need to your Maven local repository. You can then copy them from there to your android project.
Regarding installing the socket.io client you can find more on these steps here
http://denvycom.com/blog/socket-io-java-android-without-maven/

Add Google Analytics Library to a Maven Project

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

Android AdMob and Maven

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)

Categories

Resources