aidl文件中出现couldn't find import for class

 之前看了别人的文章,里面也有关于这方面的东西,但是很可惜,自己一直用不上。

 刚刚才发现一个有用的方法 ,呵呵


具体的例子,就是android的phone例子,

import com.android.phone.NetworkInfo;


/**
 * Service interface to handle callbacks into the activity from the
 * NetworkQueryService.  These objects are used to notify that a
 * query is complete and that the results are ready to process.
 */
oneway interface INetworkQueryServiceCallback {


    /**
     * Called upon query completion, handing a status value and an
     * array of NetworkInfo objects.
     *  
     * @param networkInfoArray is the list of NetworkInfo. Can be 
     * null, indicating no results were found, or an error.  
     * @param status the status indicating if there were any 
     * problems with the request.   
     */
    void onQueryComplete(in List<NetworkInfo> networkInfoArray, int status);
    
}

相信这些代码,大家肯定是很熟悉的,

只是为什么会不一样呢,那是因为,我修改了我的缘故

本来的NetworkInfo,并不是在这个位置,我把源码里面的NetworkInfo,放到这里来的目的,就是让这个aidl不出错,

但单单是这样做,还是不够的,

需要另外建一个NetworkInfo.aidl的文件,内容如下:

package com.android.phone;
parcelable NetworkInfo;

这样,就可以编译通过phone了,

祝大家都能够顺利编过phone哈。

你可能感兴趣的:(aidl文件中出现couldn't find import for class)