android: couldn't find import for class error in aidl files com.android.internal.telephony.gsm.NetworkInfo

拥有回忆 提交于 2019-12-13 12:36:51

问题


I am trying to re-use PhoneUtils.java (~/android_src/packages/apps/ Phone/src/com/android/phone/) within my app with some customizations.

I have added INetworkQueryServiceCallback.aidl and INetworkQueryService.aidl into my app folder (~/android_src/packages/ apps/USSDActivity/src/com/myapp/ussdactivitytest) however when i am building alongside android source I am getting the following error:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Aidl: com.myapp.ussdactivity <= packages/apps/USSDActivity/src/com/myapp/ussdactivitytest/INetworkQueryService.aidl
Aidl: com.myapp.ussdactivity <= packages/apps/USSDActivity/src/com/myapp/ussdactivitytest/INetworkQueryServiceCallback.aidl
packages/apps/USSDActivity/src/com/myapp/ussdactivitytest/INetworkQueryServiceCallback.aidl:19: couldn't find import for class com.android.internal.telephony.gsm.NetworkInfo
make: *** [out/target/common/obj/JAVA_LIBRARIES/com.myapp.ussdactivity_intermediates/src/src/com/myapp/ussdactivitytest/INetworkQueryServiceCallback.java] Error 1

Android.mk:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += \
        src/com/myapp/ussdactivitytest/EventLogTags.logtags \
        src/com/myapp/ussdactivitytest/INetworkQueryService.aidl \
        src/com/myapp/ussdactivitytest/INetworkQueryServiceCallback.aidl

LOCAL_MODULE := com.myapp.ussdactivity
include $(BUILD_STATIC_JAVA_LIBRARY)
include $(CLEAR_VARS)
LOCAL_STATIC_JAVA_LIBRARIES := com.android.phone.common
LOCAL_JAVA_LIBRARIES := core framework
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += \
        src/com/myapp/ussdactivitytest/EventLogTags.logtags \
        src/com/myapp/ussdactivitytest/INetworkQueryService.aidl \
        src/com/myapp/ussdactivitytest/INetworkQueryServiceCallback.aidl
LOCAL_PACKAGE_NAME := USSDActivity
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))

回答1:


In this case, add the following lines framework.aidl. (Platforms \ android-9 \ framework.aidl)

parcelable com.android.internal.telephony.gsm.NetworkInfo;



来源:https://stackoverflow.com/questions/6058350/android-couldnt-find-import-for-class-error-in-aidl-files-com-android-internal

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