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哈。

發佈了24 篇原創文章 · 獲贊 4 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章