0

I use IntelliJ IDEA for creating #Flutter projects and I have the Android Studio for installation purposes of Flutter onto my machine. The problem arose when I upgraded the Android Studio from 3.1.4 to 3.2.1. Moreover, after this upgrade, I'm no longer able to create any project in both IDEs.

The error message in IntelliJ

enter image description here

The error message in Android Studio

enter image description here

P.S. Those are the default programs of both IDEs namely, IntelliJ and Android Studio.

any newly-created project brings up this error; however, previously-created projects work perfectly fine.

My machine has 64-bit OS, x64-based Processor

IntelliJ

 IntelliJ IDEA 2018.3.3 (Community Edition)

 Build #IC-183.5153.38, built on January 9, 2019

 JRE: 1.8.0_152-release-1343-b26 amd64

 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

 Windows 10 10.0

Android Studio

 Android Studio 3.2.1

 Build #AI-181.5540.7.32.5056338, built on October 9, 2018

 JRE: 1.8.0_152-release-1136-b06 amd64

 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

 Windows 10 10.0

project's build.gradle file:

// Top-level build file where you can add configuration options common to 
all sub-projects/modules.

    buildscript {

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


            // NOTE: Do not place your application dependencies here; they                 
            belong
            // in the individual module build.gradle files
        }
    }

allprojects {
        repositories {
            google()
            jcenter()
        }
    }

task clean(type: Delete) {
        delete rootProject.buildDir
    }

the individual module build.gradle file:

apply plugin: 'com.android.application'

android {
        compileSdkVersion 28
        defaultConfig {
        applicationId "com.example.nonna.myapplication"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner                 
"android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     
            'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-        
core:3.0.2'
}

I have checked those questions but unfortunately, the error wasn't fixed.

Build errors after Android Studio 3.2.1 upgrade

Could not find com.android.tools.build:aapt2:3.2.0

James Z
  • 12,209
  • 10
  • 24
  • 44
Nawal
  • 31
  • 1
  • 6

1 Answers1

3

This issue got solved and now the IDE is working like a charm. As it was seen from the provided screenshots there was an error in the Android Gradle plugin, so to solve this issue follow the numbered steps in the newly provided screenshots below.

(Part 1) Solving gradle issue due to upgrading Android Studio to 3.2.1

  • Step 0: From the left panel in your IDE, choose the android [name_of_project] folder
  • Step 1: look for the build.gradle file then double click it to start editing it
  • Step 2: change exactly the line that states classpath 'com.android.tools.build:gradle:3.2.1' to the current version of your Android Studio, in other terms, classpath 'com.android.tools.build:gradle:3.3.0' in my case.

(Part 2) Solving gradle issue due to upgrading Android Studio to 3.2.1

  • Step 3: After finishing from Steps 1 & 2, go to the gradle folder
  • Step 4: Double click on the wrapper subfolder
  • Step 5: Click the gradle-wrapper.properties file to start editing it
  • Step 6: make sure that your gradle version is compatible with your current Android Studio distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

The Android Gradle plugin 3.3.0 requires the Gradle version of 4.10.1 and newer.

Disclaimer: you need to do these steps whenever you create a new project on whatever IDE you use namely, Android Studio, IntelliJ IDEA, and VS Code.

Nawal
  • 31
  • 1
  • 6