I'm developing an android game with cordova 7.1.0 and I would love to know the meaning of the "+" symbol used on the "cordova_project\platforms\android\project.properties" file. So, what would be the difference between this:
cordova.system.library.1=com.google.android.gms:play-services-games:11.0.4
cordova.system.library.2=com.google.android.gms:play-services-plus:11.0.4
cordova.system.library.3=com.google.android.gms:play-services-ads:11.0.4
And this:
cordova.system.library.1=com.google.android.gms:play-services-games:11.0.4+
cordova.system.library.2=com.google.android.gms:play-services-plus:11.0.4+
cordova.system.library.3=com.google.android.gms:play-services-ads:11.0.4+
I really want to understand the use of the "+" symbol because after 1st of November I'll not be able to update older versions of my app because they don't target API 26. I don't want my old versions of the app being unable to login to Google Play Games or to stop showing ads.
Thanks a lot in advance
In Gradle, the "+" is for dynamic version of your dependencies.
Ideally, your builds should be predictable and consistent.
Based from this blog, here are the problems you will encounter if you don't specify your dependency explicitly:
Dependencies can unexpectedly introduce behavior changes to your app.
The same source built on two different machines can differ.
Similarly, builds built on the same machine but at different times can differ.
Past builds cannot be reproduced perfectly. This makes it difficult to revert safely.
There are security implications if a bad actor introduces a malicious version of a dependency.
Related
I have a project using an old version of google play services that I need to keep otherwise it would need to be heavily rewritten. Now I have added a new library that uses a newer version of google play services and I get a duplicate class error.
How can I force android studio to use the newer version of google play services in the library for the library but also be able to use the older version in my app?
Unfortunately, this isn't possible. The classes for your app and the library are combined to form your APK, so you can only have one version of a given library. You could force it to use one of the two versions (for example, something like this), but based on your statement that it would need to be extensively rewritten, I assume that the two versions are not API compatible.
There are utilities like Jar Jar Links that can solve this in some cases, but (especially based on the embedded proguard rules, which reference classes found via reflection) I'd be surprised if it worked in the case of something as complex as Google Play Services, which is likely depending on its class names remaining unchanged.
Please note: although I specifically mention AngularJS, Ionic and Cordova here, I'm really talking about any mobile app (hybrid and native alike) that produces binaries for iOS and Android platforms. As such, I believe that anybody with experience in mobile dev should be able to address the question!
I am building a mobile app for iOS and Android using AngularJS, Ionic and Cordova. My concern is that iOS and Android release updates all the time, some may be buggy or just might be outright breaking changes and all of the sudden become incompatible with the plugin/library versions that I'm using.
This will cause apps to crash spontaneously in production. But it sheds light on an even nastier problem under the hood: making the decision to pin your builds against specific dependency (plugins/libraries/etc.) versions or just always pull in the latest/stable versions of them!
Option 1: Pin your dependency versions
Here we specify the exact version of all dependencies to use. We then fight with the Ionic build to get the app built, but are now good to go. I can expect that if I don't change any of my code, that each subsequent build of the app against the exact same dependency versions will always result with a successful build.
However, when iOS/Android does release a breaking change or bug (or anything that prompts the library/plugin maintainers to go into a frenzy and publish new versions of themselves), because I've pinned my previous build to specific versions of dependencies, I may actually be running on very old dependency versions and it will now be a massive headache to get my app building again against all the latest versions.
Option 2: Use latest/stable versions at all times
If I don't specify dependency versions (and just let the build always use latest and greatest), then I could work fervently to get my app building, then wait a few days (and not change any of my own code) and then try building it again and the compile/build might fail! This is because in between those few days, some project upgraded itself and/or its own dependencies and introduced a build-breaking change.
However, when iOS/Android releases a breaking change that requires me to upgrade to latest dependencies, the headache would likely be considerably less then Option 1 since I'll be on a relatively much newer version of all my dependencies.
Are there any tools/strategies/techniques/etc. that the mobile community leverages to stabilize builds and make it so that I can have more consistent, repeatable builds?
It is recommend to use specific version of your dependencies, you may consider using the notion * at the minor patch level X.Y.* to get the lastest bug fixes.
Your build should be automatic and consistent, there are products that do this for you, e.g BuddyBuild and Buddy support both Android and IOS.
Successful builds is not the whole thing, The app should pass all the functionality and QA tests before a release. So you need to write as much as UnitTests and FunctionalTest to cover the quality checks. There are other QC tools for even further assurance, For example static code analysis tools help you to discover potential bugs and failures, And test coverage tools let you know which parts of your code has not been tested yet.
Here is a Simple CI/CD workflow
Code -> Push -> CI Test -> CD Publish Release
You can set a job to build your project on a weekly basis on the CI server and Publish a Release only if it passes all the Quality Checks
Apps crashing on the new OS versions is not a catastrophic problem, it's common and has its solution, Google and Apple don't release new OS versions to users just like that, Developers are provided with preview builds of the OS and new APIs, Developers usually have more than 2 month to adopt thier apps with the new changes and even use the new API features.
And by the way you have access to crash reporting tools like Fabric.io and Firebase which helps you to discover problems at production.
Cheers
So I recently tried running my app which had been working fine until facebook updated their sdk which caused problems with different variations of android.support v7:25.
The dependency that caused the issue was 'com.facebook.android:facebook-android-sdk:4+'. To fix the issue i just specified a version that I wanted.
My question is, will this cause my apps that have already been published with the 4+ dependency to crash and should I immediately update my app with the specific version?
Yes, you should always define any dependencies with specific version ( As per experience I do have).
You should not define dependencies like this with any of i.e. with Facebook or Google etc.
If you use dependencies like defining 4+, then it upgrades automatically when required.
I was running into problems with how many methods I have in my project, and have finally fixed it.
However, I noticed that the Localytics documentation says to include the dependency com.google.android.gms:play-services-ads. It is never used anywhere in my project, and I can't find anything on their website as to why its a required dependency.
My app runs perfectly fine without it as far as I can tell, but I have only tried building the project as a debug build.
play-services-ads used to be the only way of gaining access to the Advertising ID and it seems that functionality was added back in version 2.60 as per the SDK Changelog. The only mention of it appears to be in the testing attribution section, although that doesn't mean it is only used for attribution.
As of Google Play services 9.0, it has been moved to the play-services-basement dependency, which is much smaller. You should be able to use that dependency in place of play-services-ads without issue.
I got an error in the build server when sending an Android build during the dex phase.
Googling a bit I learned that there is a hard limit of 64K functions (including all libs, the heaviest is google play services), or you can use the multiple dex mechanism.
How do I activate this for Codename One?
I understand Codename One uses Ant and as far as I understand this only works for gradle.
FYI this is the workaround, that splits google play services into sub libraries with native android:
http://android-developers.blogspot.com.es/2014/12/google-play-services-and-dex-method.html
I had a very similar issue and corresponded with Codename One's pro support on this. Gradle support was something they just recently announced so its not as documented but should be available in the next update.
You need to add the following build hints to your project:
android.gradle=true
android.multidex=true
I understand that gradle will be the default build once 3.3 rolls around so in the future only the multidex option will be needed.
You don't have to add Google Play Service Library in your codenameone app, just add android.includeGPlayServices=true to your build hint and it would be included in build server.