Trying to run ButterKnife in AOSP, returning NullPointerException
Asked Answered
E

0

6

Trying to test the application with butterknife 8.4.0 and some sample text and I keep getting a NullPointerException The actual code itself is fine but I believe Android.mk might be the issue. So here are the portions of that makefile that are under question:

LOCAL_STATIC_JAVA_LIBRARIES := \
 dialer-butterknife-target \
 dialer-butterknife-compiler-target \
 dialer-butterknife-annotations-target \ 

PROCESSOR_LIBRARIES_TARGET := \
 dialer-auto-value \
 dialer-butterknife \
 dialer-butterknife-compiler \
 dialer-butterknife-annotations \ 

PROCESSOR_JARS := $(call java-lib-deps, $(PROCESSOR_LIBRARIES_TARGET))
# Necessary for annotation processors to work correctly.
LOCAL_ADDITIONAL_DEPENDENCIES += $(PROCESSOR_JARS)

LOCAL_JACK_FLAGS += --processorpath $(call normalize-path-   list,$(PROCESSOR_JARS))
LOCAL_JAVACFLAGS += -processorpath $(call normalize-path-list,$(PROCESSOR_JARS))


LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
dialer-butterknife:../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife/8.4.0/butterknife-8.4.0.aar \
dialer-butterknife-compiler:../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-compiler/8.4.0/butterknife-compiler-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX) \
dialer-butterknife-annotations:../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-annotations/8.4.0/butterknife-annotations-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX) \ 

include $(CLEAR_VARS)

LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-butterknife-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife/8.4.0/butterknife-8.4.0.aar
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_PREBUILT)

include $(CLEAR_VARS)

LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-butterknife-annotations-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-annotations/8.4.0/butterknife-annotations-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_PREBUILT)

include $(CLEAR_VARS)

LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-butterknife-compiler-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-compiler/8.4.0/butterknife-compiler-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true

include $(BUILD_PREBUILT)

Here is the error in stack trace:

07-06 09:38:28.690 24980 24980 E AndroidRuntime:   java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.dialer/com.android.dialer.about.LicenseMenuActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
07-06 09:38:28.690 24980 24980 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
Excoriate answered 6/7, 2018 at 21:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.