Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AAPT: error: resource not found, but it is present in styles.xml

Full error is

AAPT: error: resource style/AppTheme (aka com.mukmenev.android.findjob:style/AppTheme) not found.

However <style name="AppTheme"> is present in app\src\res\values\styles.xml

The error points to the generated file

app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml

which has declarations that I don't have in the main manifest, like

<uses-sdk
    android:minSdkVersion="19"
    android:targetSdkVersion="23" />

<application
    android:name="com.mukmenev.android.findjob.App"
    android:allowBackup="true"
    android:debuggable="true"
    android:hardwareAccelerated="false"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >

So another question is how can it be possible and how to get rid of them?


I've just spent about a week trying to launch this project (given to me by previous developer who is refusing to explain anything) and eliminating errors like links to non-existent resources, but these ones are present and visible by eye.

So how can I make the resources visible for build and what makes the generated manifest look as it looks?
upd
After fixing some more errors it came up with several errors like:
:app:mergeDebugResources
[string/default_web_client_id] \app\src\main\res\values\strings.xml [string/default_web_client_id] \app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources

So again, resources get duplicated in a generated file.
upd 2
After commenting those out it gives:

Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  Output:  \app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2100: error: duplicate value for resource 'attr/navigationMode' with config ''.
  \app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2100: error: resource previously defined here.

and

 Command: C:\gradle-4.6\bin\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\4627eedc0a8af356ec87f9d6cd62c57c\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
          -o \
          C:\_com_bucket\komirger-static_branch\app\build\intermediates\res\merged\debug \
          C:\_com_bucket\komirger-static_branch\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
  Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
  Output:  C:\gradle-4.6\bin\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\5e49e71c0795be6393bc5ece684619fc\res\values\values.xml:71:5-86:1291: AAPT: error: duplicate value for resource 'attr/navigationMode' with config ''.

  C:\gradle-4.6\bin\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\5e49e71c0795be6393bc5ece684619fc\res\values\values.xml:71:5-86:1291: AAPT: error: resource previously defined here.

I tried invalidating caches in Android Studio but with no effect. Any ideas?

like image 977
www0z0k Avatar asked Sep 01 '25 02:09

www0z0k


1 Answers

you need to remove default_web_client_id from res/values/strings.xml

and let the Goggle Services Plugin add that string resource instead.

then it most likely can generate R and the style might be found then.

like image 132
Martin Zeitler Avatar answered Sep 03 '25 07:09

Martin Zeitler