Build failed : A problem occurred evaluating project ':#mauron85_react-native-background-geolocation-common' - android

FAILURE: Build failed with an exception.
Where:
Build file '/Users/User/Desktop/testApp/node_modules/#mauron85/react-native-background-geolocation/android/common/build.gradle' line: 1
What went wrong:
A problem occurred evaluating project ':#mauron85_react-native-background-geolocation-common'.
Failed to apply plugin 'com.android.internal.library'.
The option 'android.enableUnitTestBinaryResources' is deprecated.
The current default is 'false'.
It has been removed from the current version of the Android Gradle plugin.
The raw resource for unit test functionality is removed.
Steps for solution :-
Install patch-package, this will later be used to make the changes permanent. (optional - step)
Now you have to hack the node_modules. Go to node_modules#mauron85\react-native-
background-geolocation\android\common\gradle.properties change below things:-
android.enableUnitTestBinaryResources=true # <-- remove this line
android.builder.sdkDownload=true
Run npx patch-package #mauron85/react-native-background-geolocation to save the patch.
Rebuild the app.

Related

Plugin intercom update to latest version cordova error at build/run

I want to update plugin intercom to latest version. I am using cordova version 9.0.0
For iOS works fine, but to update intercom for android I must have the version of platform >= 9.0.0
I updated from version 7.1.1 to 9.0.0 (android platform), but I got 2 errors. I think that is gradle cause these errors... Because I tried to make another fresh cordova project to see if everything works fine... but application does not run/build.
The text of errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Script '..\platforms\android\cordova-plugin-intercom\be-intercom.gradle' line: 46
What went wrong:
A problem occurred evaluating script.
Could not find method execute() for arguments [] on task ':app:copyGoogleServices' of type org.gradle.api.tasks.Copy.
2: Task failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
compileSdkVersion is not specified. Please add it to build.gradle
I have google-services.json (in root).
Everything works fine before this update.
In ..\platforms\android\cordova-plugin-intercom\be-intercom.gradle at line 46 is tasks.copyGoogleServices.execute().
The solution is to replace the execute() with finalizedBy() in platforms\android\cordova-plugin-intercom\be-intercom.gradle and to copy google-services.json in platforms\android\app.
https://medium.com/#olku/gradle-5-0-broken-api-of-the-exec-task-5b2d76c8d121

Flutter returns `lifecycle-common-java8.jar (androidx.lifecycle:lifecycle-common-java8:2.0.0)` error

Flutter project won't run in Android Studio with AndroidX compatibility and returns following errors in Run/Console window:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':flutter_keyboard_visibility:javaPreCompileDebug'.
Could not resolve all files for configuration ':flutter_keyboard_visibility:debugCompileClasspath'.
Could not find lifecycle-common-java8.jar (androidx.lifecycle:lifecycle-common-java8:2.0.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-common-java8/2.0.0/lifecycle-common-java8-2.0.0.jar
And
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'path_provider'.
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
If you faced those errors just do the following steps:
open Android project in Android Studio (u can open a File or Class in android path then select Open for Editing interface Android Studio like next image)
In Build window select error line then in right side select Affected Modules:
For each modules in opened files (build.gradle) add lifecycle-common-java8 api inside dependencies{} section and then Build project:
dependencies {
...
api "androidx.lifecycle:lifecycle-common-java8:2.2.0"
}
Finally close Android project and run Flutter project.

Jenkins build failed with crashlytics

Trying to build android in Jenkins with crashlytics but every-time the error message is coming in log as
"FAILURE: Build failed with an exception.
Where:
Build file
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'io.fabric']
Could not create plugin of type 'CrashlyticsPlugin'.
Could not initialize class com.crashlytics.tools.gradle.CrashlyticsPlugin"
Please help, tried this way also "Android Jenkins build fails with crashlytics"
It did not work.
You have to install Crashlytics jar manuel into Jenkins. From here.
I guess the plug-in is facing some problems when downloading this file from Amazon.
You can check here.

Android Signed APK java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.typehandling.ShortTypeHandling

I am trying to build a signed APK with Android Studio.
I am getting the following error:
java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.typehandling.ShortTypeHandling
My research leads me to understand that this is caused by one of my dependencies being compiled with an old version of Groovy. My only dependency is the Google Maps API, so that must be it.
(this is a thread that talks some on the issue)
However, I am unable to find a solution to this problem. I have tried several ways of adding the Groovy backports compat 2.3.5:
- adding it to gradle dependencies and syncing the project
- manually adding it to m2
- downloading the jar and adding it as a library
None of these have been successful. It is possible however, that one of these solutions may work, but that I am missing some key piece of information necessary.
If you know what that might be, or if you have another way to solve this, I'd like to hear from you.
Thanks.
[Edit]Here is some additional information
C:\Users\Donald\AndroidStudioProjects\ReuseAndRepairAndroid>gradle dependencies --info
Starting Build
Starting file lock listener thread.
Settings evaluated using settings file 'C:\Users\Donald\AndroidStudioProjects\ReuseAndRepairAndroid\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\Donald\AndroidStudioProjects\ReuseAndRepairAndroid\build.gradle'.
Included projects: [root project 'ReuseAndRepairAndroid', project ':app']
Evaluating root project 'ReuseAndRepairAndroid' using build file 'C:\Users\Donald\AndroidStudioProjects\ReuseAndRepairAndroid\build.gradle'.
Evaluating project ':app' using build file 'C:\Users\Donald\AndroidStudioProjects\ReuseAndRepairAndroid\app\build.gradle'.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Donald\AndroidStudioProjects\ReuseAndRepairAndroid\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not create plugin of type 'AppPlugin'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 2.982 secs
[/Edit]

Execution failed for task ':app:mockableAndroidJar'

I am using local gradle of version 2.4 and IntelliJ IDEA 14.1.3
When I run project from IntelliJ it runs fine but when execute gradle clean build command from command line it gives the flowing exception and build fails.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mockableAndroidJar'.
> java.util.zip.ZipException: invalid entry compressed size (expected 2051 but got 2050 bytes)
This looks like an old ques which is not yet answered yet.
I got into same problem, when my jar files could not be read by Android Studio and it gave me the above mentioned error.
Taking lead from the comment by -Mikhail Boyarsky I changed classpath in build.gradle file to 'com.android.tools.build:gradle:2.2.3'.
Synced project and it started working.
I solved it by changing com.android.tools.build:gradle:2.3.0 version to 2.2.3, then build it with another exception and then I changed the version back to 2.3.0.
Not sure how it works, looks like a gradle bug.

Categories

Resources