解决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 小时前
android 蓝牙连接-兼容旧版本
android
鹏多多.1 小时前
Flutter使用screenshot进行截屏和截长图以及分享保存的全流程指南
android·前端·flutter·ios·前端框架
Flywith244 小时前
【每日一技】Warp Workflow 使用示例
android·前端
冬奇Lab5 小时前
JobScheduler与WorkManager:任务调度机制
android·源码阅读
summerkissyou19876 小时前
Android-view-绘制流程及自定义例子
android·app
常利兵6 小时前
Android “解锁”屏幕方向:APP适配新征程
android·gitee
红藕香残玉簟秋8 小时前
【安卓学习】配置开发环境
android·学习
用户69371750013849 小时前
Android R8 深度解析:为什么 Google 用R8取代 ProGuard?
android·android studio·android jetpack
seabirdssss9 小时前
联想拯救者Y7000P上使用ADB无法监听到通过USB连接的安卓设备
android·adb