1.在frameworks\base下添加frameworktest目录,下面的目录结构如下,必须要有一个java的目录:
│ Android.mk
└─java
└─com
└─android
└─frameworkunit
FrameworkTest.java
Android.mk的内容如下:
-
LOCAL_PATH:= $(call my-dir)
-
-
# the library
-
# ============================================================
-
include $(CLEAR_VARS)
-
LOCAL_MODULE_TAGS = optional
-
LOCAL_SRC_FILES := \
-
$(call all-subdir-java-files)
-
-
LOCAL_MODULE:= frameworkunit
-
-
LOCAL_JAVA_LIBRARIES := android.policy
-
-
LOCAL_NO_EMMA_INSTRUMENT := true
-
LOCAL_NO_EMMA_COMPILE := true
-
-
include $(BUILD_JAVA_LIBRARY)
-
-
include $(BUILD_DROIDDOC)
FrameworkTest.java的内容如下:
-
package com.android.frameworkunit;
-
-
public class FrameworkTest
-
{
-
;
-
}
然后在base\frameworktest下执行mm,生成frameworkunit.jar
2.在packages\apps下新建一个工程,引用import com.android.frameworkunit.FrameworkTest。同时在Android.mk中注释"#LOCAL_SDK_VERSION := current”,然后执行mm。
阅读(1888) | 评论(0) | 转发(0) |