Convert gradle file to MK file( build.gradle to Android.mk )
Asked Answered
P

0

6

I used the below gradle to build my sample application.

build.gradle

apply plugin: 'com.android.application'

android {
    defaultConfig {
        resConfigs "en","ja"
    }
    buildTypes {
        release {
           shrinkResources true
           useProguard true 
           minifyEnabled true
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    splits {
       density {

            enable true
            exclude 'ldpi', 'tvdpi', 'xxxhdpi'
        }
        abi {

            enable true
            reset()
            include 'x86', 'armeabi-v7a', 'mips'
            universalApk false

        }
    }
}

Objectives of this test

1.Remove the unused resource files from the application

2.To get better understanding on resource handling.

I successfully done this with android studio using gradle.

Now, I want to do the same with ASOP build.

Android.mk file
--------------------------------------------
ifneq ($(TARGET_BUILD_PDK), true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
frameworks/support/v7/appcompat/res \
frameworks/support/design/res

LOCAL_PACKAGE_NAME := sampleapp
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := optional
LOCAL_PRIVILEGED_MODULE := true
LOCAL_USE_AAPT2 := true
LOCAL_DEX_PREOPT := true

LOCAL_PROGUARD_ENABLED := full

LOCAL_AAPT_FLAGS := --auto-add-overlay
include $(BUILD_PACKAGE)
endif

But while doing ASOP build i don't know how to set the below flags in Android.mk file.

shrinkResources true

minifyEnabled true

exclude 'ldpi', 'tvdpi', 'xxxhdpi'

Kindly guide me to solve this issue.

Pappano answered 17/4, 2018 at 9:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.