解决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'
}
相关推荐
专注Android黑科技4 小时前
Android 玩机黑科技:刀盾「系统冰点还原」与「保环境双清(恢复出厂不掉ROOT)」全图解教程
android·技术分享
StarsGreen6 小时前
Android meminfo 服务详细介绍
android
三少爷的鞋7 小时前
Main-safe、非阻塞与结构化并发,才是协程架构的核心
android
Escalating_xu18 小时前
【MySQL】事务管理(上):从 ACID 到提交回滚,把一次转账真正做完整
android·数据库·mysql
StarsGreen1 天前
dumpsys gfxinfo数据信息分析方法
android
好的佩奇1 天前
蓝牙之 GATT 数据模型
android·flutter·蓝牙
Android小码家1 天前
Systemui和Launcher是如何无限重启
android·framework
GY-931 天前
【Android】WorkManager
android
fatiaozhang95271 天前
开心电视助手极速版-版本9.6-新增安卓平台版本
android·开心电视助手极速版·版本9.6
urkay-1 天前
Android 线程池工具类与监控
android·java·性能优化