I am trying to migrate my Android project to a new experimental gradle plugin. I followed the instructions on the this page. I made changes to the necessary files, but I have an error while trying to synchronize the project with gradle files.
Error: Unable to load class 'com.android.build.gradle.managed.ProductFlavor_Impl'. Possible causes of this unexpected error:
- Gradle The dependency cache may be corrupted (this sometimes happens after a network connection timeout). Restart dependencies and synchronization project (network required).
- The state of the assembly process (daemon) may be damaged. Stopping all gradle daemons can solve this problem. Stop gradle build processes (reboot required)
- Your project may use a third-party plugin that is incompatible with other project plugins or the version of gradle requested by the project.
In the case of corrupt gradle processes, you can also try closing the IDE and then killing all Java processes.
build.gradle in my app folder is very similar to this:
apply plugin: 'com.android.model.application' apply plugin: 'maven' repositories { maven { url = getBaseRepository() credentials { username = NEXUS_USERNAME password = NEXUS_PASSWORD } } mavenCentral() } def int CACHE_LIMIT = CACHE_CHANGING_MODULES_FOR_SECONDS.toInteger() configurations.all { resolutionStrategy.cacheChangingModulesFor CACHE_LIMIT, 'seconds' } model { android { compileSdkVersion = 23 buildToolsVersion = "23.0.0" defaultConfig.with { applicationId = "<myRealAppIdIsHere>" minSdkVersion.apiLevel = 14 targetSdkVersion.apiLevel = 18 multiDexEnabled = true } } android.buildTypes { debug { /*buildConfigField.with { create() { type = "boolean" name = "DEBUG_BUILD" value = rootProject.ext.debugBuild } }*/ } release { minifyEnabled = false proguardFiles += 'proguard-rules.pro' /*buildConfigField.with { create() { type = "boolean" name = "DEBUG_BUILD" value = rootProject.ext.releaseBuild } }*/ } } } dependencies { // my dependencies are here... }
Does anyone know where the problem is? I don't know why the error message contains a problem with ProductFlavor, because my project has no tastes ...
UPDATE
I tried to clean my project - failed to clean, but the error message during cleaning is more specific:
Error: (10, 1) There was a problem setting up the project ': app'. The exception that is executed when the model rule is executed is: com.android.build.gradle.model.BaseComponentModelPlugin $ Rules # createVariantData (org.gradle.model.ModelMap, org.gradle.model.ModelMap, com.android.build.gradle.internal. TaskManager)> afterEach () Failed to resolve all the dependencies for the configuration: app: _debugCompile. Exception thrown while executing a model rule: model.android Cannot set the readonly: minSdkVersion property for class: com.android.build.gradle.managed.ProductFlavor_Impl
But I do not know how to fix it.
android android-gradle build.gradle gradle gradle-plugin
PetrS
source share