解决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'
}
相关推荐
清空mega6 小时前
第11章 网络编程
android·网络
自动化BUG制造器6 小时前
Android UI 线程不一定是主线程
android
无知的前端6 小时前
一文读懂-Jetpack与AndroidX
android·kotlin·android jetpack
河铃旅鹿8 小时前
Android开发-java版:SQLite数据库
android·数据库·笔记·学习·sqlite
旋律逍遥8 小时前
《Framework 开发》3、开发工具及命令行知识装备
android
啦啦9117148 小时前
安卓手机/平板/TV版 Rotation强制横屏显示工具!免ROOT可用!再推荐突破手机限制的3款神器
android·智能手机·电脑
汤面不加鱼丸9 小时前
flutter实践:混合app在部分android旧机型上显示异常
android·flutter
_李小白10 小时前
【Android FrameWork】延伸阅读:ActivityManagerService启动Activity
android
用户416596736935510 小时前
Android 媒体库高效扫描器:基于协程与 `ContentObserver` 的 `FileScanner`
android
Arenaschi10 小时前
Android中的release下面的包有什么左右和debug 的包有什么区别
android