Convert gradle OpenCv library configuration to Gradle Experimental 2.0

I’m using the information in this question
http://stackoverflow.com/questions/17767557/how-to-use-opencv-in-android-studio-using-gradle-build-tool?answertab=active#tab-top to build an embedded OpenCV application as presented by TGMCians. Everything work fine for the preview example, however, when I try to implement the mixed processing example I begin to run in problems.

Currently, I’m using Android Studio 1.3.1 and ndk 10.

For that reason, I need to use the Gradle 2.0 experimental plugin.

I configure the initial configuration of the project properly.

However, the configuration of the build.gradle of the inner library is given me problems.

The configuration for old Gradle was


    apply plugin: 'android-library'
    
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.2.3'
        }
    }
    
    android {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"
    
        defaultConfig {
            minSdkVersion 15
            targetSdkVersion 22
            versionCode 2480
            versionName "2.4.8"
        }
    
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                resources.srcDirs = ['src']
                res.srcDirs = ['res']
                aidl.srcDirs = ['src']
            }
        }
    }

I applied part of the changes required for the experimental version, but I have problems with the SourceSet definition. I try this but the manifest definition is not working.


    apply plugin: 'com.android.model.library'
    
    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle-experimental:0.2.0'
        }
    }
    
    model {
        android {
            compileSdkVersion = 22
            buildToolsVersion = "22.0.1"
    
            defaultConfig.with {
                minSdkVersion.apiLevel = 15
                targetSdkVersion.apiLevel = 22
                versionCode = 2480
                versionName = "2.4.8"
            }
    
            sourceSets {
                main {
                    java {
                                srcDir 'src'
                                srcDir 'resources'
                    }
                    resources {
                                srcDir 'resources'
                    }
                    manifest.source {
                        srcDir 'library'
                        include 'AndroidManifest.xml'
                    }
                }
            }
        }
    }

I don’t know how to transform the


    main {
                    manifest.srcFile 'AndroidManifest.xml'
                    java.srcDirs = ['src']
                    resources.srcDirs = ['src']
                    res.srcDirs = ['res']
                    aidl.srcDirs = ['src']
                }

Specially reference the manifest, the res and aidl.

Could someone can give a hint, how can I solve that. Gradle documentation for the experimental plugin is not as comprehensive as you expect https://docs.gradle.org/current/userguide/java_plugin.html.