解决Android Studio不能创建aidl文件问题

如图,在准备创建aidl文件时选项置灰

仔细看其实就是配置文件的问题,在build.gradle(:app)下的配置添加

gradle 复制代码
    buildFeatures {
        aidl true
    }

完整配置如下:

gradle 复制代码
plugins {
    id 'com.android.application'
}

android {
    namespace 'com.example.aidl'
    compileSdk 34

    defaultConfig {
        applicationId "com.example.aidl"
        minSdk 24
        targetSdk 34
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    buildFeatures {
        aidl true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
相关推荐
Lei活在当下2 小时前
Codex 工程化实践指南:深入理解 AGENTS.md、SKILL.md 与 MCP
android·openai·ai编程
修炼者3 小时前
Toast的显示流程
android
simplepeng6 小时前
Room 3.0 KMP Alpha-01
android·kotlin·android jetpack
Lei活在当下6 小时前
Windows 下 Codex 高效工作流最佳实践
android·openai·ai编程
fatiaozhang95276 小时前
基于slimBOXtv 9.19.0 v4(通刷晶晨S905L3A/L3AB芯片)ATV-安卓9-完美版线刷固件包
android·电视盒子·刷机固件·机顶盒刷机·晶晨s905l3ab·晶晨s905l3a
私房菜7 小时前
Selinux 及在Android 的使用详解
android·selinux·sepolicy
一只特立独行的Yang8 小时前
Android中的系统级共享库
android
两个人的幸福online8 小时前
php开发者 需要 协程吗
android·开发语言·php
修炼者9 小时前
WindowManager(WMS)构建全局悬浮窗
android
xiaoshiquan120610 小时前
Android Studio里,SDK Manager显示不全问题
android·ide·android studio