解决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'
}
相关推荐
Coffeeee7 分钟前
从 Android 15 到 Android 17,谷歌猝不及防的音频改动
android·前端·google
用户693717500138424 分钟前
AI 领域的 Harness,到底是什么意思?
android·前端·后端
恋猫de小郭1 小时前
Flutter 开发怎么做 Agent ?从工程实战详细给你解读下
android·前端·flutter
安卓修改大师1 小时前
安卓修改大师实战:Activity生命周期全解析与Smali插桩教程
android
zhangphil2 小时前
Android集成封装libjpeg-turbo解码库,Kotlin语言实现
android
码上有光2 小时前
c++:map和set的底层实现
android·java·c++·set·map
峥嵘life2 小时前
Android GMS 开机向导横竖屏切换配置总结
android·学习
apihz2 小时前
PING 接口 PLUS 全球版 —— 免费全球多节点 Ping 检测 API教程
android
阿pin2 小时前
Android随笔-epoll机制
android·epoll
plainGeekDev2 小时前
Gradle 写法 → Kotlin DSL
android·java·kotlin