0

I just updated Android Studio from 3.5.x to 3.6.x. After the update I had to delete the .idea/* and .iml files in order for the build to work due to AS complaining about mixing Gradle and Non-Gradle files.

Since then, when I press "Run app", the Gradle build completes successfully and an apk is actually generated in the build/outputs/apk folder but the APK is not automatically installed on the running emulator. I have to drag and drop the .apk myself. Furthermore, when I manually run Build->Build APKs I get the message Build APK(s): APK(s) generated successfully for 0 modules:

Both the instant run and the "don't install APK if unchanged" settings have been disabled. I am using Gradle version 4.3 and the Android Gradle Plugin version 2.3.3

Update: More recent versions than 3.6.x run fine again without any fixes on my part needed. So I guess thanks, Google/Jetbrains.

Max
  • 431
  • 1
  • 5
  • 13

1 Answers1

1

Upgrade tools.build:gradle version

dependencies {
         classpath 'com.android.tools.build:gradle:3.6.1'
        // classpath 'com.android.tools.build:gradle:3.6.3'

    }

Upgrade distributionUrl version. gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Then add below in App level build.gradle section.

 android {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }

Then Clean-Rebuild-Restart IDE.

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • When I update the tools.build:gradle version I get the error `Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.` when trying to sync the project. – Max Apr 23 '20 at 12:08
  • @Max for this issue , check https://stackoverflow.com/questions/50122867/gradle-build-fails-unable-to-find-method-org-gradle-api-tasks-testing-test-get – IntelliJ Amiya Apr 23 '20 at 13:06
  • @Max Solved this yet? – IntelliJ Amiya Apr 30 '20 at 13:45
  • I got a few steps further but all ways led towards having to update gradle or the Android gradle plugin, which my codebase does not permit yet. However, even newer versions of Android Studio work without any problems, so I am currently running 4.0. – Max Jun 01 '20 at 17:45