Given the recent updates I'm a little lost on what I should be using now.
I have been using gradle-experimental successfully but it still misses some of the build options default gradle has.
The gradle-experimental documentation has not been updated so it gives the impression that it is still necessary for ndk projects, but given how google do documentation it could just be out of date.
Any light cast on this would be very welcome and let me rest easy.
Thanks
Related
I'm trying to use a library from GitHub in my Android Studio Project (specifically, the Universal Image Loader https://github.com/nostra13/Android-Universal-Image-Loader).
My project has been crashing, due to an error with a variable called mMaxHeight, in a file called ImageViewAware.java
On the GitHub page, I see that this issue was 4 fixed months ago:
When I view the code in ImageViewAware.java on GitHub, I see that the issue is fixed.
However when I look at the version of ImageViewAware.java being used in my Android Studio, I see it's an older version, with the issue not fixed.
I've added
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
to my Gradle Dependency, as the documentation says, and have followed all other instructions I can see.
I notice that the last update to those instructions was over a year ago. Should I be implementing a newer version than 1.9.5? Is there another reason why the version in my Android Studio isn't getting the latest GitHub version?
I'm pretty new to this and feeling a bit out of my depth. Thanks for any help!
Alex
You are correctly using the latest published version of the library, v1.9.5.
However, there have been 23 unreleased commits to that library since then, as shown on the GitHub tags page:
To get the latest version of the code, you'll need to:
Download the library's zip.
Unzip it.
Manually add the dependency to your project.
This process is pretty straightforward, you may also be interested in this list of every difference between v1.9.5 and master.
However, I'd recommend against using this library if possible, given that it hasn't had a release / major update in 4.5 years! In the readme the author states he has stopped maintaining it. It also has over 400 open issues, despite the popularity.
More modern libraries like Picasso and Glide are much more widely supported, feature rich, and reliable.
I have created a location-based game using the Mapbox SDK in Unity 2018.2.1f1, and it has been able to build just fine. My goal was to add database functionality to my project by using Firebase, to store GPS coordinates online.
I followed the official tutorial for setting up Firebase in a Unity project. When this was completed, a window popped up saying "Resolving Android Dependencies", which took about half an hour.
Since then, I have been unable to build to my Android device. I receive 96 gradle build error, and the one at the top is:
> No toolchains found in the NDK toolchains folder for ABI with prefix:
mips64el-linux-android"
I reverted the project to its pre-Firebase version, and it was still unable to build, as if something in the Android build tools had been changed.
Next, I tried an entirely different version of Unity, and installed a fresh install of Unity 2019.2.9f1. I opted to use this version of Unity's in-build Android SDK and NDK. I reverted my project back to the last known working version (pre-Firebase), ported it to the new version of Unity, and completed a successful build to my device before moving on.
Then I followed the appropriate steps to add Firebase to my project again, and the same exact pop-up windows appeared in Unity, claiming that it detected "obsolete files" that it wished to delete (this time I said no), and then it performed the same "Resolving Android Dependencies" process.
Once this process was complete, I made no other changes, and tried to build again. It failed, and I received the same 96 gradle build errors. This confirms this error as repeatable on two different versions of Unity.
I believe this has something to do with conflicting dependencies between Mapbox and Firebase. Has anyone encountered this issue, or successfully been able to use these two things together in a project?
So, the baseline problem is that something is telling the Android build process to generate project files for the MIPS architecture. This architecture was removed from the official NDK in r17 (see this link for supported architectures). I'm not sure if Unity ever supported it, but it's not in the current version:
I do not know how MapBox is packaged and shipped, so I don't exactly know what postprocessing hooks might be conflicting between that and Firebase. I'll try to give you some steps forward though.
First, make sure you have the latest SDK from Firebase and MapBox. Also, when it asks to delete obsolete files, say yes. The Play Services Resolver should only prompt this for files that it tracks (and the Firebase plugin ships in a state where this is expected).
If that doesn't help, look for a mips folder included in your Unity project (probably something like libs/mips or jnilibs/mips). Hopefully deleting these will fix the issue.
If the above doesn't work or is non-actionable, try using a mainTemplate.gradle file:
If you follow the instructions I wrote up here to instruct the Play Services Resolver to patch your mainTemplate.gradle file:
You can double check your ABI filters directly in the file. By default it shows:
ndk {
abiFilters **ABIFILTERS**
}
to match what you've selected in Unity. But you can use this to double check that mips64 isn't included via some other process.
Unfortunately I don't know what else to suggest if neither of the above options work. In that case I'd suggest posting a bit more of the error you're getting. If you can reproduce the error you're having with one of the Firebase sample projects, you can file an issue on that issue tracker directly. Finally, if you don't get an answer here and you do think that it's Firebase related, you can contact the Firebase support as well.
I hope something in my post helps!
--Patrick
I have published one library called SmartToolbar to jcenter successfully.
But I have one problem when I update it to new version and publish it again, it does not show suggestion message to update to new version in gradle.
Currently, the latest version of this library is 1.0.12, but as you can see in the screenshot, it doesn't show suggestion message to upgrade to version 1.0.12 as a library above it.
I want to fix it because I want to notify to all developers who are using it to get the latest update from my library.
NOTE: It does not show suggestion that have new version is available but we still get the latest update if we know the latest version. So only me that know about the latest version.n
When I publish new version I have updated the versionName which I create custom variable as PUBLISH_VERSION to use with my publish-android-library-plugin as bellow screenshot.
So I want to know more which part that I missed when I publish the new version?
or in my publish-android-library-plugin has something not correct? Maybe you need to review this raw code for checking my mistake.
NOTE: This library has synced to maven central
*UPDATE *
According to our dear friend JBaruch, he said:
The problem is that regardless of which repository your library is
resolved from (being it jcenter(), mavenCentral() or any other
repository), the check for the latest version is hardcoded to go
to Maven Central.
You can read more about his thoughts when answering a similar questions to yours over here: Add Warning "A newer version of ..... is available" for custom library
So, following his suggestion, you can try syncing your library with maven
* PREVIOUS ANSWER: I am leaving this here as I still think it is still important to understand the thinking process behind Android studio's aversion to getting the latest updates *
The version update popup notification is due to a Lint rule in Android Studio, called Newer Library Versions Available. According to How to check if gradle dependency has new version, the latest few updates to Android studio has modified that lint rule so users will no longer be notified of new non-Google library versions.
JBaruch's answer in How to check what is the latest version of a dependency to use in gradle gives a good reason why Google went with this change:
"Relying on latest version is indeed a dangerous thing to do. Your
build can break without you changing anything, just because some
library broke backwards compatibility."
Google would prefer developers stick to a particular library version and only update when required. So, checking for updates has become a manual process.
So, how can you proceed from here? If you just want to check that Android Studio is notified of your new library update, you can use Android Studio's proper method of checking for updates. You can look at Adam S's answer (the accepted one) in How to check if gradle dependency has new version for instructions to do the update check.
I have a QtApp on android which builds using ant. This is working fine.
BUT ----> To regularly update my app on google Playstore I need to increment the version number of the app. I found that gradle has a nice way to increment the version number. But I see that gradle pulls in a lot of other complexities. I want to keep this simple with ant as it is working.
Isn`t there a simple way to increment the version number using ant without indulging gradle ?
Should I really consider switching from ant to gradle ? Are there many strong reasons of using gradle on android ?
You can set versionCode & versionName in manifest directly. By
the way gradle does same thing, it just merges your manifest with
generation of additional fields according to build.gradle file
You should definetely use gradle, it has a lot of features in comparison with ant. Android Studio supports gradle fully, it is more customizable, more flexible, than ant. You could easily transfer project across your team, but with ant this could lead to a lot of headache with dependencies conflicts. So loading dependencies on a fly it's a gradle feature and it helps a lot. I haven't written more, because you can check all gradle features yourself. I've just given you a council
In my project I am integrating push notification for that I require classes from com.google.android.gms package.
Is it possible for me to include selected package from whole library?
I am using eclipse. actually there are lot more libraries required, due to which I am facing 65k multidex issue. Any solution?
If you really really want to use the Eclipse to compile this, you need to perform these steps:
Have someone with Android studio include your needed Google components as dependency.
Kidnap the components from exploded-aar Android studio folder and setup the components as your own Eclipse library.
But of course, this is highly not a recommended procedure, but this is for those people who desperately needs it as last resort. This also marks a disclaimer that the kidnapped libraries are already free from the developer's accountability, because you didn't compile it the right way.
PS. Did this with Google Maps
If you want to use selective components of the Google Play Services you will need to switch to Android studio.
Read this: (Source)
Important: Support for the Android Developer Tools (ADT) in Eclipse
has ended, per our announcement. You should migrate your app
development projects to Android Studio as soon as possible. For more
information on transitioning to Android Studio, see Migrating from
Eclipse ADT.
If you still want to continue using eclipse, you'll have to to the hard work yourself - of deleting the unwanted packages/components from the full source code and making sure it compiles and works fine.
Instructions of setting up selective APIs can be found on this page, for android studio. For Eclipse, as the documentation says nothing about setting up selective APIs, you just have to go with the whole set.
NO. you have to migrate your code to Android Studio.