解决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'
}
相关推荐
华科易迅5 小时前
MybatisPlus增删改查操作
android·java·数据库
SHoM SSER6 小时前
MySQL 数据库连接池爆满问题排查与解决
android·数据库·mysql
黄林晴6 小时前
Android 17 取色器 API:无需权限,一行 Intent 跨应用取色
android
程序员陆业聪7 小时前
别再说 Flutter 是唯一选择了——KMP 正在悄悄抢走它的地盘
android
三少爷的鞋8 小时前
2026 已过 1/3:事豫则立,不预则废——关于架构、协程与边界的思考
android
冬奇Lab8 小时前
Android 15 音频子系统(八):Audio HAL 与硬件接口——音频数据的最后一公里
android·音视频开发·源码阅读
黄林晴11 小时前
Compose Multiplatform 1.10 发布:里程碑式更新!
android
流星白龙11 小时前
【MySQL】19.MySQL用户管理
android·mysql·adb
匆忙拥挤repeat12 小时前
Android Compose 可组合项的生命周期、副作用API
android
hnlgzb13 小时前
目前编写安卓app的话有哪几种设计模式?
android·设计模式·kotlin·android jetpack·compose