Crashlytics upload failure with firebase-crashlytics-gradle - android

I recently migrated to using firebase-crashlytics-gradle rather than the deprecated Fabric plugin. However, I seem to have a compile-time clash with Apache HttpClient, because when I enabled upload of the mapping file, I get the following error:
Execution failed for task ':nda:uploadCrashlyticsMappingFileTst'.
> org.apache.http.entity.FileEntity.<init>(Ljava/io/File;)V
It looks like the FileEntity in my compile classpath is missing a single-argument constructor accepting a File instance and reading the source code states it's been there since v4.2. When I navigate to FileEntity using Android Studio's "go to class" I end up inside org.apache.http.legacy-android-29.
What's going on here; is Firebase Crashlytics SDK somehow incompatible with targetSDK 29 or what can I do to resolve this issue so that the mapping files are uploaded?

So as I thought, the problem was with an old third-part plugin on the classpath. I solved it by enabling obfuscation/minification only for release builds and then made sure the third-part plugin only runs for non-release builds.
Was very hard to figure out, given that the dependency graph is for compile and runtime but not for build time.

Related

Firebase libraries with conflicting library versions fail to run my app

So i'm using the following firebase library version in my app:
Project's build.gradle:
firebase_version = '15.0.0'
And the following library dependencies:
App's build.gradle:
implementation "com.google.firebase:firebase-firestore:$firebase_version"
It looks like these versions were released on the 10th of April, however when compiling my app with the updated libraries, it fails to run with the following error:
error: cannot access zzbgl
class file for com.google.android.gms.internal.zzbgl not found
When checking all my library versions, my build.gradle has the following error:
not sure if anyone has experienced this by any chance since the latest updates? Before updating from 12.0.1, everything was working.
Thanks
Simply override (add to your gradle file) the conflicting library, updating the version to match the ones you already have in your gradle file. Somewhere in your dependencies someone is using an older version of this library and it's crashing with your version:
implementation "com.google.android.gms:play-services-auth:$firebase_version"

Android studio automatically tries to update libraries?

In my project I have many libraries defined in dependencies section in gradle. Problem is once in a while (once/twice a day)Android Studio gives me errors like this when opening the project or trying to get a release output:
Error:Unable to resolve dependency for ':TMessagesProj#armv7Debug/compileClasspath': Could not resolve com.google.android.gms:play-services-gcm:11.2.+.
My guess is it is because build tools is trying to check if there is an update for each library and when it doesn't find an Internet connection, it shows this error. If so, how can I change the setting in a way it doesn't have to check for updates? In other words in my project I don't need to update my libraries.
I know there is an offline mode that will probably do the trick! But I don't want to use this feature because it will probably disable some other useful features too. I just want to prevent it from automatically checking for library updates(If that's the problem shown above).
I included some part of my dependencies in gradle here:
dependencies {
compile 'com.google.android.gms:play-services-gcm:11.2.+'
compile 'com.google.android.gms:play-services-maps:11.2.+'
compile 'com.google.android.gms:play-services-vision:11.2.+'
compile 'com.google.android.gms:play-services-wallet:11.2.+'
}
Dependencies with a plus like 11.2.+' will always lead to repeated builds.
You have to specify the full version like:
com.google.android.gms:play-services-gcm:11.2.0
If you do not specify gradle will always be building because its looking for the latest version online of 11.2.+ may be 11.2.4, 11.2.6 etc

Issue with DJI SDK gradle 4.4.0, provided keyword in gradle not working

Previously my gradle used to look like this and worked fine (apart from few registered bugs)
implementation 'com.dji:dji-sdk:4.3.2'
Now, after changing to
implementation 'com.dji:dji-sdk:4.4.0'
the Camera and other files cannot be recognized anymore. I am attaching a screenshot of the unrecognized imports.
However when I am trying to add
//dji-drones-sdk
implementation 'com.dji:dji-sdk:4.4.0'
provided 'com.dji:dji-sdk-provided:4.4.0'
I am getting "could not download dji-sdk-provided.jar"
Screenshot attached
All the examples and github codes are in version 4.3.2. Can anyone help me out?
Here is the link to the dji sdk
I have found the issue. After Gradle 3.4, the "provided" is replaced by "compileOnly"
I quote,
Gradle adds the dependency to the compilation classpath only (it is not added to the build output). This is useful when you're creating an Android library module and you need the dependency during compilation, but it's optional to have present at runtime. That is, if you use this configuration, then your library module must include a runtime condition to check whether the dependency is available, and then gracefully change its behavior so it can still function if it's not provided. This helps reduce the size of the final APK by not adding transient dependencies that aren't critical. This configuration behaves just like provided (which is now deprecated).
Hence using compileOnly in place of provided will do the trick.
Here is a link to the gradle changes documentation

