解决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'
}
相关推荐
hqk24 分钟前
玩Android×AI Coding:从产品到代码,完整跑通一套 AI 软件研发工作流
android·ai编程·vibecoding
安卓修改大师1 小时前
安卓修改大师实战:深入解析Android主题Theme修改与沉浸式界面实现
android
stevenzqzq3 小时前
app性能日志工具
android
DB哥讲数据库3 小时前
【最新】MySQL9.7安装教程:图文详解(附MySQL安装包)
android·mysql·adb
IT乐手4 小时前
Android 写本地日志工具类
android·java
非典型Android程序员5 小时前
Launcher学习总结
android
Coffeeee5 小时前
Android功耗优化,哪些代码会让你的机子发热又耗电
android·架构·kotlin
xianrenli387 小时前
Android14自动时区更新
android·学习·framework·aosp14·自动时区
心中有国也有家7 小时前
AtomGit Flutter 鸿蒙客户端:零外部资源的应用打包策略
android·javascript·flutter·华为·harmonyos
-SOLO-7 小时前
解决gralde下载太慢的问题
android