解决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'
}
相关推荐
帅次1 小时前
Modifier 链与顺序、测量与命中区域
android·kotlin·compose·modifier
leory1 小时前
请详细描述Handler消息机制的工作原理
android·面试
leory2 小时前
请描述Binder IPC的基本原理和工作流程
android·面试
leory2 小时前
View的事件分发机制是怎样的?dispatchTouchEvent、onInterceptTouchEvent、onTouchEvent的关系?
android·面试
zander2582 小时前
Canal本地部署保姆级教程
android
小仙女喂得猪3 小时前
2026 Android 组件化项目的AICoding落地实践
android·kotlin·ai编程
leory3 小时前
请详细描述JVM的垃圾回收机制?
android·面试
leory3 小时前
volatile关键字的作用是什么?它能保证原子性吗?
android·面试
消失的旧时光-19433 小时前
为什么 Linux / Android 系统里全是 struct + 函数指针?—— 一篇讲透 C 语言如何实现面向对象(OOP)
android·linux·c语言
沐言人生3 小时前
ReactNative 源码分析5——ReactActivity之启动RN应用
android·react native