build.gradle(项目级别)
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app level)
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven {
url 'https://repo1.maven.org/maven2/'
}
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "com.kiran.example.ebitcoin"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true //support color.xml colors in vector image
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
useLibrary 'org.apache.http.legacy'
// for EncodingUtils.getBytes(post_Data, "base64") in actrivitypaymentfrowebview
sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/assets/font'] } }
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation 'com.google.firebase:firebase-messaging:11.0.4'
implementation 'com.google.firebase:firebase-invites:11.0.4'
implementation 'com.google.firebase:firebase-crash:11.0.4'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:support-v13:27.0.1'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:cardview-v7:27.0.1'
compile('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true;
}
compile 'com.flurry.android:analytics:11.0.0@aar'//flurry sdk of yahoo for crashalytics
//compile 'com.google.code.gson:gson:2.3.1'
//compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.android.support:animated-vector-drawable:27.0.1'
//compile 'com.android.support:customtabs:27.0.1'
//compile 'com.android.support:palette-v7:27.0.1'
compile 'com.android.support:recyclerview-v7:27.0.1'
//to store object in shared pref
// compile 'com.google.code.gson:gson:2.7'
// Retrofit
compile 'com.squareup.retrofit2:retrofit:2.3.0'
// JSON Parsing
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
//add ripple below API 21
//compile 'com.balysv:material-ripple:1.0.2'
//add this dependency to scan QR code
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
//material dialog
// compile 'me.drakeet.materialdialog:library:1.3.1'
//for setting GIF image
//compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
//for material dialogs
//implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
//for sms otp
//compile 'com.github.GoodieBag:Pinview:v1.3'
//PayUMoney
/* compile('com.payumoney.sdkui:plug-n-play:1.1.0') {
transitive = true;
exclude module: 'payumoney-sdk'
}
compile 'com.payumoney.core:payumoney-sdk:7.1.0'*/
//for payment gateway
compile 'com.android.volley:volley:1.1.0'
//enable multiple methods
compile 'com.android.support:multidex:1.0.0'
//contry code selector
//implementation 'com.hbb20:ccp:2.1.4'
//appling font library to app
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
//file compression
compile 'id.zelory:compressor:2.1.0'
//async task test
//compile 'com.loopj.android:android-async-http:1.4.9'
// compile 'cz.msebera.android:httpclient:4.3.6'//upload images to api using this
//progress dialog
//compile 'com.github.d-max:spots-dialog:0.4'
//to load
compile 'com.github.bumptech.glide:glide:3.8.0'
implementation files('libs/android-async-http-1.4.9.jar')
implementation files('libs/android-async-http-1.4.9.jar')
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
确保所有support
lib具有相同的版本。
答案 1 :(得分:0)
有多种原因导致您收到此错误,
第一个可能是你的互联网工作不正常,因为我看到你使用了很多第三方库,因此需要高速互联网下载。
第二个可能是您的项目设置处于离线模式通过转到文件 - >进行检查。设置 - >构建,执行,开发并单击Gradle并查看" Offline"是否选中了工作复选框。
第三个可能是缓存内存只是无效并重新启动项目转到文件 - >使高速缓存/重新启动无效。
希望这个帮助