0

I'm trying to add an application to a custom android build, but it is unable to understand resources like Theme.AppCompat.Light.DarkActionBar and colorPrimary and colorAccent, which leads me to believe it is having trouble reading and building R.java.

My Error

target R.java/Manifest.java: MyApplication21 (out/target/common/obj/APPS/MyApplication21_intermediates/src/R.stamp)
packages/apps/MyApplication21/res/values/styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

packages/apps/MyApplication21/res/values/styles.xml:8: error: Error: No resource found that matches the given name: attr 'colorAccent'.

packages/apps/MyApplication21/res/values/styles.xml:6: error: Error: No resource found that matches the given name: attr 'colorPrimary'.

packages/apps/MyApplication21/res/values/styles.xml:7: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.

build/core/package_internal.mk:236: recipe for target 'out/target/common/obj/APPS/MyApplication21_intermediates/src/R.stamp' failed
make: *** [out/target/common/obj/APPS/MyApplication21_intermediates/src/R.stamp] Error 1
make: Leaving directory '/home/mkemp/android'

#### make failed to build some targets  ####

What I did:

  1. Created an android app. This app compiles in android studio.
  2. Copied the manifest, java (renamed src), and res directories into my custom build: android/packages/apps/MyApplication21
  3. Created an Android.mk file

    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    
    LOCAL_MODULE_TAGS := optional
    
    # Java sources are in src
    LOCAL_SRC_FILES := $(call all-java-files-under, src)
    
    # Resources are in res
    LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
    
    # These jars are needed
    LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat \
    android-support-v4 
    
    # The name of this application
    LOCAL_PACKAGE_NAME := MyApplication21
    
    # No proguard
    LOCAL_PROGUARD_ENABLED := disabled
    

So far I have resolved errors that include not being able to understand Java classes like ActionBarActivity and TaskStackBuilder by including android-support-v7-appcompat and android-support-v4 in that order, into the Android.mk file, but I have no idea what Java library I should call in order to generate an R.java file.

Can anyone help?

Edit:

I notice that an R.stamp file is not being created in android/out/target/common/obj/APPS/MyApplication21/src, which should be built there judging by the other apps in the APPS folder ... and again leads me to believe the culprit is the R.java file not being generated correctly.

Michael Kemp
  • 300
  • 2
  • 17
  • are you compiling native and jni code? – nandsito Mar 29 '17 at 14:53
  • @nandsito no, just java. I am able to build my app by removing all references to the four variables in the error messages, but I don't want a blank app with no theme unless that is the only way I can get it to run. – Michael Kemp Mar 29 '17 at 19:03
  • i'm not sure if you need an Android.mk file since you're not compiling native code, but i'm not familiar with building a custom android – nandsito Mar 29 '17 at 19:07

0 Answers0