首页 > 解决方案 > Android 库发布配置

问题描述

我正在尝试FolioReader-Android在 Android Flutter 插件中包含库。它适用于调试 APK,但是当我尝试构建发布 APK

Execution failed for task ':app:lintVitalRelease'.                      
> Could not resolve all artifacts for configuration ':epub_viewer:profileRuntimeClasspath'.
   > Could not resolve project :folioreader.                            
     Required by:                                                       
         project :epub_viewer                                           
      > Cannot choose between the following variants of project :folioreader:
          - debugAndroidTestCompile                                     
          - debugAndroidTestRuntime                                     
          - debugRuntime                                                
          - debugUnitTestCompile                                        
          - debugUnitTestRuntime                                        
          - releaseRuntime                                              
          - releaseUnitTestCompile                                      
          - releaseUnitTestRuntime                                      
        All of them match the consumer attributes:                      
          - Variant 'debugAndroidTestCompile' capability com.jideguru:folioreader:0.6.2:
              - Unmatched attributes:                                   
                  - Required com.android.build.api.attributes.BuildTypeAttr 'profile' but no value provided.
                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but no value provided.
                  - Required org.gradle.usage 'java-runtime' but no value provided.
                  - Found org.jetbrains.kotlin.localToProject 'local to :folioreader' but wasn't required.
                  - Found org.jetbrains.kotlin.platform.type 'androidJvm' but wasn't required
(Repeated for all variants)

现在,如果我尝试更改我的实现配置,即

从此implementation project(path: ':folioreader')_

implementation project(path: ':folioreader', configuration: 'default')

我开始在库本身中收到以下错误

 error: cannot access Locator
                       ReadLocator readLocator = ReadLocator.fromJson(location);
                                                            ^
  class file for org.readium.r2.shared.Locator not found

Github 回购:https ://github.com/JideGuru/Folioreader-Android

感谢您一直坚持到这里... :)

标签: androidgradlebuild.gradleflutter-plugin

解决方案


您需要按如下方式配置应用级别的 Gradle

android {    
.....

lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}

推荐阅读