添加依赖项时出错 - Android Studio
Error in adding dependency - Android Studio
我在我的 android 项目中使用 https://github.com/wasabeef/richeditor-android 库。我尝试通过页面上提到的“编译'jp.wasabeef:richeditor-android:0.3.0'”将它添加到我的项目中,它在我的项目中完美运行。
我希望对该库进行一些自定义更改。所以我尝试在那里克隆示例项目并且它工作正常。
但是当我尝试从我的代码中的示例代码添加 "richeditor" 项目文件夹并添加“compile project('libs:richeditor')”时我的应用 build.gradle 并在 settings.gradle 中添加 "include ':app:libs:richeditor'",它抛出一个错误 "Error:Plugin with id 'com.jfrog.bintray' not found.".
P.S。我已将 richeditor 项目放在 app/libs/ 文件夹中。
如何解决这个错误,或者有没有其他方法可以对上述库进行一些自定义更改?
build.gradle(应用程序)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 17
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
mavenCentral()
maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
jcenter()
}
dependencies {
compile files('libs/isoparser-1.0.2.jar')
compile project('libs:richeditor')
compile('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT@aar') {
transitive = true
}
compile 'com.android.support:support-v4:23.0.1'
compile 'com.github.satyan:sugar:1.3'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
}
build.gradle (richeditor)
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 17
targetSdkVersion 22
}
}
android.libraryVariants.all { variant ->
if (variant.buildType.isDebuggable()) {
return; // Skip debug builds.
}
task("javadoc${variant.name.capitalize()}", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = System.getenv("ANDROID_HOME") + "/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
}
task("bundleJavadoc${variant.name.capitalize()}", type: Jar) {
description "Bundles Javadoc into zip for $variant.name."
classifier = "javadoc"
from tasks["javadoc${variant.name.capitalize()}"]
}
}
apply from: 'android-artifacts.gradle'
apply from: 'central-publish.gradle'
apply from: 'bintray-publish.gradle'
从"compile 'jp.wasabeef:richeditor-android:0.3.0'"更改为在build.gradle
中编译'jp.wasabeef:richeditor-android:1.0.0'
看到这个link:https://github.com/wasabeef/richeditor-android#gradle
@Jay 类路径有问题
文件应用插件'com.jfrog.bintray'
其类路径在文件 build.gradle 中定义
(其范围在 project/module 'richeditor' 之外)
解决方案-
导入模块,然后
- 添加
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
进入dependencies下项目的build.gradle文件
- 将以下行添加到项目的 gradle.properties 文件中
VERSION_NAME=1.0.0 VERSION_CODE=16 GROUP=jp.wasabeef
ARTIFACT_ID=richeditor-android COMPILE_SDK_VERSION=23
BUILD_TOOLS_VERSION=23.0.2 TARGET_SDK_VERSION=23 MIN_SDK_VERSION=14
POM_DESCRIPTION=RichEditor for Android is a beautiful Rich Text
WYSIWYG Editor POM_URL=https://github.com/wasabeef/richeditor-android
POM_SCM_URL=git@github.com:wasabeef/richeditor-android.git
POM_SCM_CONNECTION=git@github.com:wasabeef/richeditor-android.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:wasabeef/richeditor-android.git POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo POM_DEVELOPER_ID=wasabeef
POM_DEVELOPER_NAME=Wasabeef
POM_DEVELOPER_EMAIL=dadadada.chop@gmail.com
POM_DEVELOPER_URL=wasabeef.jp
ISSUE_URL=https://github.com/wasabeef/richeditor-android/issues
SUPPORT_PACKAGE_VERSION=23.0.1
现在,同步项目并享受导入
我在我的 android 项目中使用 https://github.com/wasabeef/richeditor-android 库。我尝试通过页面上提到的“编译'jp.wasabeef:richeditor-android:0.3.0'”将它添加到我的项目中,它在我的项目中完美运行。
我希望对该库进行一些自定义更改。所以我尝试在那里克隆示例项目并且它工作正常。
但是当我尝试从我的代码中的示例代码添加 "richeditor" 项目文件夹并添加“compile project('libs:richeditor')”时我的应用 build.gradle 并在 settings.gradle 中添加 "include ':app:libs:richeditor'",它抛出一个错误 "Error:Plugin with id 'com.jfrog.bintray' not found.".
P.S。我已将 richeditor 项目放在 app/libs/ 文件夹中。
如何解决这个错误,或者有没有其他方法可以对上述库进行一些自定义更改?
build.gradle(应用程序)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 17
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
mavenCentral()
maven { url 'http://clinker.47deg.com/nexus/content/groups/public' }
jcenter()
}
dependencies {
compile files('libs/isoparser-1.0.2.jar')
compile project('libs:richeditor')
compile('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT@aar') {
transitive = true
}
compile 'com.android.support:support-v4:23.0.1'
compile 'com.github.satyan:sugar:1.3'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
}
build.gradle (richeditor)
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 17
targetSdkVersion 22
}
}
android.libraryVariants.all { variant ->
if (variant.buildType.isDebuggable()) {
return; // Skip debug builds.
}
task("javadoc${variant.name.capitalize()}", type: Javadoc) {
description "Generates Javadoc for $variant.name."
source = variant.javaCompile.source
ext.androidJar = System.getenv("ANDROID_HOME") + "/platforms/${android.compileSdkVersion}/android.jar"
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
}
task("bundleJavadoc${variant.name.capitalize()}", type: Jar) {
description "Bundles Javadoc into zip for $variant.name."
classifier = "javadoc"
from tasks["javadoc${variant.name.capitalize()}"]
}
}
apply from: 'android-artifacts.gradle'
apply from: 'central-publish.gradle'
apply from: 'bintray-publish.gradle'
从"compile 'jp.wasabeef:richeditor-android:0.3.0'"更改为在build.gradle
中编译'jp.wasabeef:richeditor-android:1.0.0'看到这个link:https://github.com/wasabeef/richeditor-android#gradle
@Jay 类路径有问题
文件应用插件'com.jfrog.bintray' 其类路径在文件 build.gradle 中定义 (其范围在 project/module 'richeditor' 之外)
解决方案-
导入模块,然后
- 添加
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
进入dependencies下项目的build.gradle文件
- 将以下行添加到项目的 gradle.properties 文件中
VERSION_NAME=1.0.0 VERSION_CODE=16 GROUP=jp.wasabeef ARTIFACT_ID=richeditor-android COMPILE_SDK_VERSION=23 BUILD_TOOLS_VERSION=23.0.2 TARGET_SDK_VERSION=23 MIN_SDK_VERSION=14 POM_DESCRIPTION=RichEditor for Android is a beautiful Rich Text WYSIWYG Editor POM_URL=https://github.com/wasabeef/richeditor-android POM_SCM_URL=git@github.com:wasabeef/richeditor-android.git POM_SCM_CONNECTION=git@github.com:wasabeef/richeditor-android.git POM_SCM_DEV_CONNECTION=scm:git@github.com:wasabeef/richeditor-android.git POM_LICENCE_NAME=The Apache Software License, Version 2.0 POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo POM_DEVELOPER_ID=wasabeef POM_DEVELOPER_NAME=Wasabeef POM_DEVELOPER_EMAIL=dadadada.chop@gmail.com POM_DEVELOPER_URL=wasabeef.jp ISSUE_URL=https://github.com/wasabeef/richeditor-android/issues SUPPORT_PACKAGE_VERSION=23.0.1
现在,同步项目并享受导入