androidandroid-studioandroid-gradle-pluginaidl

Android studio can`t find aidl import


I'm importing the app CSipsimple as a library within the app called Conversations. I have followed the accepted answer from here but when i try sync gradle files i get the errors:

C:....gabotel\libs\CSipSimple\app\src\main\aidl\com\csipsimple\api\ISipConfiguration.aidl

Error:(25) couldn't find import for class com.csipsimple.api.SipProfile

And

C:...gabotel\libs\CSipSimple\app\src\main\aidl\com\csipsimple\api\ISipService.aidl

Error:(25) couldn't find import for class com.csipsimple.api.SipProfileState
Error:(26) couldn't find import for class com.csipsimple.api.SipCallSession
Error:(27) couldn't find import for class com.csipsimple.api.MediaState

All of those classes have separate .aidl files and are declared as parcelable. For instance sipprofile:

package com.csipsimple.api;
parcelable SipProfile;

But the problem remains.

I have read here in the accepted answer that the solution involves modify the base_rules.mk file, but i can`t find it.

Any ideas?

The library gradle, just in case, is:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

apply plugin: 'com.android.library'

dependencies {
    compile 'com.android.support:support-v4:21.0.3'
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 21
    }

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

Solution

  • In my case, recreating the parcelable AIDL files solved the problem. Delete and recreate e.g. SipProfile.aidl (the content seems to be already correct) containing:

    package com.csipsimple.api;
    parcelable SipProfile;
    

    I used right click on the aidl folder -> New -> AIDL -> New Aidl File. The root cause could be an internal gradle problem...

    Perhaps combining this with a Android Studio restart or Build -> Clean project might also help.