解决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'
}
相关推荐
alexhilton11 分钟前
面向开发者的系统设计:像建筑师一样思考
android·kotlin·android jetpack
用户237390331478 小时前
Android Studio一个模板左侧文件的作用
android studio
CYRUS_STUDIO9 小时前
用 Frida 控制 Android 线程:kill 命令、挂起与恢复全解析
android·linux·逆向
CYRUS_STUDIO9 小时前
Frida 实战:Android JNI 数组 (jobjectArray) 操作全流程解析
android·逆向
用户0912 小时前
Gradle Cache Entries 深度探索
android·java·kotlin
循环不息优化不止13 小时前
安卓 View 绘制机制深度解析
android
叽哥13 小时前
Kotlin学习第 9 课:Kotlin 实战应用:从案例到项目
android·java·kotlin
雨白1 天前
Java 线程通信基础:interrupt、wait 和 notifyAll 详解
android·java
诺诺Okami1 天前
Android Framework-Launcher-UI和组件
android
潘潘潘1 天前
Android线程间通信机制Handler介绍
android