解决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 小时前
Handler(二):MessageQueue 为什么不是普通队列?
android
阿巴斯甜5 小时前
Android Studio 新版 Logcat
android
监督者修6 小时前
从零构建 GIS 数据引擎:方案驱动架构的设计与实践
android·架构·kotlin
Yoke6 小时前
从零到三端:用 Kotlin Multiplatform + Compose 构建跨平台财务追踪应用
android
gxgldyh6 小时前
Android Framework源码解析(六):Launcher3 启动流程详解——AMS 如何拉起系统桌面?
android
XiaoLeisj6 小时前
HandlerThread 与 IntentService 使用及源码解析
android·handler
我命由我1234515 小时前
Android Studio - Android Studio 自定义预览尺寸
android·java·ide·java-ee·android studio·android-studio·android runtime
取个名字太难了~18 小时前
越用越便宜,越用越强大:影像 SDK 的边际成本递减与网络效应实践
android·数码相机·美颜·相机连接·demu
CHNE_TAO_EMSM19 小时前
Android studio 打开文件时自动下载源码
前端·javascript·android studio
AFinalStone21 小时前
Android 7系统网络(四)Native层(下)—netd Controller详解
android·网络