添加依赖项时出错 - Android Studio

时间:2015-11-18 05:55:42

标签: android gradle android-gradle build.gradle

我在我的android项目中使用https://github.com/wasabeef/richeditor-android库。我尝试通过“编译'jp.wasabeef:richeditor-android:0.3.0'”将其添加到我的项目中,如其页面上所述,它在我的项目中完美运行。

我希望在该库中进行一些自定义更改。所以我尝试在那里克隆示例项目,它工作正常。

但是当我尝试在我的代码中添加示例代码中的“richeditor”项目文件夹并在我的app build.gradle中添加“编译项目('libs:richeditor')”时在settings.gradle中添加“include':app:libs:richeditor'”,它会引发错误“错误:找不到ID为'com.jfrog.bintray'的插件。”< /强>

P.S。我已将richeditor项目放在 app / libs / 文件夹中。

如何解决此错误或是否有其他方法可以对上述库进行一些自定义更改?

build.gradle(app)

    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'

2 个答案:

答案 0 :(得分:1)

@Jay在classpath上有问题

查看文件bintrya-public.gradle

该文件应用插件'com.jfrog.bintray' 其类路径在文件build.gradle中定义 (其范围在项目/模块'richeditor'之外)

解决方案 -

导入模块,然后

  1. 添加
  2.   

    classpath'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'

    进入依赖项下的项目的build.gradle文件

    1. 将以下行添加到项目
    2. 的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是一个美丽的富文本   WYSIWYG编辑器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 = Apache软件许可证,版本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

      现在,同步项目并享受导入

答案 1 :(得分:0)

&#34;编译&#39; jp.wasabeef:richeditor-android:0.3.0&#39;&#34; 改为编译&#39; jp。 wasabeef:build.gradle中的richeditor-android:1.0.0&#39;

请参阅此链接:https://github.com/wasabeef/richeditor-android#gradle