Where does the version string in generated Google Endpoint libs come from? - android

When I run the installClientLibs from Android Studio (with gradle command as well) for an Endpoint, the jar is generated with this name:
libEndpoint-v1-1.18.0-rc-SNAPSHOT
But since some days ago, it's being generated as:
libEndpoint-v1-1.19.0-SNAPSHOT
Where do the "18.0-rc" and the "19.0" come from? Why did it change? Is it due to a SDK update maybe?

This is the version of the Google libraries:
google-api-client-1.18.0-rc
google-api-client-android-1.18.0-rc
google-http-client-1.18.0-rc
google-http-client-android-1.18.0-rc
google-oauth-client-1.18.0-rc
These libraries are used to generate android client library for your Android module.
You can see them if you expand External Libraries section in Android Studio.
You can also check what is the latest version in Maven Repository. Just go to http://search.maven.org/ and type one of them. You will notice that 1.19.0 is the newest one as you posted.
If you would like avoid update Android module gradle file every time version changes, you can set your dependency like this:
compile project(path: ':backend', configuration: 'android-endpoints')
where backend is the name of the module. By the way, this is how Google Cloud Endpoint template generates configuration for a while. If you find any difficulties applying this way, try creating new project and generate backend module.

Related

Generate fat aar using android studio and gradle to include generated code

Is there a way to build a fat aar that includes all the generated code (for example, dagger and ButterKnife generated files) so the client does not have to compile those and is free of their dependency?
I'm trying to make an already made application "plug and play" in which we provide an aar to the client and have to import it. Currently it works but they need to import all our dependencies as well and their version of those dependencies (for example dagger might clash with ours. Also they need to build the generated files.
I have looked at the fat-aar plugin for gradle but it seems like it is outdated and does not work with recent android studio and gradle versions.

Compile latest google play-services as dependency in build.gradle file

Am using a Java plugin as I am building a very simple SDK for users to fire an HTTP request from their android phone.
My SDK is packages as a JAR which other users can import in their app and use the methods to fire the request.
I use Grade to build my project and get the Jar file. Until now, I was using a older version of Google Play-Services which had a jar file in my android_home/extras/google/google_play_services/libproject/google-play-services-libs/libs
But I upgraded my Google Play Services to latest version I see this path is no longer available. I see a new path and the packaging is changed to .aar.
I tried to follow some of the methods specified in this forum to convert this .aar file into jar and use it as a dependancy but when I unzip I could not see any classes.jar inside this .aar. I could only see AndroidManifest.xml and R.txt
I am unable to use compile fileTree option in Gradle. Please help me on how can I build my project or what modifications I need to do on my build.gradle file?
Current hack that I am doing is manually download the jar file from:
https://dl-ssl.google.com/android/repository/google_play_services_3159130_r09.zip and using compile fileTree option. I need to get rid of this manual step.
Looking for suggestions.

Why does the generated Cloud Endpoints library change its version now and then?

An App Engine project in Android Studio is (by default) configured to generate a client library, which can be consumed by an Android and/or iOS app.
Gradle is configured to auto-generate the library:
apply plugin: 'appengine'
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
Note there is no version specified anywhere here.
As specified in https://cloud.google.com/appengine/docs/java/endpoints/gen_clients, the library name is generated as
/target/<yourProjectVersion>.<versionString>-rc-SNAPSHOT.jar
This documentation is probably still from the rc candidate of Android Studio, as my library looks like this:
com.mydomain:api:v2-1.20.0-SNAPSHOT
I am using that library in a separate project:
compile 'com.mydomain:api:v2-1.20.0-SNAPSHOT'
This works fine, until Android Studio or gradle or Google or whoever changes the version number, here 1.20.0. Then my app compile breaks until I adjust the version in gradle.
Why is that? Can anybody tell me why the version stays stable for months and then suddenly changes from one day to another without any update or changes performed from my side. What is that version, who generates it, and can I control it when I generate it from my App Engine project?
NB: Given that the App Engine module and the Android app module are in the same project, Android Studio changes both versions and everything is fine. But when projects are separate, automated builds break.
The 1.20.0 version matches the version of the appengine endpoint client libs generation package for Maven, used to create your client libraries. Behind the scenes it is running the Maven goal appengine:endpoints_get_client_lib in order to build the JAR/AAR your Android app needs. Check your compile dependencies to see what version is being specified for appengine. If it is using a version with a + at the end then Gradle and Maven could be downloading newer versions of the plugins/SDKs which are used to build your endpoints as well as the libraries needed for client apps.
There's no documented way to override this version information using the Maven targets or Gradle. However, you could manually build the library using the endpoints.sh script in the AppEngine SDK which should allow you to set the version the way you want.

Importing Urban Airship in Android Studio gives compile issues?

I'm new to Android Studio and i want to implement Urban Airship in one of my projects. I followed the example on their website with the .aar file and I ended up getting this error.
Error: [/Users/AndroidstudioProjects/MyApplication/app/build/intermediates/exploded-aar/com.urbanairship/urbanairship-lib/5.1.0/AndroidManifest.xml:8]
Invalid instruction 'overrideLibrary', valid instructions are : REMOVE,REPLACE,STRICT
Correct me if I'm wrong but doesn't this mean that they have issues in their manifest file? Or am I completely out in the blue? If so, do anyone have a good example on how to implement it?
The Urban Airship SDK builds against Google Play Services that requires Android API 9, while Urban Airship is compatible with 6+. That is why we need the override library version. What android gradle plugin version are you using? You need to use 13.3 or greater. See http://tools.android.com/tech-docs/new-build-system.
In the projects build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.+'
}
}
I just had the same problem, and was able to fix it and build my project:
The offending line is line 8 of the AndroidManifest.xml
I just removed this line and changed some SDK versions.
You can open the file urbanairship-lib-5.1.0.aar using WinRar.
Navigate to the Manifest. Open it and edit within your favourite text editor.
Save and close the manifest. WinRar asks if you want to update the archive. Choose Yes!
According to this page, overrideLibrary is used for when you have minSDK version in a library > minSDK version in your project. So it allows a different version to be compiled instead, without errors.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-tools:overrideLibrary-marker
Remove, replace etc do something a bit different (also described on that page - scroll up).
Then in my projects build.gradle file I changed the version numbers to match my project:
From this
compile 'com.android.support:support-v4:21.+'
To this
compile 'com.android.support:support-v4:19.+'
Would be good to know what's the outcome of the OP's support ticket. Please keep us posted!
I ran into this issue as well evaluating the 5.1.0 version of the Urban Airship SDK. I am using Android Studio Beta 0.8.14. I contacted Urban Airship support and they told me to increment the version of gradle to 0.13.3. Android Studio 0.8.14 is defaulting to 0.13.2. After changing the version of gradle to 0.13.3 in the project build.gradle file I was able to successfully compile and import the new SDK.

Android Studio: where did "Install Client Libraries" go for Cloud Endpoints?

Back when I was using Android Studio 0.8.2, whenever I would make a change to an Google Cloud Endpoint in my App Engine backend for an Android project, I would then go to
Tools->GoogleCloudTools->InstallClientLibraries
which generated and installed (wrote them to a local maven repository) the client libraries.
That feature is no longer there in 0.8.9. How do I generate/install endpoint client libraries now? Where did that tool go?
Thanks.
There's two options here :
. You can call the gradle task directly "appengineEndpointsInstallClientLibraries"
. You can try using the new flow by including a configuration in your android build file
dependencies {
compile project(path: '<appengine-module>', configuration: 'android-endpoints')
}
which will automatically depend on client libraries defined in your app engine module and include any necessary dependencies.

Categories

Resources