Android P build APK base AOSP runtime can't find class

537 views
Skip to first unread message

Frank Li

unread,
Oct 12, 2018, 10:13:45 AM10/12/18
to Android Building
Hi:
I build apk in Android P aosp , the apk work normal in Android O,  the apk source code put in android-aosp/vendor/my/myapp/
Android.mk:
LOCAL_PATH:= $(call my-dir)

# Build the samples.
# We need to add some special AAPT flags to generate R classes
# for resources that are included from the libraries.
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := myvideo
#LOCAL_SDK_VERSION := current
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform
#LOCAL_PRIVILEGED_MODULE := true
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_MANIFEST_FILE := app/src/main/AndroidManifest.xml
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/app/src/main/res
LOCAL_PRODUCT_MODULE := true
LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, app/src/main/java)
LOCAL_STATIC_JAVA_LIBRARIES := \
        android-support-v4 \
        android-support-v7-recyclerview \
        android-support-v7-cardview \
        android-support-v7-appcompat \
        androidx.appcompat_appcompat \
        androidx.legacy_legacy-support-v4 \
        androidx.cardview_cardview \
        androidx.recyclerview_recyclerview \

LOCAL_JAVA_LIBRARIES := \
        com.my.framework


LOCAL_RESOURCE_DIR = \
        $(LOCAL_PATH)/app/src/main/res \
        frameworks/support/cardview/res \
        frameworks/support/v7/appcompat/res \
        frameworks/support/v7/recyclerview/res \

LOCAL_AAPT_FLAGS := \
        --auto-add-overlay \
        --extra-packages android.support.v7.recyclerview \
        --extra-packages android.support.v7.cardview \
        --extra-packages android.support.v7.appcompat \
        --extra-packages androidx.recyclerview.widget \
        --extra-packages androidx.cardview \
        --extra-packages androidx.appcompat.app \


include $(BUILD_PACKAGE)

after build the apk will be install product partition /product/app/myapk, during runtime will crash because of:
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6669)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
10-12 07:59:44.210  5822  5822 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class androidx.appcompat.app.AlertController$RecycleListView
10-12 07:59:44.210  5822  5822 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class androidx.appcompat.app.AlertController$RecycleListView
10-12 07:59:44.210  5822  5822 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at java.lang.reflect.Constructor.newInstance0(Native Method)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.view.LayoutInflater.createView(LayoutInflater.java:647)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.support.v7.app.AlertController$AlertParams.createListView(AlertController.java:989)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.support.v7.app.AlertController$AlertParams.apply(AlertController.java:965)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at android.support.v7.app.AlertDialog$Builder.create(AlertDialog.java:982)
10-12 07:59:44.210  5822  5822 E AndroidRuntime:        at com.my.myvideo.menu.PlayOptionFragment.onCreateDialog(PlayOptionFragment.java:85)

I disassm the akp, can find androidx.appcompat.app.AlertController$RecycleListView, 
smali\androidx\appcompat\app\AlertController$RecycleListView.smali
The APK have Recyclelist view, Why can't find at runtion, Who can help check the issue, Thanks a lot

Frank Li

unread,
Oct 15, 2018, 12:21:55 PM10/15/18
to Android Building


On Friday, October 12, 2018 at 10:13:45 PM UTC+8, Frank Li wrote:
Hi:
I build apk in Android P aosp , but the apk work normal in Android O,  the apk source code put in android-aosp/vendor/my/myapp/
I disassm the apk, can find androidx.appcompat.app.AlertController$RecycleListView, 
smali\androidx\appcompat\app\AlertController$RecycleListView.smali
The APK have Recyclelistview Class, Why can't find at runtime, Who can help check the issue, Thanks a lot
Reply all
Reply to author
Forward
0 new messages