导入项目Plugin with id 'com.github.dcendents.android-maven' not found.错误

今天开发项目是引用了开源的MPChart的Library,出现了报错Plugin with id 'com.github.dcendents.android-maven' not found.

其实这是缺少工程以来的配置信息

在Project下那个build.grade里面的

dependencies {
}

添加全局依赖

classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0"

搞定,收工!

 

正常导入第三方框架步骤

一、下载第三方开源框架/项目
下载地址:[xUtils3](https://github.com/wyouflf/xUtils3)
1
二、把第三方开源框架/项目的library文件考到项目文件夹中与app文件夹同级
三、在settings.gradle文件中添加框架/项目
include ':app',"xUtils"
1
2
四、在build.gradle(Module:app)中添加依赖

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'
    implementation project(':xUtils')// 新添加的
}

五、第四布后机会提示一些相关错误,根据相关错误进行修改
在这里,我添加xUtils3的时候,提示了一个错误

Error:(2, 0) Plugin with id 'com.github.dcendents.Android-maven' not found
1
解决方法:在项目的build.gradle文件中添加两句代码

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"// 新添加的
    classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0"// 新添加的
}

六、如果加入的第三方开源框架/项目根目录中没有build.gradle,新建一个
参考:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 4
        targetSdkVersion 23
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

dependencies {
    //compile 'com.android.support:appcompat-v7:19.1.0'
    //compile 'com.android.support:support-v4:19.1.0'
    compile files('libs/android-support-v4.jar')
}

七、Build/Make Project(到这一步,就已经添加成功了)
注:在这里说明一下,android stdios添加xUtils3,可以直接在在build.gradle(Module:app)中添加依赖即可使用,方法如下:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile project(':SlidingMenu')
    compile 'org.xutils:xutils:3.3.34'   // 新添加的
    //compile project(':xUtils')
}

导入第三方Jar包:
直接将jar包拷贝到app/libs下,然后在app下的build.gradle中添加此jar的依赖。如下:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) // 如果有这一句,下面一句可以不用添加,这里添加将libs目录下的所有jar文件依赖
    compile files('libs/umeng-analytics-v6.0.1.jar') // 新添加的
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}
--------------------- 

原文:https://blog.csdn.net/zhengweilxl/article/details/51541786 
 

转载于:https://my.oschina.net/u/3698786/blog/2960952

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值