Android-导入AAR时出错,错误:找不到属性

时间:2018-11-01 09:27:06

标签: android kotlin android-library

我正在制作一个由一些活动和布局组成的android库。库模块实际上在我当前正在处理的示例项目上运行良好。

我后来决定在不同的应用程序上使用相同的模块。因此,我通过执行./gradlew assemble

在模块之外构建了一个aar库

我将此aar导入了第二个项目。这导致了一系列错误。

            ../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

我替换了

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

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

其中packageselect.app.co是我的库的软件包名称。没用

然后,我将其替换为

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

仍然没有成功!

实际上,我对发生的事情以及为什么不导入这些属性一无所知。我该怎么做才能解决此问题?!

编辑: 模块的build.gradle文件

            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 个答案:

没有答案