0

I'm using the information in this question How to use opencv in android studio using gradle build tool? 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.

Community
  • 1
  • 1
Juan Acosta
  • 371
  • 3
  • 10
  • Please refer to the following answer: http://stackoverflow.com/questions/31895430/android-gradle-experimental-0-2-0-add-res-and-aidl – VitalyD Aug 19 '15 at 11:20
  • Hi VitalyD, I try the configuration in that answer and now the error is No such property: android for class : com.android.build.gradle.managed.AndroidConfig in the main project. The opencv library apparently is compiling properly. I tried this solution [no-such-android-config](http://stackoverflow.com/questions/32310523/issue-when-migrating-to-gradle-experimental-2-5-no-such-method-androidconfig), the its the same that I have. – Juan Acosta Sep 02 '15 at 01:30

0 Answers0