I am trying to run Espresso tests (written in Kotlin) in Android Studio with the AccessibilityChecks enabled as documented here.
When I try using AccessibilityChecks within the tests, I get the following error:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/base/Preconditions;
at android.support.test.espresso.accessibility.AccessibilityChecks.enable(AccessibilityChecks.java:80)
If I try moving it to a Before class like mentioned in the documentation:
Then it will fail with the error 'Empty test suite':
There are two issues reported here:
Package 'com.android.support.test.espresso:espresso-accessibility:3.0.0' uses
a Guava class but does not declare a dependency to Guava, resulting
in the errors reported in comments #1-#5.
Package 'com.android.support.test.espresso:espresso-accessibility:3.0.1'
seems to have duplicates of the
android/support/test/espresso/accessibility/R class, resulting in the
error in
Both issues have been fixed and will be included in the 3.0.2-alpha2 release
If any issue persists, please report at Google issue tracker they will re-open to examine.
I had to add to add the guava dependency to my app gradle file using:
androidTestCompile 'com.google.guava:guava:20.0'
I also opened a ticket for Android at:
https://issuetracker.google.com/issues/65486414
Related
I added the mapbox-search-ui dependency to my app/build.gradle following the instruchtis here: https://docs.mapbox.com/android/search/guides/search/
implementation "com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0"
implementation "com.mapbox.navigation:android:2.7.0"
implementation "com.mapbox.search:mapbox-search-android-ui:1.0.0-beta.38"
The build then fails with "Duplicated class found"
Duplicate class com.mapbox.common.MapboxCommonLogger found in modules jetified-base-10.7.0-runtime (com.mapbox.maps:base:10.7.0) and jetified-common-23.1.0-rc.1-runtime (com.mapbox.common:common:23.1.0-rc.1)
Build is fine without the mapbox-search-android-ui package.
I tried to determine and exclude the faulty package but without success.
Any suggestions warmly welcome
EDIT
The issue also happens when i just want to add the core search library:
implementation "com.mapbox.search:mapbox-search-android:1.0.0-beta.38"
So i assume that the issue is caused by using the "old" mapbox sdk version 9.5.0. When i switch to the current 10.9.0 version i don't get the duplicate classes error. But then i would need to migrate my whole code to 10.9.0 which means a lot of effort...
EDIT 2
As of an answer to a corresponding issue i openend on their guthub page the devs told me that the search SDK currently not works with Mapbox v9, but they maybe consider to add backward compatibility.
see https://github.com/mapbox/mapbox-search-android/issues/93
I wanted to update the version of the application in the Play Store, but in the tests I started getting this error.
Superclass androidx.core.app.f of androidx.activity.ComponentActivity is declared final
According to the google issues tracker this is new, maybe someone has a solution to this problem.
I added
-keep class androidx.core.app.** { *; }
In the proguard rules to solve the issue.
Edit: minus sign (-) needs to be before the line
On 27.07.2022 Google team members posted that the bug has been fixed.
and on 09.08.2022 they added some explanation that you can find in this link.
In two words:
In pre-launch testing app-crawler apk and the app apk generated different ‘keep rules’ for shrunk.
This will cause ‘no such method’ or ‘superclass will be declared final’.
Did you upgrade some libraries in your build.gradle?
Coroutines maybe?
We have this exception reported too and it has the same stack trace as an older exception we had before, so possibly equally related to the Kotlin coroutines lib version:
java.lang.VerifyError: Verifier rejected class. Code working fine in debug mode, but not throwing this error in release mode
You try update implementation 'com.google.android.gms' in build.gradle to lastest version
I had the same issue with Flutter. I remove Firebase from build.gradle
// implementation platform('com.google.firebase:firebase-bom:29.0.4')
also downgrading firebase to 29.0.2 is working too.
I added this line into gradle.properties
android.enableR8.fullMode=true
I hope it will help you too
For builds made before August 2022
If your APK/App Boundle was created before August 2022, the issue might be related to an internal issue by Google.
See this issue tracker: https://issuetracker.google.com/issues/237785592?pli=1
For me it was enough to build a new release on my machine (increasing version number at least by 1!) and upload it... Afterwards, the problem was gone.
I'm migrating from fabric to firebase crashlytics. I've been able to migrate to AndroidX (which I believe was necessary). Then I followed this steps but the app crashes when I add the crashlytics dependency (everything works if I comment out the crashlytics implementation line).
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
When using a physical phone, I don't get any error, just some SQLiteEventStore and JobInfoScheduler log and the sigkill:
https://gist.github.com/raquelhortab/60ebd50ead5aa820c34bc271a09e94b7
When using an emulator I get an okhttp3 error (you can see it in the gist above). Again, the only difference is the crashlytics line in the app's build.gradle.
The okhttp3 error made me think I might have to update glide and okhttp3 (which is not that easy) but it works just fine without crashlytics so I don't think that's the problem.
I've also tried the crashlytics version 17.2.2 and newer versions of firebase-related implementations, you can find the gradle files in the gist as well.
PS: I apologize if this has already been answered, searching crashes and crashlytics leads to many questions of crashes that are not realated to crashlytics (which is logic)
It doesn't seem firebase issue from the error stack provide. Try to add the same version for com.squareup.okhttp3:logging-interceptor and com.squareup.okhttp3:okhttp
try 3.4.1
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
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.