Drive Frameworks: base to native to base

Many people, even me, faced the following error during compilation of ROM sources:

make: *** No rule to make target `frameworks/native/data/etc/android.hardware.camera.xml', needed by `out/target/product/*/system/etc/permissions/android.hardware.camera.xml'. Stop.

build/core/product_config.mk:189: *** _nic.PRODUCTS.[[device/samsung/*/cm.mk]]: "frameworks/native/build/phone-hdpi-512-dalvik-heap.mk" does not exist. Stop.

These are just two. But many errors are similar to this as the packages are different but pointer location reference is the same. Here's the following that you can do to stop the error.

change all references from frameworks/base to frameworks/native

cat `grep -r "frameworks/base" ./*` | sed 's/frameworks\/base/frameworks\/native/'

The above command really works but takes a longer time and it is not 100% guaranteed that it will link the files properly!

(or)

grep -r "frameworks" *

I never tested this!

If trying to convert native to base, go the device tree to cm.mk or where the error is pointed.

If that file doesn't have any location, search in the include files.

Example:

# Inherit some common CM stuff.
$(call inherit-product, vendor/cm/config/common_full_phone.mk)

# Inherit device configuration
$(call inherit-product, device/samsung/device/device.mk)

# Device identifier. This must come after all inclusions
PRODUCT_DEVICE := kdevice
PRODUCT_NAME := cm_device
PRODUCT_BRAND := samsung
PRODUCT_MODEL := device
PRODUCT_MANUFACTURER := samsung
PRODUCT_RELEASE_NAME := device

# Bootanimation
TARGET_SCREEN_HEIGHT := 800
TARGET_SCREEN_WIDTH := 480

The above cm.mk doesn't have any value but it includes two files.

Search in the included file which here is:
$(call inherit-product, vendor/cm/config/common_full_phone.mk)
$(call inherit-product, device/samsung/device/device.mk)

In one of the file, there must be pointer location. So search for it.

# Hardware features available on this device
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
frameworks/native/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/native/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.x ml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.x ml \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml \
frameworks/native/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
frameworks/native/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml

Change the above code which contains frameworks/native to frameworks/base by find and replace option in text editor.

This method is very easy and takes up no time to work.

Save the file and you are done.

I personally solved the error by this method!

Hope it helps you too!