解决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'
}
相关推荐
AgCl2319 分钟前
MYSQL-6-函数与约束-3/17
android·数据库·mysql
zzb15801 小时前
Fragment 生命周期深度图解:从 onAttach 到 onDetach 完整流程(面试必备)
android·java·面试·安卓
众少成多积小致巨1 小时前
Android 源码查看笔记
android·源码
angerdream1 小时前
Android手把手编写儿童手机远程监控App之前台服务
android
billy_huang2 小时前
Capacitor的基本使用
javascript·android studio
敲代码的瓦龙3 小时前
Android?Activity!!!
android
重生之我在安卓搞音频5 小时前
二、Android 音频框架
android·音视频
studyForMokey5 小时前
【Android面试】Java专题 todo
android·java·面试
代码改善世界5 小时前
【MATLAB初阶】矩阵操作(二):矩阵的运算
android·matlab·矩阵
九皇叔叔5 小时前
MySQL实操指南:复制表及数据复制全解析
android·数据库·mysql