I create a HelloWorld application following Android's official link. It runs fine in the Android Studio Emulator. I take the same application folder and add it in the packages/app/
folder of Android source code. Then I add the name of the app in build/target/product/core.mk
file. Then I add an Android.mk in the app folder which looks like the following:
ROOT_LOCAL_PATH := $(call my-dir)
$(info Start building SohamFirstApp from path $(ROOT_LOCAL_PATH) ...)
include $(call all-subdir-makefiles)
include $(ROOT_LOCAL_PATH)/app/src/main/Android.mk
The app/src/main/Android.mk looks like:
MAIN_LOCAL_PATH := $(call my-dir)
# Call to build JNI libs
include $(call all-subdir-makefiles)
LOCAL_PATH := $(MAIN_LOCAL_PATH)
$(info Entering $(LOCAL_PATH) ...)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := SohamFirstApp
LOCAL_MODULE_TAGS := optional
LOCAL_PRIVILEGED_MODULE := true
LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_REQUIRED_MODULES := libnative-lib
LOCAL_STATIC_ANDROID_LIBRARIES := \
android-support-v4 \
android-support-v7-recyclerview \
android-support-v7-preference \
android-support-v7-appcompat \
android-support-v14-preference \
android-support-v17-preference-leanback \
android-support-v17-leanback \
android-support-v4 \
LOCAL_SRC_FILES := \
$(call all-java-files-under, java)
LOCAL_RESOURCE_DIR := \
$(LOCAL_PATH)/res
LOCAL_USE_AAPT2 := true
LOCAL_AAPT_FLAGS := \
--auto-add-overlay
include $(BUILD_PACKAGE)
But when I compile Android, I get the following error:
packages/apps/SohamFirstApp/app/src/main/res/layout/activity_main.xml:9: error: attribute 'com.example.sohamfirstapp:layout_constraintBottom_toBottomOf' not found.
packages/apps/SohamFirstApp/app/src/main/res/layout/activity_main.xml:9: error: attribute 'com.example.sohamfirstapp:layout_constraintLeft_toLeftOf' not found.
packages/apps/SohamFirstApp/app/src/main/res/layout/activity_main.xml:9: error: attribute 'com.example.sohamfirstapp:layout_constraintRight_toRightOf' not found.
packages/apps/SohamFirstApp/app/src/main/res/layout/activity_main.xml:9: error: attribute 'com.example.sohamfirstapp:layout_constraintTop_toTopOf' not found.
I have checked my Android Studio Emulator Android version and the Android source code Android version to be both Android 8.1 What is the reason of this error? and how can I remove it?