Getting error on adding any new package to the project - android

Whenever I'm adding any new package, I am starting to get the following error( I added the package for example ext_video_player: ^0.1.2, and got error) :
Plugin project :ext_video_player not found. Please update settings.gradle.
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 462
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Cannot invoke method afterEvaluate() on null object
I tried downgrading flutter to 3.7.0 from latest version, but of no help. It is happening when I'm adding any new package to my project.

Related

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

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.

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.

How to fix this build issue in android?

i keep getting this build error, i cant get the generated binding object correctly in the Kotlin code
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: The processing instruction target matching "[xX][mM][lL]" is not allowed.
i've tried to invalidate, restart, clean the project but it didn't pay off
if the clean and rebuild doesn't work.I think that downgrading your gradle version to 1.2.3.I hope it helps.

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 build fails in Jenkins - because of evaluating project: app

I am running the following gradle script in my Jenkins android job - ./gradlew app:connectedQADebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.size=large
And it always fails because of this problem What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'com.google.gms.google-services']
No such property: applicationVariants for class: java.lang.String
The same script works when I run from android studio on the same machine.
However when I run /gradlew app:connectedQADebugAndroidTest it works. Can anyone please help me understand and solve the problem? Thanks!

Categories

Resources