How to resolve relative path issue in .bp file

Starting from Android-R It is mandatory for all tech teams to convert Android.mk to Android.bp. No Android.mk support for C/C++/Java compilation 

 

Timelines for Android “R” dictates that this be done by end of January 2020.
 
 
Issue1: When convert the android.mk to android.bp , LOCAL_RESOURCE_DIR += frameworks/support/v7/ recyclerview /res  is a relative path and can not be accessed in the .bp file.
 
 
 

LOCAL_PATH:= $(call my-dir)

# make wrapper static libinclude $(CLEAR_VARS)

 

 

LOCAL_MODULE_TAGS := optionalinclude $(BUILD_STATIC_JAVA_LIBRARY)include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optionalLOCAL_SRC_FILES := $(call all-subdir-java-files)

 

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res

LOCAL_RESOURCE_DIR += frameworks/support/v7/recyclerview/res

 

LOCAL_AAPT_FLAGS += --auto-add-overlay

LOCAL_AAPT_FLAGS += --extra-packages

LOCAL_AAPT_FLAGS += android.support.v7.recyclerview

LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4

LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-recyclerview

 

 

 

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

LOCAL_PRIVILEGED_MODULE := true

 

Solution: 

1. replace the android-support-v4 and android.support.v7 libraries and so that we do not need to access the frameworks/support/v7/recyclerview/res .

 

2. Change in the .bp and the source code that import the android-support-v4 and android.support.v7 libraries

 

android_app {

   name: "xxxxx"  

 

  srcs: ["**/*.java"],   

 

  resource_dirs: ["res"],

  aaptflags: ["--auto-add-overlay"] + ["--extra-packages"] + ["androidx.recyclerview_recyclerview"],   

 

 

  static_libs: [

        "androidx.recyclerview_recyclerview",

        "androidx.core_core", 

        

    ],   

 

 

product_specific: true,

 

 

 

Issue2: When convert the android.mk to android.bp, $(LOCAL_PATH)/../xxx/res  is a relative path and soong have a restriction on using “../” in the path. 

Solution:

Solution 1: copy the source files to the subdirectory of the required folders.

 

Solution 2: move the Android.bp one level up. 
Solution 3: make the refer resource as a static library
 
 
 
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值