title: How to pass an enum in AIDL?
body: <p>Im trying to pass enums using AIDL and it's wrapping a Parcelable but it's still failing to compile with the following error:</p>
  <pre><code>&gt; Task :app:compileDebugAidl FAILED
  ERROR: uk.ac.liverpool.altphone.service.Mode: couldn't find import for class uk.ac.liverpool.altphone.service.Mode
  </code></pre>
  <p>My files are as follows:</p>
  <p>Project Level <code>build.gradle</code>:</p>
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  buildscript {
      ext.kotlin_version = &quot;1.4.20&quot;
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath &quot;com.android.tools.build:gradle:4.1.1&quot;
          classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;
          def nav_version = &quot;2.3.3&quot;
          classpath &quot;androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version&quot;
  
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          google()
          jcenter()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  <p>Module Level <code>build.gradle</code>:</p>
  <pre><code>plugins {
      id 'com.android.application'
      id &quot;androidx.navigation.safeargs&quot;
      id 'kotlin-android'
      id 'kotlin-kapt'
      id 'kotlin-parcelize'
      id &quot;com.google.protobuf&quot; version &quot;0.8.12&quot;
  }
  preBuild {
      doFirst {
          new ProcessBuilder(&quot;java&quot;, &quot;$rootDir/scripts/Zipper.java&quot;)
          .directory(new File(&quot;$rootDir&quot;))
          .start()
          .waitFor()
      }
  }
  
  android {
      compileSdkVersion 29
      buildToolsVersion &quot;30.0.2&quot;
  
      defaultConfig {
          applicationId &quot;uk.ac.liverpool.altphone&quot;
          minSdkVersion 21
          targetSdkVersion 29
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
          javaCompileOptions {
              annotationProcessorOptions {
                  arguments += [&quot;room.schemaLocation&quot;: &quot;$projectDir/schemas&quot;.toString()]
              }
          }
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
      buildFeatures {
          viewBinding true
      }
      compileOptions {
          coreLibraryDesugaringEnabled true
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
      kotlinOptions {
          jvmTarget = '1.8'
      }
      tasks.withType(JavaCompile) {
          configure(options) {
              options.debug = true
              options.warnings = true
              options.compilerArgs &lt;&lt; '-Xlint:all' &lt;&lt; '-parameters' &lt;&lt; '-g:source,lines,vars'
          }
      }
  }
  
  dependencies {
      implementation 'androidx.activity:activity-ktx:1.2.0-beta02'
      implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
      implementation 'androidx.constraintlayout:constraintlayout:2.1.0-alpha1'
      implementation 'androidx.core:core-ktx:1.5.0-alpha05'
      implementation 'androidx.datastore:datastore:1.0.0-alpha06'
      implementation 'androidx.datastore:datastore-core:1.0.0-alpha06'
      implementation 'androidx.fragment:fragment-ktx:1.3.0-beta02'
      def nav_version = &quot;2.3.3&quot;
      implementation &quot;androidx.navigation:navigation-fragment-ktx:$nav_version&quot;
      implementation &quot;androidx.navigation:navigation-ui-ktx:$nav_version&quot;
      implementation 'androidx.recyclerview:recyclerview:1.2.0-beta01'
      def room_version = &quot;2.3.0-alpha03&quot;
      implementation &quot;androidx.room:room-runtime:$room_version&quot;
      kapt &quot;androidx.room:room-compiler:$room_version&quot;
      implementation 'androidx.startup:startup-runtime:1.0.0'
      implementation 'com.google.android.material:material:1.3.0-alpha04'
      implementation  &quot;com.google.protobuf:protobuf-javalite:3.10.0&quot;
      implementation &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;
      coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'
  }
  
  protobuf {
      protoc {
          artifact = &quot;com.google.protobuf:protoc:3.10.0&quot;
      }
      generateProtoTasks {
          all().each { task -&gt;
              task.builtins {
                  java {
                      option 'lite'
                  }
              }
          }
      }
  }
  </code></pre>
  <p>AIDL File <code>app/src/main/aidl/uk/ac/liverpool/altphone/service/IAltPhoneServiceInterface.aidl</code>:</p>
  <pre><code>// IAltPhoneServiceInterface.aidl
  package uk.ac.liverpool.altphone.service;
  
  // Declare any non-default types here with import statements
  import uk.ac.liverpool.altphone.service.Mode;
  
  interface IAltPhoneServiceInterface {
  
      oneway void setMode(in Mode mode);
  
      oneway void updateSettings(in Mode mode, in int headphone);
  
      oneway void stop();
  }
  </code></pre>
  <p>Kotlin File <code>app/src/main/java/uk/ac/liverpool/altphone/service/AltPhoneService.kt</code>:</p>
  <pre><code>package uk.ac.liverpool.altphone.service
  
  import android.app.Service
  import android.content.Intent
  import android.os.IBinder
  import android.os.Parcelable
  import kotlinx.parcelize.Parcelize
  import uk.ac.liverpool.altphone.R
  
  class AltPhoneService : Service() {
      override fun onBind(intent: Intent): IBinder {
          return null!!
      }
  }
  
  @Parcelize
  public enum class Mode : Parcelable {
      SINGLE, ALTERNATE;
  
      companion object {
          fun getModeByID(id: Int): Mode? = when (id) {
              R.id.single_mode_mi -&gt; SINGLE
              R.id.alternate_mode_mi -&gt; ALTERNATE
              else -&gt; null
          }
      }
  }
  </code></pre>