I recently discovered the property testOptions.animationsDisabled in the Android Gradle plugin.
I was hoping it would be helpful to disable the animations on my devices when executing UI tests with Espresso, but it's not, i.e. I still have to disable the animations manually or using one of several options available. Otherwise some UI tests become flaky.
Since the description of this property is rather short, does anyone know how it's meant to be used?
My gradle file is as follows:
apply plugin: 'com.android.application'
android {
testOptions {
animationsDisabled = true
}
}
Thanks.
Unfortunately, nothing.
I added a comment a while ago that it is not used in the 2.3.3 plugin.
I hoped something changed with the Android Studio 3.1 and androidGradle 3.1 plugin release but that isn't the case.
I think it is a bit misleading that this flag exists and isn't better documented
Edit:
I have been forwarded this blog post that explains how to set up a test rule that disables animations for you.
https://proandroiddev.com/one-rule-to-disable-them-all-d387da440318
You should be upgrade build:gradle:2.3.0'
and build
simple:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
Related
I was trying to migrate build.gradle files to use Kotlin DSL. Using the plugins block instead of apply (legacy, apparently) doesn't seem to be as straightforward as suggested. Since "com.google.firebase.appdistribution", "com.google.firebase.crashlytics", and "com.google.gms.google-services" are missing in the Gradle plugin portal (?). Can I not use them in the plugin block? I tried this but it didn't seem to work. Also, why are they missing? I still don't quite understand how this works so please bear with me.
I ran into this problem after i updated android studio and the gradle version. Here's what i did step by step:
First i got the following error:
Build Gradle Error Could not get unknown property 'compile'
I checked stackoverflow and it said that changing "compile" with "implementation" would solve the problem, and so i did that.
Another issue was that maven was deprecated. So i used, maven-publish instead of maven.
Now i am getting the following error:
12:24 PM Gradle sync failed: Could not find method uploadArchives() for arguments [build_a5ye7ixpcm9qfmol93kt3ucl1$_run_closure4#73b8042a] on project ':expo-application' of type org.gradle.api.Project. (17 s 537 ms)
In this part of code in build.gradle(:expo-application):
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: mavenLocal().url)
}
}
}
I am not really familiar with android studio or java. I just use Android Studio for configuring react native apps for android. Can someone please help me resolve these issues..
Thank you
As of Gradle 7.0, compile has been removed in favor of api. When you changed compile to implementation, you effected the transitive properties of the libraries. I'm not sure where you read that changing compile to implementation was the correct answer, but it isn't. api is a much closer approximation to compile. This chart gives a fairly easy to understand explanation of why this is. You should change the implementation to api and make sure you are using the java-library plugin instead of the java plugin. This should allow gradle to see the UploadArchives method. However, this wil cause a new issue.
As of Gradle 6.0, UploadArchives is also deprecated along with the maven plugin. You should consider using the maven-publish plugin instead. This will ensure your build continues to work in future Gradle releases.
So, to summarize, make sure your plugins look like this
apply plugin: 'java-library'
apply plugin: 'maven-publish'
and update your code to use publishing instead of UploadArchives. More information on this can be found in the current Gradle user guide here.
Alternatively, you can downgrade your gradle version to something before 7.0 and just ignore all the deprecation warnings. The choice is yours.
I need to modify some class in Flutter framework during compilation of my Flutter application.
Thought, it's a good idea to use the byte-buddy-gradle-plugin for this purpose.
Added this into my app/build.gradle:
apply plugin: "net.bytebuddy.byte-buddy-gradle-plugin"
byteBuddy {
transformation {
plugin = "com.example.BuildPlugin"
// classPath = ...
}
}
BuildPlugin is executed succesfully on compileDebugKotlin task, but it processes only my project classes.
Is there any possibility to point it to flutter.jar somehow, maybe using classPath transformation parameter?
I tried to use this part from plugin README:
configurations {
examplePlugin "foo:bar:1.0"
}
with some modifications, but got "Gradle DSL method not found: 'examplePlugin()'" error.
Unfortunately, this is not really compatible to how build pipelines work. What you can do is that you use the shade plugin to copy a dependency's code into your project and then process it from there. Otherwise, Java agents would be the solution for this but Android does not support it.
I solved it by using Android Transform API and Javassist.
Please check my GitHub if anyone is interested how.
In Kotlin files when I have multiple errors, Android Studio becomes unusable.
When I make any change everything freezes for a few seconds, when I disable code inspection then it works normally.
This does not happen with java
Is this an issue with my pc or Kotlin or android studio, and is there any kind of a solution
Did you update your kotlin version?
I passed over a similar problem because of updating some implements or kotlin,google-services version etc. in the middle of a project!
After i returned the previous version; it is fixed...
So try using previous version for example kotlin_version = '1.3.40' in the project's build.gradle.
buildscript {
ext.kotlin_version = '1.3.40'
...
...
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
...
It might not be an issue with Kotlin.
Ensure that both the Kotlin plugin and Android Studio plugins are up to date.
The IDE can hang if it does not have enough memory allocated.
To change the memory allocation, go to Edit -> Edit Custom VM option and update the memory allocation as shown in the image below. This might help.
If you need additional assistance finding this setting, please refer to the official Android Studio Configuration guide.
Recently I have Updated my Android Studio from 2.2.3 to 2.3.0 project was running fine in 2.2.3 but after updating project dependency classpath from 2.2.3 to 2.3.0 getting lots of Missing Translations error from string.xml.
Can anyone tell me why it is happening and How to Resolve these Errors ?
Have many methods to fix this:
First method:
Add to build.gradle:
android {
lintOptions {
disable 'MissingTranslation'
}
}
Second method:
It's the ignore attribute of the tools namespace in your strings file, as follows:
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingTranslation" >
<!-- your strings here; no need now for the translatable attribute -->
</resources>
Third method:
In your ADT go to window->Preferences->Android->Lint Error Checking
Find there Missing Translation and change its Severity to Warning.
Reference link:
http://www.fasteque.com/missingtranslation-issue-for-release-builds/
Hope it helpful for you.
I was facing the exact same issue. Based on my observation, this problem was introduced with Gradle plugin version 2.3.0. It occurs when there is a module in your project that supports more languages than your app or other modules. You could start editing the translations of such modules but that makes them less maintainable.
If you disable the Lint checks using any of the suggestions here or for similar questions you also ignore actual translation errors in your app where a translation is missing for a language you are supporting. You need to be very careful maintaining your strings after that.
There is one more, also suboptimal, option: change the plugin version back to the last one not showing these symptoms in your build.gradle.
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
There is however a way to make this work without losing vital warnings/errors and without reverting to old tool versions. You can find it in Google's documentation and also in this answer.
android {
defaultConfig {
...
resConfigs "en", "fr"
}
}
This removes not needed resources and the warnings and errors along with them. I have updated my code and it builds fine now.
There is another issue that was introduced with the new Gradle plugin version: If you get false positives, i.e. errors complaining about missing translations for a string you have marked non-translatable, check if the string name exists in another module. In that case rename or provide the translations and the error disappears.