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))
norah
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