无法在android系统应用程序

时间:2017-11-27 13:14:59

标签: android makefile sdk android-source android.mk

尝试从AOSP中的系统Android应用程序中删除通知栏。 但是无法在我的代码中导入(导入com.android.internal.statusbar和导入android.app.StatusBarManager)。

import com.android.internal.statusbar.IStatusBarService;
import android.app.StatusBarManager;
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
        StatusBarManager mStatusBarManager = (StatusBarManager) 
getSystemService(Context.STATUS_BAR_SERVICE);
        mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
}
  

Android.mk

LOCAL_PATH := $(call my-dir)


include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_JAVA_LIBRARIES := \
    android-support-v7-recyclerview \
    android-support-v13 \
    android-support-v17-leanback \
    android-support-v7-appcompat

LOCAL_SRC_FILES := $(call all-java-files-under, src) \
    $(call all-java-files-under, WallpaperPicker/src) \
    $(call all-proto-files-under, protos)

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/WallpaperPicker/res \
    $(LOCAL_PATH)/res \

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
LOCAL_AAPT_FLAGS := \
      --auto-add-overlay \
--extra-packages android.support.v7.recyclerview

 LOCAL_SDK_VERSION := current
 LOCAL_PACKAGE_NAME := PlayerLauncher
 LOCAL_PRIVILEGED_MODULE := true

 LOCAL_OVERRIDES_PACKAGES := Home Launcher2
 include $(BUILD_PACKAGE)
 include $(CLEAR_VARS)
 LOCAL_SRC_FILES := $(call all-java-files-under, util) \
 $(call all-proto-files-under, protos)

 LOCAL_PROTOC_OPTIMIZE_TYPE := nano
 LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/

 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := launcher_protoutil_lib
 LOCAL_IS_HOST_MODULE := true
 LOCAL_JAR_MANIFEST := util/etc/manifest.txt

 include $(BUILD_HOST_JAVA_LIBRARY)

  include $(CLEAR_VARS)
  LOCAL_IS_HOST_MODULE := true
  LOCAL_MODULE_CLASS := EXECUTABLES
  LOCAL_MODULE_TAGS := optional
  LOCAL_MODULE := launcher_protoutil

  include $(BUILD_SYSTEM)/base_rules.mk

  $(LOCAL_BUILT_MODULE): | 
  $(HOST_OUT_JAVA_LIBRARIES)/launcher_protoutil_lib.jar
  $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/util/etc/launcher_protoutil | 
  $(ACP)
@echo "Copy: $(PRIVATE_MODULE) ($@)"
  $(copy-file-to-new-target)
  $(hide) chmod 755 $@
 INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
 include $(call all-makefiles-under,$(LOCAL_PATH))
  

你能帮我看看添加了什么类型的库   Android.mk文件。   编译系统android应用程序AOSP SDK时出错。

build / core / Makefile:34:警告:忽略目标out/target/product/g9x/system/usr/keylayout/Generic.kl' PRODUCT_COPY_FILES device/amlogic/g9x/hhs/gms/permissions/android.software.app_widgets.xml:system/etc/permissions/android.software.app_widgets.xml ignored. PRODUCT_COPY_FILES device/amlogic/g9x/hhs/gms/permissions/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml ignored. No private recovery resources for TARGET_DEVICE g9x Building with Jack: out/target/common/obj/APPS/EvoPlayerLauncher_intermediates/with-local/classes.dex Launching background server java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar out/host/linux-x86/framework/jack-launcher.jar -cp out/host/linux-x86/framework/jack.jar com.android.jack.server.JackSimpleServer VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:5: The import com.android.internal.statusbar cannot be resolved VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:6: The import android.app.StatusBarManager cannot be resolved VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: StatusBarManager cannot be resolved to a type VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: StatusBarManager cannot be resolved to a type VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: STATUS_BAR_SERVICE cannot be resolved or is not a field VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:46: StatusBarManager cannot be resolved to a variable make: *** [out/target/common/obj/APPS/PlayerLauncher_intermediates/with-local/classes.dex] Error 41 make: Leaving directory / media / VANILLA'

的旧命令

1 个答案:

答案 0 :(得分:0)

您的应用具有特权(具有系统权限),但尚未访问系统API(例如android.app.StatusBarManager)。为了获得访问权限,您需要使用平台证书对应用进行签名。

将此添加到您的Android.mk

LOCAL_CERTIFICATE := platform