Android makefile:构建系统的结果不一致

时间:2015-04-01 22:14:14

标签: android makefile android-source android-build

我一直在学习如何编写Android makefile(Android。 mk ),将各种应用程序合并到我的Android OS常规版本(5.0.2版)中。

成功转换了一个简单的应用程序后,我开始采用更具挑战性的内容,例如GitHub应用程序,该应用程序在开发过程中一直没有得到很多关注。

以下makefile 成功生成GitHub.apk(请忽略路径shenanigans ):

local_path := $(call my-dir)
github_path := external/github
viewpagerindicator_path := external/JakeWharton/ViewPagerIndicator

include $(call all-makefiles-under,$(local_path))

# build the GitHub application
LOCAL_PATH := $(github_path)/app
include $(CLEAR_VARS)

LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 android-support-v7-appcompat gson
LOCAL_STATIC_JAVA_LIBRARIES += com.github.kevinsawicki.wishlist
LOCAL_STATIC_JAVA_LIBRARIES += com.viewpagerindicator
LOCAL_STATIC_JAVA_LIBRARIES += okhttp
# prebuilt jars
LOCAL_STATIC_JAVA_LIBRARIES += com.github.kevinsawicki.http-request
LOCAL_STATIC_JAVA_LIBRARIES += guice guice-assistedinject roboguice
LOCAL_STATIC_JAVA_LIBRARIES += com.afollestad.materialdialogs
LOCAL_STATIC_JAVA_LIBRARIES += org.eclipse.egit.github.core
LOCAL_STATIC_JAVA_LIBRARIES += retrofit okio
LOCAL_STATIC_JAVA_LIBRARIES += javax.inject

LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java)

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
    $(viewpagerindicator_path)/library/res \
    prebuilts/sdk/current/support/v7/appcompat/res

LOCAL_AAPT_FLAGS += --auto-add-overlay

LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := GitHub

LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_PACKAGE)

不幸的是,尝试在真实设备上运行已安装的应用程序会产生以下致命异常:

java.lang.RuntimeException: Unable to get provider com.github.mobile.ui.search.RepositorySearchSuggestionsProvider: 
java.lang.ClassNotFoundException: Didn't find class "com.github.mobile.ui.search.RepositorySearchSuggestionsProvider" on path:
DexPathList[[zip file "/data/app/com.github.mobile-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

碰巧,此应用的旧版本可在F-Droid上找到。

在其dexlist列表 9371 上使用classes.dex,我已建立的包 1644 ,但中间残差我的构建中的classes.dex显示: 19333

我不明白为什么大多数类都没了,剩下的方法与okhttp和okio有关,好像其他一切都被包含在apk档案中一样。

这是 Androguard 显示差异的方式:

(mine):
Reflection code: False
Lcom/android/okhttp/internal/Platform; tagSocket ['DALVIK_SYSTEM']
Lcom/android/okhttp/internal/Platform; untagSocket ['DALVIK_SYSTEM']

(com.github.mobile_1900.apk from F-Droid):
Reflection code: True
Landroid/support/v4/app/ActivityCompatHoneycomb; invalidateOptionsMenu ['ANDROID', 'APP']
Landroid/support/v4/app/BackStackRecord; <init> ['ANDROID', 'SUPPORT']
Landroid/support/v4/app/BackStackRecord; doAddOp ['ANDROID', 'SUPPORT']
Landroid/support/v4/app/BackStackRecord; add ['ANDROID', 'SUPPORT']
Landroid/support/v4/app/BackStackRecord; add ['ANDROID', 'SUPPORT']
Landroid/support/v4/app/BackStackRecord; add ['ANDROID', 'SUPPORT']
Landroid/support/v4/app/BackStackRecord; attach ['ANDROID', 'SUPPORT']
Landroid/support/v4/app/BackStackRecord; bumpBackStackNesting ['ANDROID', 'UTIL']
(... skipped large amount of lines ...)

非常感谢任何输入!

0 个答案:

没有答案