Android - Error importing AAR, error: attribute not found

Viewed 3369

I'm making an android library consisting of some activities and layouts . The library module actually work well on the sample project that i'm currently working on.

I later decicided to work same module on a different app. So I built an aar library out of the module by doing a ./gradlew assemble

I imported this aar into second project. This caused a series of errors.

            ../res/layout/activity_package_select.xml:18: error: attribute layout_scrollFlags (aka dkkdff.ckkkf.co.test:layout_scrollFlags) not found.
            ../res/layout/activity_package_select.xml:18: error: attribute titleEnabled (aka dkkdff.ckkkf.co.test:titleEnabled) not found.
            ../res/layout/activity_package_select.xml:35: error: attribute layout_scrollFlags (aka dkkdff.ckkkf.co.test:layout_scrollFlags) not found.
            ../res/layout/add_text_dialog.xml:16: error: attribute cardBackgroundColor (aka dkkdff.ckkkf.co.test:cardBackgroundColor) not found.
            ../res/layout/add_text_dialog.xml:16: error: attribute cardUseCompatPadding (aka dkkdff.ckkkf.co.test:cardUseCompatPadding) not found.
            ../res/layout/add_text_dialog.xml:22: error: attribute hintTextAppearance (aka dkkdff.ckkkf.co.test:hintTextAppearance) not found.
            ../res/layout/add_text_dialog.xml:44: error: attribute cardBackgroundColor (aka dkkdff.ckkkf.co.test:cardBackgroundColor) not found.
            ../res/layout/add_text_dialog.xml:44: error: attribute cardUseCompatPadding (aka dkkdff.ckkkf.co.test:cardUseCompatPadding) not found.
            ../res/layout/add_text_dialog.xml:71: error: attribute cardBackgroundColor (aka dkkdff.ckkkf.co.test:cardBackgroundColor) not found.
            ../res/layout/add_text_dialog.xml:71: error: attribute cardCornerRadius (aka dkkdff.ckkkf.co.test:cardCornerRadius) not found.
            ../res/layout/add_text_dialog.xml:71: error: attribute cardUseCompatPadding (aka dkkdff.ckkkf.co.test:cardUseCompatPadding) not found.
            ../res/layout/content_package_select.xml:2: error: resource string/appbar_scrolling_view_behavior (aka dkkdff.ckkkf.co.test:string/appbar_scrolling_view_behavior) not found.
            ../res/layout/edit_content.xml:2: error: resource string/appbar_scrolling_view_behavior (aka dkkdff.ckkkf.co.test:string/appbar_scrolling_view_behavior) not found.
            ../res/layout/editor_view.xml:15: error: attribute fabSize (aka dkkdff.ckkkf.co.test:fabSize) not found.
            ../res/layout/editor_view.xml:26: error: attribute fabSize (aka dkkdff.ckkkf.co.test:fabSize) not found.
            ../res/layout/package_card.xml:7: error: attribute cardCornerRadius (aka dkkdff.ckkkf.co.test:cardCornerRadius) not found.
            ../res/layout/package_card.xml:7: error: attribute cardUseCompatPadding (aka dkkdff.ckkkf.co.test:cardUseCompatPadding) not found.
            ../res/layout/package_card.xml:19: error: resource color/design_default_color_primary (aka dkkdff.ckkkf.co.test:color/design_default_color_primary) not found.
            ../res/layout/summary_content.xml:3: error: resource string/appbar_scrolling_view_behavior (aka dkkdff.ckkkf.co.test:string/appbar_scrolling_view_behavior) not found.

            Command: /home/user/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/50a9b3705193c8b7f8e033a5fbd09c49/aapt2-3.2.1-4818971-linux/aapt2 link -I\
                    /home/user/Android/Sdk/platforms/android-28/android.jar\
                    --manifest\
                    /home/user/mProject/myTestXXXX/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
                    -o\
                    /home/user/mProject/myTestXXXX/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
                    -R\
                    @/home/user/mProject/myTestXXXX/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
                    --auto-add-overlay\
                    --java\
                    /home/user/mProject/myTestXXXX/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
                    --custom-package\
                    dkkdff.ckkkf.co.test\
                    -0\
                    apk\
                    --output-text-symbols\
                    /home/user/mProject/myTestXXXX/app/build/intermediates/symbols/debug/R.txt\
                    --no-version-vectors
            Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #0

I replaced

    xmlns:app="http://schemas.android.com/apk/res-auto"

to

    xmlns:app="http://schemas.android.com/apk/lib/packageselect.app.co"

where packageselect.app.co is the package name of my library. It didn't work.

Then, I replaced it to

   xmlns:custom="http://schemas.android.com/apk/res-auto"

Still no success!

Actually I don't have any idea of whats happening and why these attributes aren't imported. What can I do to get this get fixed?!.

Edit: build.gradle file of the module

            apply plugin: 'com.android.library'
            apply plugin: 'kotlin-android'
            apply plugin: 'kotlin-android-extensions'

            android {
            compileSdkVersion 28

            defaultConfig {
                    minSdkVersion 16
                    targetSdkVersion 28
                    versionCode 1
                    versionName "1.0"
                    vectorDrawables.useSupportLibrary = true
                    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

            }

            buildTypes {
                    release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                    }
            }

            }



            dependencies {
            implementation fileTree(include: ['*.jar'], dir: 'libs')
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
            implementation 'com.android.support:appcompat-v7:28.0.0'
            implementation 'com.android.support.constraint:constraint-layout:1.1.3'
            implementation 'com.android.support:design:28.0.0'
            implementation 'com.android.support:exifinterface:28.0.0'


            ext.anko_version = '0.10.5'
            implementation "org.jetbrains.anko:anko-commons:$anko_version"
            implementation "org.jetbrains.anko:anko-design:$anko_version"
            implementation 'com.squareup.retrofit2:retrofit:2.4.0'
            implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
            implementation 'com.github.bumptech.glide:glide:4.7.1'
            implementation 'com.robertlevonyan.components:AndroidKEx:1.1.6'
            implementation 'com.squareup.okhttp3:okhttp:3.11.0'
            implementation('com.theartofdev.edmodo:android-image-cropper:2.7.0', {
                    exclude group: 'com.android.support', module: 'exifinterface'
            })
            implementation project(':gesture-detector')
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'com.android.support.test:runner:1.0.2'
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

            }
0 Answers
Related