android-studio can't find an aidl interface for use in class

耗尽温柔 提交于 2019-12-04 05:56:20

You are probably best off having a look at The Gradle Plugin User Guide for Android.

Gradle, by default, requires a particular directory structure. If you want to use Gradle with a directory structure that most Android devs are accustomed to, you'll need to put the following (from the above-mentioned link) inside the "android" block.

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
}

After you've done this, do a clean and rebuild to be on the safe side.

Personally, I just adapt my projects to fit the new convention.

In my case Clean and Rebuild project solved my problem.

Nicks

Created a directory aidl under src/main.

Then created the new aidl file package structure and moved aidl file into it.

Rebuilt and it was done.

I followed this post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!