Android Studio "0 test classes found in package" when "rerun failed tests" - android

I am experiencing a very frustrating behaviour on Android Studio, updated to the latest version (3.1.3, buld number #AI-173.4819257), gradle plugin version 3.1.3.
What it happening is that after running my Robolectric based unit tests, clicking on "rerun failed tests", I always get this message:
0 test classes found in package 'my-package-name'
Process finished with exit code 254
Empty test suite.
I tried to Invalidate Cache / Restart, update to the latest version of every dependency. Actually I couldn't find any helpful information about this problem, so I am here to ask if someone has experienced a similar behaviour
Here you can find my configuration for the test

It seem it was an Android Studio bug fixed in 3.1.4, as stated here https://developer.android.com/studio/releases/#3-1-0
installing the version 3.1.4 actually fixed the issue

Related

Error when running the flutter run - AAPT2

I'm trying to implement mercadopago px, but at run time it returns an error
AAPT2 aapt2-4.1.3-6503028-linux Daemon # 2: Unexpected error during compile
I looked for some solutions Link , some say it is Gradle's mistake and others say it is related to the hardware. One of these solutions was to see the structure of the project and change the version of Gradle to a lower one, the version that did not give this error was (image), but there was an error in the main activity
Actual gradle
Changed Gradle
If you have an older computer/laptop, it's likely the missing SSSE3 instructions. The bug was fixed in newer versions of AS/AGP so if you update your android gradle version to the newest 4.2 beta it should fix the issue.

Data binding with errror dataBindingArtifactOutputDir

I have a weird problem when building my app.
Cannot write to file
'myapp/app/build/intermediates/data-binding/dev/debug/bundle-bin'
specified for property 'dataBindingArtifactOutputDir' as it is a
directory.
It 's weird because when I clean project, I can build app. But when building app the second time, the above error happens. If I want to build app, must clean app.
I also set
dataBinding {
enabled true
}
Thanks for any support!
I really found the problems. I took me 1 day. I updated the gradle plugin and Android Studio to the newest version. And this is the reason why.
The newest gradle build tool is 3.4.1, it use the gradle version 5.1.1. When I downgrade the gradle build tool to 3.1.4 as my old project, and clean build app again error still happens. I think this way did not work but this is problem of Android Studio, it did not change the gradle version in gradle/wrapper/gradle-wrapper.properties. I manually update to old gradle version
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
It works now luckily. Everytime Android Studio updates, the weird problems happens again. Expect everything will work well in the future. :|

"Minimum supported Gradle version is 4.4" error started today; no code changes

Today, multiple developers on my team started seeing this error when they attempt to run any Gradle task.
* Where:
Build file 'C:\dev\src\my_app_name\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 4.4. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in C:\dev\src\my_app_name\gradle\wrapper\gradle-wrapper.properties to gradle-4.4-all.zip
Absolutely no code or config changes were made; Gradle builds just suddenly started to fail. Anyone know why this would happen? My best guess is that a plugin with a dependency on a specific version of Gradle auto-updated itself, but I'm not sure how to figure out which one it is. The line number would suggest that it was the com.application.plugin plugin itself.
I am aware that Android Studio updates often require a corresponding upgrade to Gradle, but nobody on my team updated Android Studio. And, according to the Android-Studio-Gradle version compatibility table, Gradle 4.1 should still work fine with Android Studio 3.0.1, which is what I have been running for some time.
We recently started using Kotlin, and I thought that might be part of the problem, but completely removing everything related to Kotlin didn't help.
I have tried deleting the Gradle caches/ directory, running ./gradlew cleanBuildCache, deleting our project's build/ directories, killing Gradle daemons via ./gradlew --stop, and rebooting -- all to no avail.
I also tried upgrading to Gradle 4.4, but that resulted in a "CIRCULAR REFERENCE" NullPointerException error during DexMergerTransform (separate issue), for reasons that are entirely unclear to me. I'd like to be able to force my environment to NOT take on a Gradle 4.4 dependency right now... but I don't know what suddenly triggered this dependency.
The problem turned out to be that we were using a non-specific version of a plugin. When a change was made to the plugin, the new version was downloaded to our dev environments, and it introduced a dependency on a version of Gradle higher than the one we were using.
In our case, this was the culprit:
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
Downgrading to version 8.5.1 of the Butterknife plugin eliminated the dependency on Gradle 4.4.
You also have the option of linking to a specific pre-release "nightly" version. However, this is less than ideal, since these bits don't remain available for long, and you might want to download a build and keep it in your local lib. For example:
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-20180727.012508-40'
instead of down-grading, one could provide the plugin in version 9.0.0 with the expect version of Gradle, by editing the file gradle/wrapper/gradle-wrapper.properties; for example:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
version 4.5 works stable and might not create the circular reference, alike 4.4 does. and when looking at the issues tracker on GitHub, this Gradle plugin might add more problems, than it would serve any real purpose - because the Android SDK already supports two-way data-binding.
currently the artifacts still list 8.8.1 as the latest version; while a SNAPSHOT is barely stable... that nothing happend there since over a year, hints for that this project might have been abandoned... most likely because of Architecture Components data-binding.

Android run fails with message Failed to finalize session: INSTALL_FAILED_TEST_ONLY

I recently upgraded to gradle 3.4.1 on Android Studio 2.3.1. My build was working earlier. Anyway, the error I'm getting is:
I've wiped the data to the avd, made sure the app wasn't on it, restarted android studio and my mac, and made sure I didn't have the android:testOnly="true" flag set (I don't). I also added the flag and set it to false, but I still get the error.
I also had this problem in Android Studio v2.3.1.
I found stability when I set gradle version to 3.3 and android gradle plugin to 2.3.1. Stay off that bleeding edge gradle :)

Bug in just released 1.5?

Working on Linux.
Android Studio 1.4 told me that 1.5 is available in the stable channel;
I upgraded.
Afterward, 1.5 seems to be "looking" for Gradle 2.4; yet 2.8 seems to be what's actually installed.
More details:
After the upgrade, the Gradle sync failed on the project I opened.
Error message:
.../android-studio/gradle/gradle-2.4/lib/plugins/gradle-diagnostics-2.4.jar (No such file or directory)
But the version specific sub-directory within the gradle directory is gradle-2.8
The update procedure itself did not complain about any issues.
The update was done without any open projects; update was done from the main Studio panel.
After the update of Studio itself, via "Configure" from main panel went to "SDK Manager", then updated to newest compatible SDK.
Has anyone else had a similar problem?
Yes, there was a problem in this update.
Open file gradle-wrapper.properties in your project using Android view:
Just change the version 2.4 to 2.8:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Restart Android Studio.
Resolved - it seems some of the Gradle components were on the classpath for the JVM which studio itself uses; somehow the JVM didn't exit when Studio was to have re-started after the update. Once I bought that down and restarted Studio, the JVM and all, Studio 1.5 seems to be working just fine so far.
Sorry for the interruption to your regularly scheduled development!
There is definitely some issue with the upgrade as I also faced the same problem.
Although restarting the system (Mac) fixed it.

Categories

Resources