Android Databinding build fail after Gradle plugin update with migration to annotationProcessor

To support Instant Run in my version of Android Studio, I needed to upgrade my Gradle plugin from version 2.2.3 to 2.3.3
I'm aware I'm supposed to migrate to annoationProcessor and I believe I've followed that guide correctly
after doing so, the Android DataBinding code generation fails
The migration guide linked earlier states that all I need is to
Make sure you are on the Android Gradle 2.2 plugin or newer
Remove the android-apt plugin from your build scripts
Change all apt, androidTestApt and testApt dependencies to their new format
This should be all that's needed to successfully build the project. Yet it doesn't build.
Build output
Gradle build finished with 101 error(s) and 23 warning(s) in 12s 481ms
All of the errors follow the same pattern:
C:\Users...\FooAdapter.java
error: package com.example.app.databinding does not exist
error: cannot find symbol class ItemFooBinding
An interesting message can be found in the build console:
Warning:The following options were not recognized by any processor: '[android.databinding.minApi, android.databinding.enableDebugLogs, android.databinding.sdkDir, android.databinding.bindingBuildFolder, android.databinding.enableForTests, android.databinding.modulePackage, android.databinding.generationalFileOutDir, android.databinding.xmlOutDir, android.databinding.artifactType, android.databinding.printEncodedErrors, android.databinding.isTestVariant]'
I would like to point out that...
I presume I don't have an error in some XML file, binding expression or a naming issue. The same set of sources and XML build when I switch back to the Git branch with the old gradle plugin version (and all of the other source files up-to-date)
I did increase the limit of output build errors as discussed here, although this doesn't seem to be relevant right now, since as you can see, I currently have "only" 101 errors. :)
Additional info
The following diffs show how I've modified my gradle files:
build.gradle DiffChecker link
app/build.gradle DiffChecker link
Also, as a quick overview, here is the list of some of the "more interesting" plugins & libraries used by the project:
Kotlin
Android DataBinding
Realm
Retrofit
Dagger
ButterKnife (I know...)
Multidex Support Library
Does anyone have a clue what could be the issue? Any help or idea will be greatly apprecitated!
I had exactly the same warning. This line in gradle solved the issue:
kapt "com.android.databinding:compiler:3.0.1"
Hopefully, it will help somebody
Update:
3.0.1 is Android Plugin Version.
When you see innumerable build errors mentioning databinding as in this case, the problem usually lies somewhere else. Databinding just gets stopped in its tracks by unrelated build problems and complains exceedingly loudly. The only way to deal with it is to locate the build errors that are not tied to databinding. Once they are fixed, databinding can do its thing again and be silent. Unfortunately you often have to repeat this approach several times until you have found all non-databinding issues. It's an arduous task for sure, but unfortunately there is nothing else you can do until Google manages to provide a saner build environment.
This is the reason why you are advised to increase the build error limit beyond 100 - you would not see the actual errors causing your problems, because they commonly do not show up early in the list.
I will chance a guess - Dagger 2 is a common source of triggering this problem, which could be related to your annotationProcessor change; so look out for Dagger errors. But your issues could be caused by other things, like other annotation processors as you mentioned - you wouldn't know for sure until you diligently dig through your build errors.
It seems it all comes down to my project using Kotlin. Actually we have it mixed: some classes use plain old Java while others are written in Kotlin. An incomplete migration. :)
I assume that without Kotlin, replacing apt with annotationProcessor would be enough and I wouldn't have ran into this issue at all.
Solution
Annotations need to be processed by both annotationProcessor and kapt, which seems to be Kotlin's own annotation processor.
For each Gradle dependency that uses annotations, you should have both of the following in your app-level build.gradle:
annotationProcessor 'com.example.my.library:x.y.z
kapt 'com.example.my.library:x.y.z

Could not write to file pom.xml android

Unable to push android library to maven. It is giving following error.
"Could not edit /../../pom.xml file"....
caused by InvalidUserDataException: The configuration to scope mapping is not unique. Please help.
The problem is with version and scope mapping while updating your pom file.If multiple mappings are found for same dependencies exception is thrown.
You can see it here for unique property mapping in spring.
For Android, you must use an updated version of standard maven plugin Android Maven Plugin.
This might help you Repository link and integration details.
I was able to resolve the InvalidUserDataException by using as of today the latest version of the multidex library: androidx.multidex:multidex:2.0.1.
I verified that the error occurs when I use androidx.multidex:multidex:2.0.0.
I also verified that the error does not occur when I keep using com.android.support:multidex:1.0.3 in combination with android.enableJetifier=true.

Categories

Resources