5

I was running android application very well then i updated Android Studio to 3.0 and Gradle version to latest 4.1. After Synch the project i got following build error

    e.project.sync.GradleSyncState - Gradle sync failed: Exception thrown while executing model rule:
BaseComponentModelPlugin.Rules#createVariantData(ModelMap<AndroidBinaryInternal>, ModelMap<AndroidComponentSpec>, TaskManager) > afterEach()

I will be thankful for this quick favour.

Salman Nazir
  • 2,759
  • 2
  • 28
  • 42

1 Answers1

5

Temporary solution, which worked for me, was to change the following things:

  1. In top level .gradle file - change version of experimental plugin to 0.9.3:

    dependencies { classpath 'com.android.tools.build:gradle-experimental:0.9.3' classpath 'com.google.gms:google-services:3.0.0' }

  2. Change Gradle plugin version from 4.1 to 3.3 in gradle-wrapper.properties

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

It works with android studio 3.0

Kamen Stoykov
  • 1,715
  • 3
  • 17
  • 31
  • I find that these versions work in Android Studio 3.5 and 3.5.1... to produce _unsigned_ APKs, but that if I try to build a codesigned APK with them, I get "The project is using an unsupported version of Gradle". So now I'm thinking I need to find a version of Android Studio that will codesign using 3.3. Have you been able to codesign APKs using these Gradle versions on Android Studio 3.0? – Dronz Oct 25 '19 at 18:14
  • I've just encounter this problem once and back then I solved as I described. – Kamen Stoykov Oct 28 '19 at 08:01
  • Ah, thanks for replying! I finally (just tonight) managed to codesign APKs using these same setting and Android Studio 3.0... but only 32-bit versions. You don't happen to remember if you could codesign 64-bit APKs, or what you did to get that to work, do you? I have a question on the topic languishing for attention at https://stackoverflow.com/questions/58565006/how-can-i-codesign-an-android-apk-using-the-gradle-experimental-plugin – Dronz Oct 28 '19 at 08:22