Experimental build plugin 0.2.0 with custom manifest and aidl

429 views
Skip to first unread message

jaka....@gmail.com

unread,
Aug 7, 2015, 12:00:20 PM8/7/15
to adt-dev
While testing new Android Studio 1.3 NDK support with Gradle 2.5 and experimental plugin 0.2.0 I came across problems with (probably) changes with manifest and aidl attributes. Mentiond attributes are not found.
Is there any documentation about changes in DSL as after extensive search I couldn't find any. Thanks!

Old build.gradle:
apply plugin: 'android-library'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
    }
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 2490
        versionName "2.4.9"
    }

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

New
build.gradle:
apply plugin: 'com.android.model.library'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle-experimental:0.2.0'
    }
}

model {
    android {
        compileSdkVersion = 19
        buildToolsVersion = "19.1.0"

        defaultConfig.with {
            applicationId = "org.opencv"
            minSdkVersion.apiLevel = 8
            targetSdkVersion.apiLevel = 19
            versionCode = 3000
            versionName = "3.0.0"
        }

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




jaka....@gmail.com

unread,
Aug 10, 2015, 10:06:25 AM8/10/15
to adt-dev
After a lot of experimeting, I came up with a working solution:

main {
    manifest.source {
        include 'AndroidManifest.xml'
        srcDirs += ['./']
    }
    java.source.srcDirs += ['./src']
    resources.source.srcDirs += ['./src']
    aidl.source.srcDirs += ['./src']
    res.source.srcDirs += ['./res']
}

juan....@apscore.com.au

unread,
Aug 17, 2015, 11:52:40 AM8/17/15
to adt-dev
Hi jaka,

Could you please post the complete config.

I'm stuck with the same issue, but I try to apply your modification and doesnot work.

thanks.

jaka....@gmail.com

unread,
Aug 23, 2015, 4:36:26 AM8/23/15
to adt-dev
I did everything as it's mentioned here.
The only thing I changed is OpenCV's build.gradle, full version bellow.

This should work only if you use OpenCV from Java. Also try deleting .gradle folder from you project and global cache (C:\Users\User\.gradle on Windows). Sometimes it takes things from cache causing old errors again.

apply plugin: 'com.android.model.library'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle-experimental:0.2.0'
    }
}

model {
    android {
        compileSdkVersion = 19
        buildToolsVersion = "19.1.0"

        defaultConfig.with {
            applicationId = "org.opencv.android"
            minSdkVersion.apiLevel = 8
            targetSdkVersion.apiLevel = 19
            versionCode = 3000
            versionName = "3.0.0"
        }
    }

    android.sources {
Reply all
Reply to author
Forward
0 new messages