integrate google apps to the build to be installed in /data/app - android

i try to make my own rom, and I want add google-apps to the build to be installed in /data/app
this is the steps :
1 - create new folder called "gapps" in vendor/ dir
2- in "gapps" add data/app/Youtube/app/youtube.apk,
3- create android.mk file in "gapps" folder with this content
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := YouTube
LOCAL_SRC_FILES := data/app/YouTube/YouTube.apk
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_OWNER := GOLDROM
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
4 - go to the build dir in the android root files build/target/product/core.mk and add YouTube to the PRODUCT_PACKAGES var
5- build, flash, but youtube not found.
plz correct me , if i made any mistak. :)

solution is to add your module to PRODUCT_PACKAGES var
rootAndroid/build/target/product/generic_no_telephony.mk
and then youtube will work fine in /data as a user app
but its still a not clean solution.

Related

AOSP include Maven JAR file in android.mk

I found similar posts but often the answer are not really correct and anyways seems to be not working for me.
I have an Android application created with Android Studio which includes java-websocket library. Now, I want to build this application inside AOSP thus I created a folder for the jar library with its own Android.mk and another folder which contains the application (with Android Studio structure) which contains its own Android.mk (modified in order to find AndroidManifest, res, java, AIDL files)
At first I had some troubles due to some incorrect parameter in the Android.mk for the jar file. Now the jar file seems to be correctly recognized and the intermediates are exported to out/ folder.
The problem now is during the build of the application since the classes exposed by the jar seems to be not available ending up in:
error: cannot find symbol WebSocket
and similar errors for any reference to the jar content.
The JAR folder contains: Android.mk Java-WebSocket-1.3.0.jar
And this is the Android.mk content
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := JavaWebSocket
LOCAL_MODULE_TAGS := optional
$(warning Going to build $(LOCAL_MODULE))
LOCAL_SRC_FILES := Java-WebSocket-1.3.0.jar
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
The application folder contains: Android.mk aidl_files app gradle build.gradle ..
(basically the Android Studio project plus the Android.mk and a folder containing AIDL (which I'll move outside later)
And this is the Android.mk file content:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := MyApplication
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := JavaWebSocket
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, app/src/main/java) \
aidl_files/my_aidl_file.aidl
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl_files
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/app/src/main/res
LOCAL_MANIFEST_FILE := app/src/main/AndroidManifest.xml
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_STATIC_ANDROID_LIBRARIES += \
androidx.appcompat_appcompat
include $(BUILD_PACKAGE)
I tried to merge all the informations I found in StackOverflow so far without success.
Is there any other LOCAL_something that I should set?

When i add app priv-app phone not booting

I have been trying to add a apk to priv-app.
Following are the steps i did:
Made a folder named Testapk in packages/apps
Copied apk to folder with name Testapk.apk
In same directory, created an Android.mk file with following contents:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Testapk
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := Testapk.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_PRIVILEGED_MODULE := true
TARGET_OUT_DATA_APPS_PRIVILEGED := $(TARGET_OUT_DATA)/priv-app
include $(BUILD_PREBUILT)
Then, added Testapk to /build/target/product/base_system.mk
Build is successful and i can see my apk in priv-app folder in out/target/product/sdm660_64/system/priv-app. After flashing, the device wont boot up. Its stuck on Android logo.
I am using Qualcom SDM660, the branch is android-10
If I add the apk to system/apps, i can boot and the apk works fine.
Can someone help me on this???
You haven't shared the Crash Stack here. Its difficult to tell.
I could see here that
Are you requesting any privileged permissions from the app side ? if yes, device will not boot until you whitelist those permissions in privileged permissions xml file which will be stored at either system/etc/permissions

AOSP add prebuilt APK - error unknown target

I'm making a personal build of LineageOS 17.0 that I want to include a number of pre-built APKs in. To achieve this, I have a separate folder "vendor/apps" which has two files apps-vendor.mk and Android.mk, and a sub-folder "app" which I store the APK files. This was with the help of this thread Add prebuilt apk to AOSP build.
Now, whilst I have been successful with including a number of APKs such as Blokada, FDroid, every now and then I come across an APK that I simply can't add into the build, such as TotalCommander.
If I go through the normal build process, it simply doesn't get added. If I use e.g. "mma TotalCommander" I receive an error saying "FAILED: ninja: unknown target 'TotalCommander'".
The following is what I have included in my apps-vendor.mk file:
Blokada \
FDroid \
F-DroidPrivilegedExtension \
VLC \
WaveUp \
YouTubeVancedMicroG \
YouTubeVanced \
TotalCommander
This is an excerpt from my Android.mk file:
# Custom added apps
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Blokada
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/Blokada.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := FDroid
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/FDroid.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := TotalCommander
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/TotalCommander.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
etc ...
I have tried a few different things, such as swapping the APK filename for one that is working, trying a different module name such as TC, etc, all of which give the same result.
I feel silly, but the issue was this. I originally had the folder directly under vendor, but then I moved the folder to a parent directory and symlinked it. Building does not work properly with symlinks like this. I still detects the vendor-apps.mk file, and when it is changed, but it doesn't actually add any rules.

Build Android from Source - Add Prebuilt App with Shared Library

i've build my own androidrom from source and modified a few things.
But now i wan't to add an prebuilt .apk to the project,
read that i should make an folder in /packages/apps/
and add the .apk and an Android.mk to it with following code
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := <folder name>
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
and the added the module to the in my case /device/sony/honami/full_honami.mk
when i now run brunch i get the error after some time that no rule for target *
so i tried some changes but nothing works for me and i can't find something where there write something other than this ...
so i added the .apk to the /vendor/cm/prebuilts folder and in the *.mk where i found the other .apks where copyed to the device i added my app and run brunch without an error.
But when i now start the app, which is on the device, it crash.
Via Logcat i found out that this apk have some .so files in it and that it can't find them.
This is because i only copied the app not the .so files in the lib directory. But i can't find some solution for my problem.
Should i now extract the .so file and copy it like the .apk to the path the app looks? or is there a better solution for doing this?
Cheers
Moritz
AOSP build system handles the shared libraries differently from Eclipse-ADT.
You will need to extract that .so from your apk and create an Android.mk to it.
To extract the .so, just unzip the apk and get it from libs folder.
Here is an example for the Android.mk to libfoo.so shared library:
LOCAL_PATH:= $(call my-dir)
# prebuilt shared library
include $(CLEAR_VARS)
LOCAL_MODULE := libfoo
LOCAL_SRC_FILES := libfoo.so
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib
LOCAL_MODULE_TAGS := optional
include $(BUILD_PREBUILT)

Include app in ROM as system app

I want to build a rom from source and include my app as system app. What I've tried:
1.Copy my project into $SOURCE_DIR/packages/apps/
2.add Android.mk in root folder of my project:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_STATIC_JAVA_LIBRARIES := android-common
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := packagename
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
3.Configure building for maguro and:
make -j1 otapackage
But I don't see my app in output image's /system/app directory.
What am I missing?
I do not see in your mk file the following line:
LOCAL_MODULE_TAGS := optional
And I guess you have just forgotten to include your package into build/target/product/core.mk file under the section PRODUCT_PACKAGES

Categories

Resources