Reputation: 1344
I am working on a project where an external aar file integrated with my application. when I integrate this aar file then without navigation its working fine but when I add the file with navigation then it giving me following error
I also clean project, invalidate cache restart but it's not working, what is going wrong
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\layout\activity_abdashborad.xml:10: AAPT: error: attribute defaultNavHost (aka com.mag:defaultNavHost) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\layout\activity_abdashborad.xml:10: AAPT: error: attribute navGraph (aka com.mag:navGraph) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\layout\activity_ablogin.xml:9: AAPT: error: attribute defaultNavHost (aka com.mag:defaultNavHost) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\layout\activity_ablogin.xml:9: AAPT: error: attribute navGraph (aka com.mag:navGraph) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\abdashboard_navigation.xml:2: AAPT: error: attribute startDestination (aka com.mag:startDestination) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\abdashboard_navigation.xml:8: AAPT: error: attribute destination (aka com.mag:destination) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\abdashboard_navigation.xml:12: AAPT: error: attribute destination (aka com.mag:destination) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\ablogin_navigation.xml:2: AAPT: error: attribute startDestination (aka com.mag:startDestination) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\ablogin_navigation.xml:8: AAPT: error: attribute destination (aka com.mag:destination) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\ablogin_navigation.xml:14: AAPT: error: attribute destination (aka com.mag:destination) not found.
C:\Users\ip500\.gradle\caches\transforms-1\files-1.1\abd-release.aar\2dc4e4c1d8eaf250fd060d9c37fbba72\res\navigation\ablogin_navigation.xml:15: AAPT: error: attribute destination (aka com.mag:destination) not found.
Upvotes: 3
Views: 3282
Reputation: 200030
An AAR by itself does not embed or otherwise encode anything about the transitive dependencies (such as your AAR's dependency on Navigation), so it is expected that if you're just using an AAR as a local binary dependency that you'd need to redeclare all of the transitive dependencies.
As per the Gradle Declaring Dependencies documentation, a proper dependency is in the form of a maven repository (either local or remote). A maven repository, besides hosting the AAR itself, also includes a POM file that declares the transitive dependencies your library depends on. This ensures that there's only one version of each library included in your build (as it can deduplicate transitive dependencies across multiple libraries).
Upvotes: 6