/1、全部替代你的项目build.gradle内容:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// maven {
// url 'https://maven.google.com'
// }
mavenCentral()//如果 jcenter 很慢,尝试添加 mavenCentral 并调整到首行
jcenter()
maven {
url "https://www.jitpack.io"
}
google()
}
dependencies {
//**重要**
classpath 'com.bugtags.library:bugtags-gradle:latest.integration'
// classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
classpath 'com.android.tools.build:gradle:3.1.2'
// classpath 'org.greenrobot:greendao-gradle-plugin:3.0.0'
//1.自动化maven打包插件
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
//2.自动上传至Bintray平台插件
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()//如果 jcenter 很慢,尝试添加 mavenCentral 并调整到首行
jcenter()
// maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven { url "https://raw.githubusercontent.com/HyphenateInc/Hyphenate-SDK-Android/master/repository" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2、以及替代gradle-wrapper.properties内容:
#Thu Sep 13 13:38:28 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
android.enableAapt2=false
同步即可
如果还报如下错误:Plugin with id 'com.jfrog.bintray' not found.
解决方法:
导致这个的原因是该项目的原作者会把项目发布到maven中央仓库中,所以在gradle中添加了相关的maven发布任务。 而我们是不能连到maven的仓库,解决这个问题只需要:
找到该Module的build.gradle文件,删除原作者关于maven仓库的配置,只保留下:
apply plugin: 'com.android.library'
android {
.....
}
dependices(){
....
}
然后同步一下就行了
如果运行再报错如下:Compilation failed to complete
解决方法:
Program type already present:
意思是引入类重复了:
注释掉重复的引入:
可注释掉刚刚引入的module:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.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'
compile ('com.xyzlf.share:sharesdk:0.0.10') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
// compile project(':shareLibrary')//注释掉啊啊啊啊啊啊啊
}