解决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'
}
相关推荐
2601_967980112 分钟前
python+appium自动化测试如何控制App的启动和退出
android·自动化测试·python·appium·设备调试
booboosui1 小时前
不写安装器:点一下就往对话里塞 152 个字符
android
一条破秋裤2 小时前
【1117】【内存资源管控】【笔记】
android·笔记
AI导出鸭PC端2 小时前
用 AI 导出鸭高效处理:豆包导 pdf 怎么压缩但清晰
android·人工智能·pdf·豆包·ai导出鸭
therese_100864 小时前
流媒体协议RTMP推流demo-安卓端
android
疯华整猫4 小时前
同一个 App,五种手机五种死法:2026 年 Android 五大 ROM 兼容的 8 个真实坑
android·性能优化
疯华整猫4 小时前
别再抄 Flutter 了:2026 年 Android / iOS / 小程序跨端架构选型的四本成本账
android·前端·ios
传奇开心果编程4 小时前
【Flutter踩坑排雷】第30课:异常未捕获坑|未捕获异常直接闪退,全局兜底故障处理
android·flutter·ios·移动开发·dart·ui框架·声明式ui
恋猫de小郭6 小时前
Flutter Native Interop 稳定了,Platform Channel 要退场了
android·前端·flutter
好的佩奇16 小时前
Dart 之可迭代对象与生成器
android·flutter·dart