15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android Studioでaidlファイルを認識させる

Last updated at Posted at 2014-08-21

#aidlファイルの作成
New->aidlから、IMyAidlInterface.aidlファイルを作成する。

IMyAidlInterface.aidl
interface IMyAidlInterface {
    /**
     * Demonstrates some basic types that you can use as parameters
     * and return values in AIDL.
     */
    void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
            double aDouble, String aString);
}

#build.gradleの編集
Android Studio 1.0.2, gradle plugin 1.0.0, build tools 21.1.2以降の組み合わせでは、特に設定しなくても認識されています。

ファイルを作成しただけではAndroid Studio上で認識されない。
build.gradleファイルに下記のコードを追加する。

    sourceSets{
        main{
            aidl.srcDirs = ['src/main/aidl']
        }
    }

追加した例

build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets{
        main{
            aidl.srcDirs = ['src/main/aidl']
        }
    }
}

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?