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

10,315

Solution 1

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
    }
}

Solution 2

Make sure in the section:

buildscript { dependencies { ... } }

From file:

android / build.gradle

Has the line:

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

Share:
10,315

Related videos on Youtube

Avedis Maroukian
Author by

Avedis Maroukian

Updated on September 15, 2022

Comments

  • Avedis Maroukian
    Avedis Maroukian almost 2 years

    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 !!