In android/app/build.gradle, there is no "plugins {}" block. Instead, there are some "apply plugin":
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Now, I want to add another Android plugin, how should I do that? I've tried writing a "plugins {}" block, but that does not work. I've also tried apply plugin: 'my.plugin.name', but that also results in an error.
Is there a way that I can add custom Androids plugins into a Flutter Project?
Here is what I want: I need the google map SDK for Android in my project, which requires this plugin :'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'.
I know there is a flutter package on google map, but it does not support heat map, so I have to go native.
Related
I already added the agconnect-services.json file and already succeeded in integrating HMS Push Kit in getting AAID and device token
Found it. I added apply plugin: 'com.huawei.agconnect' in /android/app/build.gradle under apply plugin: "com.android.application"
Please note that this configuration must be added to the next line of apply plugin: 'com.android.application' to the app-level build.gradle file. Otherwise, an error may occur.
apply plugin: 'com.huawei.agconnect'
attempting to use gradle test fixtures with gradle 6.6.1, using the following set of plugins
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: 'java-test-fixtures'
produces an error along the lines of
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method testFixturesApi() for arguments [io.kotest:kotest-property:4.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
(similar results for testFixturesImplementation)
Adding the java-library plugin as apparently required by the documentation:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: 'java-test-fixtures'
apply plugin: 'java-library'
yields something along the lines of
The 'java' plugin has been applied, but it is not compatible with the Android plugins.
How can I get gradle testFixtures working when building with kotlin 1.4 (and possibly kotest) for Android on Ubuntu 20.04? My overall intent is to use custom kotest generators for creating property testing fixtures shared among several testing source trees under the same app project, namely
./app/src/test/java
./app/src/androidTest/java
There are good reasons for sharing test helpers in support of code dryness; such approach is not the subject of this discussion; I am not looking for advice in that regard. The goal of this question is a manner to get testFixtures working, since I'm obviously not understanding how to do so, and your help in this direction is much appreciated. I can provide additional details if the above description, deliberately terse, is lacking in necessary detail.
They are not supported at android projects, I tested on production project, also created example projects. I have such error
Unable to find a variant of project :modtwo providing the requested
capability Fictures:modtwo-test-fixtures:unspecified
It seems they have conflicts with product flavors. Also wrong information here, because in the example it is not an android project.
apply plugin: 'java-test-fixtures'
apply plugin: 'java-library'
You don't want to put either of those plugins in your application module. The belong in the library module that's producing the fixtures.
I have been trying to connect Android studio 4.1 with Firebase but it is not getting linked. I followed the instruction given on the firebase website like copying the dependencies, plugins, etc. into the app Gradle build and Project Gradle Build. My Gradle version is 6.5 and Gradle plugin is 4.1.
The Error shown is:
org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to org.codehaus.groovy.ast.expr.ArgumentListExpression
org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to org.codehaus.groovy.ast.expr.ArgumentListExpression
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I believe i found the problem.
If you use
apply plugin: 'com.google.gms.google-services'
to your build.gradle(module) like its instructed you get this error.
Instead change apply plugin to id
id 'com.google.gms.google-services'
I haven't finish the app but when I sync, it's successful
Using the Firebase guide to link my app with Firebase, the problem is that you have to scatter the plugins by these 2 ways of implementation:
//First way to implement plugins
plugins {
id 'com.android.application'
id 'kotlin-android'
}
//Second way to implement plugins
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
Taking out the apply plugin ones from the {} of plugins solved my link issues ;)
This Error Rise due to if you are using
apply plugin: 'com.google.gms.google-services'
If You replace apply plugin: with id in build.gradle than this error will be solved.
After change
id 'com.google.gms.google-services'
I do not know how correct this information is, however, I think you should remove the block of code
pugins{
id '...'
}
Instead, start adding code/plugins like:
apply plugin: "com..."
Essentially all the plugins your firebase suggests. It works like magic and you do not have to lose the plugin.
Example Screen Shot
//First way to use Plugin
plugins {
id 'com.android.application'
}
//Second way to use Plugin.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
I solved my problem by adding:
plugins {
id 'kotlin-kapt'
}
Just Remove Flower Parenthesis mention like this below with out flower brackets
whenever using apply plugins
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
As in topic. Gradle require to set up plugin and there are times that it is mentioned to apply plugin: 'android', and other to apply plugin: 'com.android.application' .
What are the differenceres? Which one should be used ?
apply plugin: 'android' specifies that It's an Android project but it does not specify Its an Application or Library project. To make life easier you can tell gradle the type of project and indicate which plugin should be used. I recommend to use apply plugin: 'com.android.application' if project is an app and apply plugin: 'com.android.library' if project is a lib. It helps gradle to compile project efficiently.
Click here for detailed explanation -
Which one should be used ?
apply plugin: 'com.android.application'
What are the differenceres?
They renamed the plugin to comply with the naming convention that Gradle is starting to adopt for plugins, with an eye towards a new plugin system in future versions of Gradle.
in the shorter history the Android Gradle based builds need change the names for the plugins.
Like
apply plugin: 'com.android.application'
Anyone can tell me the new plugin name for library projects ?
apply plugin: 'com.android.library'