解决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'
}
相关推荐
走在路上的菜鸟37 分钟前
Android学Flutter学习笔记 第一节 Android视角认知Flutter(View,intent,Async UI)
android·学习·flutter
一起搞IT吧39 分钟前
相机Camera日志实例分析之十二:相机Camx【萌拍后置zoom拍照】单帧流程日志详解
android·c++·数码相机·智能手机
冬奇Lab1 小时前
一次 Android 车机黑屏问题的深度剖析:当显示驱动遇上中断风暴
android·性能优化·debug
兮动人1 小时前
Fatal error: Uncaught think\exception\ErrorException: SourceGuardian Loade
android·php
笔夏1 小时前
【安卓学习之myt】adb常用命令
android·学习·adb
lxysbly1 小时前
安卓gba模拟器下载
android
bst@微胖子2 小时前
CrewAI+FastAPI实现多Agent协作完成软件编码项目
android·fastapi
Android-Flutter2 小时前
Compose - Scaffold使用
android·kotlin
2501_946244783 小时前
Flutter & OpenHarmony OA系统图片预览组件开发指南
android·javascript·flutter
极客小云3 小时前
【IEEE Transactions系列期刊全览:计算机领域核心期刊深度解析】
android·论文阅读·python