I am trying to make my application compile within AOSP instead of using Gradle within Android Studio. I created an Android.mk
file, however, since my application uses Eclipse Paho library, I do not know how to add it to the AOSP.
Here is the build.gradle from Android Studio:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.mozcelikors.mediainthebox.mobile"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/" //MQTT
}
// ConstraintLayout
google()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
/*MQTT*/
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
// ConstraintLayout
compile "androidx.constraintlayout:constraintlayout:1.1.3"
}
Here is my Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/app/src/main/res
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := system_current # or current
LOCAL_MIN_SDK_VERSION := 14
LOCAL_DEX_PREOPT := false
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PACKAGE_NAME := MyLauncher
LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 Launcher3Go Launcher3QuickStep
LOCAL_SRC_FILES := $(call all-java-files-under, app/src)
LOCAL_PROGUARD_ENABLED := disabled
#LOCAL_PROGUARD_FLAG_FILES := ../../proguard-rules.pro
ifeq ($(TARGET_BUILD_APPS),)
support_library_root_dir := frameworks/support
else
support_library_root_dir := prebuilts/sdk/current/support
endif
LOCAL_RESOURCE_DIR += $(support_library_root_dir)/design/res \
$(support_library_root_dir)/v7/cardview/res \
$(support_library_root_dir)/v7/recyclerview/res \
$(support_library_root_dir)/v7/appcompat/res
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
--extra-packages android.support.design \
--extra-packages android.support.v7.cardview \
--extra-packages android.support.constraint \
--extra-packages android.support.v7.recyclerview \
--extra-packages android.support.v7.appcompat
LOCAL_STATIC_JAVA_LIBRARIES += cr android-common
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-test \
mockito-target-inline-minus-junit4 \
LOCAL_STATIC_ANDROID_LIBRARIES += androidx.legacy_legacy-support-v4
LOCAL_STATIC_ANDROID_LIBRARIES += androidx.gridlayout_gridlayout
LOCAL_STATIC_ANDROID_LIBRARIES += android-support-constraint-layout android-support-constraint-layout-solver
LOCAL_STATIC_ANDROID_LIBRARIES += \
android-support-v4 \
android-support-v7-appcompat \
android-support-v7-recyclerview \
android-support-dynamic-animation
LOCAL_MANIFEST_FILE := app/src/main/AndroidManifest.xml
include $(BUILD_PACKAGE)
Here is the error from AOSP:
com/mozcelikors/mediainthebox/mobile/MainActivity.java:28: error: package org.eclipse.paho.android.service does not exist
import org.eclipse.paho.android.service.MqttAndroidClient;
com/mozcelikors/mediainthebox/mobile/MyMqttService.java:19: error: package org.eclipse.paho.client.mqttv3 does not exist
import org.eclipse.paho.client.mqttv3.IMqttActionListener;
...
I wonder how can this missing dependency added as maven repository or as a prebuilt java library. Any help in this regard is greately appreciated.