解决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 小时前
短思考第263天,每天复盘10分钟,胜过盲目努力一整年
android·前端·后端
安卓兼职framework应用工程师5 小时前
Android 10.0 按键智能机按键连续响两次的异常处理
android·audio·audioservice·按键音·按键声音
studyForMokey5 小时前
【Android 项目】个人学习demo随笔
android
吃喝不愁霸王餐APP开发者5 小时前
利用责任链模式解耦多平台(美团/饿了么)霸王餐接口的适配逻辑
android·责任链模式
百***78756 小时前
Step-Audio-2 轻量化接入全流程详解
android·java·gpt·php·llama
yangpipi-8 小时前
《C++并发编程实战》第5章 C++内存模型和原子操作
android·java·c++
云水木石10 小时前
Android 的下一个战场:Windows 应用与游戏?
android·windows·游戏
雨声不在10 小时前
Android文字渐变的实现
android·textview
GoldenPlayer10 小时前
KTS语法
android
GoldenPlayer11 小时前
后台服务Service销毁逻辑+单例造成的内存泄露
android