解决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'
}
相关推荐
砖厂小工15 分钟前
Now In Android 精讲 10 - AGENTS.md:写给 AI Agent 的项目说明书
android
Ehtan_Zheng1 小时前
Jetpack Compose 动画转换编排的艺术
android
Ehtan_Zheng1 小时前
Jetpack Compose 动画入门:轻松掌握状态驱动的动画转换
android
Ehtan_Zheng1 小时前
Jetpack Compose 布局与可见性动画
android
_李小白2 小时前
【android opencv学习笔记】Day 12: HSV 色彩空间
android·opencv·学习
千里马学框架2 小时前
手机大厂Activity嵌套模式及三分屏SplitScreen功能调研报告-独家干货
android·智能手机·分屏·aaos·安卓framework开发·车机·三分屏
Mr.QingBin2 小时前
SystemUI插件开发指南
android
芋只因2 小时前
MySQL 分库分表与 MyCat 的使用
android
Ehtan_Zheng3 小时前
Jetpack Compose 与 RecyclerView 混合布局的性能债
android
Kapaseker3 小时前
MVVM 旧城改造,边界划分各有招
android·kotlin