我正在尝试将epub阅读器库添加到已经创建的项目中。我想作为一种方式添加到项目中的库是Folio Reader库(https://github.com/FolioReader/FolioReader-Android)。我已将此库下载到我的计算机上,并尝试通过文件->新建->导入模块将其添加。但是,在此过程中,我收到了无数错误。我目前的情况是这样:
Gradle DSL method not found: 'versionName()'
Possible causes:
The project 'FolioReader-Android-master' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.4.1 and sync project
The project 'FolioReader-Android-master' may be using a version of Gradle
that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
此文件是为库声明依赖项的文件。
FolioReader-Android-master:
build.gradle file:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
apply from: 'versions.gradle'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//moj
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
allprojects {
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
}
repositories {
mavenLocal()
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
错误本身指出,出现问题是因为项目使用的Gradle插件版本可能不包含该方法。我已将版本更新为最新版本,但是仍然收到此错误。关于如何解决此问题有什么建议吗?
答案 0 :(得分:0)
通过替换
解决的问题versionName 1
与
versionName "1.1"
在模块级别的build.gradle文件中。
答案 1 :(得分:0)
在 build.gradle
中进行设置android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "your package name"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
// this is versionName
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}