Is it normal that the *.aidl files appeared in the

2019-08-14 10:36发布

问题:

I used aidl files in my source codes, but compare to the apk build under code base, the one build within Andorid Studio has extra folder that contains .aidl files. Is that normal? Shouldn't these *.aidl files be wrapped in classes.dex?(or resources.arsc?) I also had tried to use

packagingOptions { 
    exclude './src/com/mytest/test/*.aidl' 
} 

but it doesn't work! following is my build.gradle:

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

allprojects {
    repositories {
        jcenter()
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.mytest.test"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles 'proguard-apk.config'
        }
    }

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

        //androidTest.setRoot('../tests')
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'

        exclude './src/com/mytest/test/*.aidl'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

回答1:

Thought it seems passed a long time, I still want to post to help you. I met the same problem, I resolved it! try to remove resources.srcDirs = ['src'] in you build.gradle this indicate java resource not android resource, the res already indicate android resource