解决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'
}
相关推荐
阿凤215 分钟前
uniapp运行到app端怎么打开文件
android·前端·javascript·uni-app
学习使我健康1 小时前
Android 事件分发机制
android·java·前端
贵沫末1 小时前
Claude Code For VS Code安装以及跳过认证
android
00后程序员张1 小时前
完整教程:如何将iOS应用程序提交到App Store审核和上架
android·macos·ios·小程序·uni-app·cocoa·iphone
aq55356001 小时前
ThinkPHP5.x核心特性全解析
android·数据库·oracle·php·laravel
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.1 小时前
MySQL高可用集群实战:MHA搭建全攻略
android·mysql·adb
00后程序员张1 小时前
iOS应用性能优化全解析:卡顿、耗电、启动与瘦身
android·ios·性能优化·小程序·uni-app·iphone·webview
程序员陆业聪2 小时前
跨端框架横评 2026:Flutter、React Native、KMP、小程序,谁是你下一个项目的正确答案?
android
aq55356002 小时前
Laravel3.x核心特性全解析
android
菜鸟国国2 小时前
Compose 点击/按压事件全解析:从基础到进阶,新手也能秒懂
android