解决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'
}
相关推荐
TheNextByte12 分钟前
如何将联系人从Android传输到计算机的 6 种方法
android
喂_balabala3 分钟前
excludeFromRecents
android
TimeFine27 分钟前
Android AI解放生产力(五)实战:解放写API接口的繁琐工作
android
csj503 小时前
安卓基础之《(6)—Activity组件(3)》
android
怀旧,3 小时前
【Linux系统编程】13. Ext系列⽂件系统
android·linux·缓存
Dabei3 小时前
Android 语音助手简单实现与语音助手“执行任务”交流
android·前端
jzlhll1233 小时前
android NDSDManager onResolveFailed errorCode=3的解决方案
android
芦半山3 小时前
四年之后,重新审视 MTE:从硬件架构到工程落地
android·安全
2501_916007474 小时前
iOS与Android符号还原服务统一重构实践总结
android·ios·小程序·重构·uni-app·iphone·webview
allk554 小时前
Android 屏幕适配全维深度解析
android·性能优化·界面适配