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 implemented Firebase crashlytics as suggested. I have put this in my app level release build variant:
firebaseCrashlytics
{
mappingFileUploadEnabled true
}
but when I start to build signed apk I am always getting this error
Task :app:uploadCrashlyticsMappingFileRelease FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.
Expected file collection to contain exactly one file, however, it contains no files.
If I set mappingFileUploadEnabled to false then release apk builds successfully. I have searched a lot but couldn't find a work around. Anyone can help?
Error: "Crashlytics could not find Google Services plugin task: processReleaseGoogleServices. Make sure com.google.gms.google-services is applied BEFORE com.google.firebase.crashlytics. If you are not using the Google Services plugin, you must explicitly declare googleServicesResourceRoot inputs for Crashlytics upload tasks."
I had something like this in build.gradle
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.google-services'
changed it to this and voila! it works:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
I faced the same event today.The reason for this to happen is as follows.
If minify true is set, obfuscation will be applied at build time and mapping.txt will be created.
If minify false, it will not be obfuscated at build time and mapping.txt will not be created.
If you set mappingFileUploadEnabled true in the minify false state, the Firebase SDK will try to upload mapping.txt to Firebase even though mapping.txt is not created at build time.
The result is an error.
So, if you set minify false, you have to set mappingFileUploadEnabled false, if you set minify true, you need to set mappingFileUploadEnabled true or false (when mappingFileUploadEnabled false, the crash log on Firebase was obfuscated. It may not make much sense as it will be displayed in state).
Hint
https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android#firebase-crashlytics-sdk_7
https://developer.android.com/studio/build/shrink-code#enable
I have resolved this issue by moving the following line from bottom of the page to top in build gradle.
Previous Settings:
apply plugin: 'com.google.gms.google-services'
New Settings:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
And the issue is resolved.
In my case I received the error because I wasn't connected to the internet. Fixed it by connecting to the internet and my build release worked perfectly for my Flutter App.
Just change sequence of crashlytics, apply plugin as below :
// Put Google Service
apply plugin: 'com.google.gms.google-services'
// After that the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'
Decreasing the version of the following
classpath "com.google.firebase:firebase-crashlytics-gradle:2.8.0"
to 2.6.0 solved my problem.
In my case, it was not adding com.google.gms:google-services at all. The project is in Flutter and Flutter Firebase documents do not mention this.
Add these to android/build.gradle (check the latest versions on the internet):
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
Add these to at the very end of android/app/build.gradle:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
For some reason, even if you have generated lib/firebase_options.dart with flutterfire, the plugin still wants google-services.json file you have got from Firebase. Paste that file into android/app/ directory. And it builds for release.
Add this at the bottom of your build.gradle file
apply plugin: 'com.google.gms.google-services'
I have faced several times, and there is a different solution i have.
First of all:
You need to open android module of that project.
Flutter -> Open Android module in Android Studio.
And then go to Gradle Scripts, find gradle.properties (Global properties) and remove this code
systemProp.http.proxyHost=
systemProp.https.proxyHost=
systemProp.https.proxyPort=80
systemProp.http.proxyPort=80
If you're working with GuardSquare's Dexguard solution. Order of your plugins should be,
plugins {
// Google Services Plugin
id 'com.google.gms.google-services'
// Firebase Crashlytics Plugin.
id 'com.google.firebase.crashlytics'
// Dexguard Plugin
id 'dexguard'
}
This way the uploading process of your mapping file is going to succeed.
Recent updation to com.google.android.gms:play-services-ads:8.4.0 results in this error. This does not happen when com.google.android.gms:play-services:8.4.0 is used, but it bloats the apk size significantly. Also to implement in-app billing, it is needed to check whether Google Play services are installed or not before starting a purchase.
Is there a workaround for this?
All you need to do in order to use GooglePlayServicesUtil is include the following dependency in your build.gradle:
compile 'com.google.android.gms:play-services-base:10.2.0'
Here you can see all the individual Play Services dependencies that you can pick from:
https://developers.google.com/android/guides/setup#split
I faced same problem but in my case i didn't added any other dependency even my problem solved by just changing the position of apply plugin: 'com.google.gms.google-services' in the build.gradle(Modile: app) file.
Line
apply plugin: 'com.google.gms.google-services'
was written at the last in the gradle file. Remove this from here and add it to the top, below the line apply plugin: 'com.android.application'
Like this:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
and sync now. Problem solved.
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'