解决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'
}
相关推荐
恋猫de小郭2 小时前
Android Studio 正式版 10 周年回顾,承载 Androider 的峥嵘十年
android·ide·android studio
aaaweiaaaaaa4 小时前
php的使用及 phpstorm环境部署
android·web安全·网络安全·php·storm
工程师老罗6 小时前
Android记事本App设计开发项目实战教程2025最新版Android Studio
android
pengyu10 小时前
系统化掌握 Dart 编程之异常处理(二):从防御到艺术的进阶之路
android·flutter·dart
消失的旧时光-194311 小时前
android Camera 的进化
android
基哥的奋斗历程12 小时前
Openfga 授权模型搭建
android·adb
Pakho love1 天前
Linux:文件与fd(被打开的文件)
android·linux·c语言·c++
勿忘初心911 天前
Android车机DIY开发之软件篇(九) NXP AutomotiveOS编译
android·arm开发·经验分享·嵌入式硬件·mcu
lingllllove1 天前
PHP中配置 variables_order详解
android·开发语言·php
消失的旧时光-19431 天前
Android-音频采集
android·音视频