Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build failed unable to resolve class com.android.build.output file react-native

I am running my application on Android with React-Native and its appear the next error :

"build file 'C:\Users........\android\app\build.gradle': 3: unable to resolve class com.android.build.OutputFile"

I ve tried with Android Studio and GenyMotion but the problem is the same.

Anybody has an idea of what happen ?

Thanks !!

like image 842
Avedis Maroukian Avatar asked Apr 25 '17 21:04

Avedis Maroukian


2 Answers

Make sure in the section:

buildscript { dependencies { ... } }

From file:

android / build.gradle

Has the line:

classpath("com.android.tools.build:gradle:3.4.2")

like image 61
Glenn Andrés P. Rosario Avatar answered Nov 17 '22 15:11

Glenn Andrés P. Rosario


I got a similar error

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/mick/Codes/git/projects/alerto-balita/AlertoBalitaApp/android/app/build.gradle' line: 3

* What went wrong:
Could not compile build file '/Users/mick/Codes/git/projects/alerto-balita/AlertoBalitaApp/android/app/build.gradle'.
> startup failed:
  build file '/Users/mick/Codes/git/projects/alerto-balita/AlertoBalitaApp/android/app/build.gradle': 3: unable to resolve class com.android.build.OutputFile
   @ line 3, column 1.
     import com.android.build.OutputFile
     ^

  1 error

In my case I accidentally removed classpath 'com.android.tools.build:gradle:2.3.3' in the project build.gradle returning it solved the compilation problem

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
like image 43
mjabadilla Avatar answered Nov 17 '22 16:11

mjabadilla