Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:Could not find method getCompileConfiguration() for arguments [] on object of type com.android.build.gradle.internal.api.ApplicationVariantImpl

I' am working on React Native technology and everything was working fine until yesterday and today when I opened react-native project in the android studio it gave me this error:

Error:Could not find method getCompileConfiguration() for arguments [] on object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.

Please help me out with the best solution to resolve this issue.

Thanks

like image 248
Ashish Guleria Avatar asked May 02 '18 13:05

Ashish Guleria


People also ask

How to add dependency in Gradle java?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.

What is dependency in Android?

Dependency injection (DI) is a technique widely used in programming and well suited to Android development. By following the principles of DI, you lay the groundwork for good app architecture. Implementing dependency injection provides you with the following advantages: Reusability of code. Ease of refactoring.


1 Answers

I think this is due to com.google.gms:google-services released a new version that is not compatible with the gradle build tools, to fix it I changed android/build.gradle

dependencies {
  - classpath 'com.android.tools.build:gradle:2.2.+'
  - classpath 'com.google.gms:google-services:3.+'
  + classpath 'com.android.tools.build:gradle:2.2.3'
  + classpath 'com.google.gms:google-services:3.2.1'
}

To use strict versions, as per the docs here

like image 138
albinekb Avatar answered Oct 14 '22 14:10

albinekb