I can't solve this error, I already downloaded sdk 25 in my android studio 4.0 but still I got this error
Cannot choose between the following variants of project :MrcosClient:
debugRuntimeElements
releaseRuntimeElements
All of them match the consumer attributes:
Variant 'debugRuntimeElements' capability mrcos-mobile-repo:MrcosClient:unspecified:
Unmatched attributes:
Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
Found com.android.build.api.attributes.VariantAttr 'debug' but wasn't required.
Found org.gradle.usage 'java-runtime' but wasn't required.
Variant 'releaseRuntimeElements' capability mrcos-mobile-repo:MrcosClient:unspecified:
Unmatched attributes:
Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
Found org.gradle.usage 'java-runtime' but wasn't required.
Here are my gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'org.greenrobot.greendao'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "mrcos.pmti.biz.mrcos"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "2.0"
multiDexEnabled true
setProperty("archivesBaseName", "mrcos_app_v$versionName")
ndk {
moduleName "libmrcosclientndk"
}
packagingOptions {
}
}
sourceSets {
main {
jniLibs.srcDirs = ['lib']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
prod {
buildConfigField 'String', 'APP_VERSION_NAME', '"2.0"'
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dexOptions {
jumboMode true
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
greendao {
targetGenDir 'src/main/java'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/wisepadapi-android-2.0.0.jar')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.dagger:dagger:2.0.1'
apt "com.google.dagger:dagger-compiler:2.0.1"
compile 'javax.annotation:jsr250-api:1.0'
compile project(':MrcosClient')
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
//RxJava
compile 'io.reactivex:rxjava:1.0.16'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.2.0'
compile files('libs/platform_extension.jar')
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
compile 'com.google.zxing:core:3.3.0'
//Currency
compile 'com.github.BlacKCaT27:CurrencyEditText:v1.4.4'
//Dialog
compile 'com.afollestad.material-dialogs:core:0.9.4.5'
compile 'com.afollestad.material-dialogs:commons:0.9.4.5'
debugCompile 'com.amitshekhar.android:debug-db:1.0.1'
compile 'com.intuit.sdp:sdp-android:1.0.3'
provided "org.projectlombok:lombok:1.12.6" //or v. 1.16.2 in your case.
compile 'ch.acra:acra:4.9.2'
compile files('libs/jsch-0.1.54.jar')
}
apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
moduleName "mrcosclientndk"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs =['libs']
jni.srcDirs = []
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude "lib/arm64/libstlport_shared.so"
}
dexOptions {
javaMaxHeapSize "4g"
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile files('libs/jackson-annotations-2.5.0.jar')
compile files('libs/jackson-core-2.5.0.jar')
compile files('libs/jackson-databind-2.5.0.jar')
compile files('libs/pmti-ldonios-lib.jar')
compile files('libs/sqlcipher-javadoc.jar')
compile files('libs/sqlcipher.jar')
//clearableeditext
compile 'org.droidparts:droidparts:2.9.6'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'
//RxAndroid
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
//dagger
compile 'com.google.dagger:dagger:2.0.1'
apt "com.google.dagger:dagger-compiler:2.0.1"
compile 'javax.annotation:jsr250-api:1.0'
compile files('libs/mrcoscodec.jar')
debugCompile 'com.amitshekhar.android:debug-db:1.0.1'
compile 'org.greenrobot:greendao:3.2.0'
provided "org.projectlombok:lombok:1.12.6" //or v. 1.16.2 in your case.
}
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
First step: try removing implementation project(':SomeModule'), if in this case the app is running without this error then try to add path and configuration in the above sample code. In my case problem was in that I was trying include and load wrong module in my base app.
Related
There is this error I get which you can see below.
I found what causes the error is the incompatibility between the gms version in my project and the one used in Onesignal.
I have checked every single solution proposed in these posts:
https://github.com/OneSignal/OneSignal-Android-SDK/issues/286
https://stackoverflow.com/questions/43430401/android-nosuchmethoderror-no-static-method-zzyljava-lang-object/43430478#comment86259725_43430478
Couldn't add OneSignal's Gradle plugin as suggested by OneSignal's official site.
Removing
apply plugin: 'com.google.gms.google-services'
and
classpath 'com.google.gms:google-services:3.2.0'
from gradle files will solve this error. But I cannot do it since I want to inflate MapView in my project and I need google-services.
Here is the error I get:
java.lang.NoSuchMethodError: No static method zza(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzbq; or its super classes (declaration of 'com.google.android.gms.common.internal.zzbq' appears in /data/app/com.blah.blah-1/base.apk:classes2.dex)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:6326)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5918)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5857)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig
{
applicationId "com.parsdigit.helsa"
manifestPlaceholders = [onesignal_app_id : "4af7b2c1-a1a8-4b4a-ade3-d65289b38267",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes
{
release
{
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
aaptOptions {
cruncherEnabled = false
}
packagingOptions
{
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'
}
lintOptions
{
checkReleaseBuilds false
}
dexOptions
{
preDexLibraries = false
jumboMode true
javaMaxHeapSize "4g"
}
}
dependencies
{
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.squareup.okhttp3:okhttp:3.+'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.google.android.gms:play-services-maps:12.0.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
compile 'org.apache.httpcomponents:httpclient:4.5.4'
compile 'com.google.maps.android:android-maps-utils:0.4.3'
compile 'com.google.code.gson:gson:2.8.2'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.pixplicity.easyprefs:library:1.8.1#aar'
compile 'gun0912.ted:tedpermission:1.0.3'
compile 'com.kennyc:snackbar:2.5'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'com.daimajia.androidanimations:library:2.3#aar'
compile 'com.fujiyuu75:sequent:0.2.1'
compile 'pl.charmas.android:android-reactive-location:0.10#aar'
compile 'io.reactivex:rxjava:1.2.0'
compile 'me.zhanghai.android.materialratingbar:library:1.2.0'
compile 'cn.lightsky.infiniteindicator:library:1.2.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.wooplr:Spotlight:1.2.3'
compile 'com.caverock:androidsvg:1.2.1'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile project(':sidemenulibrary')
compile('com.github.ozodrukh:CircularReveal:1.1.1#aar') {
transitive = true;
}
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.nex3z:notification-badge:0.3.0'
compile 'com.github.Shashank02051997:FancyGifDialog-Android:1.1'
compile 'br.com.simplepass:loading-button-android:1.+'
compile 'com.github.blennerSilva:AwesomeDialog:2.0.5'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.airbnb.android:lottie:2.2.5'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.github.RobertApikyan:SegmentedControl:release_1.0.1'
compile 'com.github.skydoves:powermenu:2.0.1'
compile 'com.otaliastudios:cameraview:1.4.1'
compile 'com.github.Mostafa-MA-Saleh:EditCredit:1.5.0'
compile 'com.github.mreram:ShowCaseView:1.0.5'
compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
compile 'com.alirezaafkar:sundatepicker:2.0.8'
compile('com.cedarmaps:CedarMapsSDK:2.0.0#aar') {
transitive = true
}
}
afterEvaluate
{
tasks.matching
{
it.name.startsWith('dex')
}
.each
{ dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
apply plugin: 'com.google.gms.google-services'
My toplevel build.gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://repo.cedarmaps.com/android/" }
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://dl.bintray.com/kennyc1012/maven' }
maven { url "http://dl.bintray.com/glomadrian/maven" }
maven { url "https://maven.google.com" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
POOOH! After struggling for a long couple of hours finally fixed the issue by:
changing
classpath 'com.google.gms:google-services:3.2.0'
to
classpath 'com.google.gms:google-services:3.2.1'
and updating
implementation 'com.google.android.gms:play-services-maps:12.0.0'
to
implementation 'com.google.android.gms:play-services-maps:12.0.1'
This is my build.gradle(app)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
}
ant.importBuild 'assets.xml'
preBuild.dependsOn(list, checksum)
clean.dependsOn(clean_assets)
def dagger_version = "2.10"
def retrofit2_version = "2.2.0"
def support_package_version = "26.0.0-alpha1"
dependencies {
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'
})
//dagger
compile "com.google.dagger:dagger:${dagger_version}"
annotationProcessor "com.google.dagger:dagger-compiler:${dagger_version}"
//retrofit2
compile "com.squareup.retrofit2:retrofit:${retrofit2_version}"
compile "com.squareup.retrofit2:converter-jackson:${retrofit2_version}"
//okhttp3
//support packages
compile "com.android.support:appcompat-v7:${support_package_version}"
compile "com.android.support:cardview-v7:${support_package_version}"
compile "com.android.support:design:${support_package_version}"
compile project(':pocketsphinx-android-5prealpha-release')
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.android.support:support-annotations:25.3.1'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.0'
androidTestCompile 'com.android.support.test:runner:1.0.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
I have noted the controversial dependencies from here
And I get the following errors
Failed to resolve:com.android.support.test.espresso:espresso-core:3.0.0
Failed to resolve:com.android.support.test:runner:1.0.0
I have updated the sdk manager, but still facing this. Do I have to downgrade to a lower version?
Can anyone help?
I had the same problem when I wanted to try Espresso.
I've resolved it by adding
maven {
url "https://maven.google.com"
}
to
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
in the project's build.gradle file. See https://developer.android.com/topic/libraries/testing-support-library/packages.html#gradle-dependencies.
I recently had a lot of problems trying to debug in my application when using Retrolambda, because of that I wanted to include Jack on my Gradle for debugging purposes.
jackOptions {
enabled true
}
Because of that, I have been going through this error and I still without finding a way to solve it.
Jackson : NoSuchMethodError for com.google.common.base.Preconditions.checkState
I have check different posts looking for a solution:
Android Studio: Gradle - build fails -- Execution failed for task ':dexDebug'
Lambda expressions crash with IncompatibleClassChangeError in Android when using jack
A larger heap for the Gradle daemon is recommended for running jack
But none of the solutions have fixed my problems. Right now my Gradle looks like:
buildscript {
ext {
use_jack = true
dagger_version = "2.8"
firebase_version = "9.6.1"
rx_version = "2.0.3"
rx_firebase_version = "1.0.0"
rx_android_version = "2.0.1"
gson_version = "2.8.0"
butterkinfe_version = "8.4.0"
support_version = "25.0.0"
target_sdk_version = 24
}
}
apply plugin: 'com.android.application'
if (!use_jack) { //Backport to apt / RetroLambda
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.myaplicattion"
minSdkVersion 15
targetSdkVersion project.properties.target_sdk_version
versionCode 1
versionName "0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled use_jack
}
}
buildTypes {
debug {
minifyEnabled false
testCoverageEnabled = true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//Support
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:design:$support_version"
//Util
compile 'com.intellij:annotations:12.0'
compile 'com.jakewharton.timber:timber:4.3.1'
compile "com.jakewharton:butterknife:$butterkinfe_version"
if (use_jack) annotationProcessor "com.jakewharton:butterknife-compiler:$butterkinfe_version"
else apt "com.jakewharton:butterknife-compiler:$butterkinfe_version"
compile 'com.github.mukeshsolanki:country-picker-android:1.1.6'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
//Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
//Firebase
// compile "com.firebaseui:firebase-ui-database:0.4.0"
compile "com.google.firebase:firebase-storage:$firebase_version"
compile "com.google.firebase:firebase-messaging:$firebase_version"
compile "com.google.firebase:firebase-common:$firebase_version"
compile "com.google.firebase:firebase-auth:$firebase_version"
compile "com.google.firebase:firebase-core:$firebase_version"
compile "com.google.firebase:firebase-database:$firebase_version"
compile "com.google.firebase:firebase-crash:$firebase_version"
compile "com.github.frangsierra:rx2firebase:$rx_firebase_version"
//GSON
compile "com.google.code.gson:gson:$gson_version"
//Facebook
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
//Dagger
compile "com.google.dagger:dagger:$dagger_version"
if (use_jack) annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
else apt "com.google.dagger:dagger-compiler:$dagger_version"
//Rx
compile "io.reactivex.rxjava2:rxjava:$rx_version"
compile "io.reactivex.rxjava2:rxandroid:$rx_android_version"
//Test
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support.test:runner:0.5'
}
apply plugin: 'com.google.gms.google-services'
And my appgradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenLocal()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I followed the instruction here to add an instrumentation test, but unfortunately Android Studio complains about the classes from the test runner package (com.android.support.test:runner:0.5) or test rules or espresso-core (cannot find symbol). If I change the dependency type from androidTestCompile to compile, the errors disappear. I created an instrumentation run config, and currently that run config is selected.
EDIT:
Here is our Gradle build file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'realm-android'
apply plugin: 'pmd'
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:2.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath 'io.realm:realm-gradle-plugin:1.0.0'
classpath 'io.fabric.tools:gradle:1.21.6'
}
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
repositories {
jcenter()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url 'https://repo.commonsware.com.s3.amazonaws.com' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v13:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:percent:24.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile "com.mixpanel.android:mixpanel-android:4.8.6"
compile 'com.squareup.retrofit2:retrofit:2.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.0.1'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
compile('com.facebook.android:facebook-android-sdk:4.13.1') {
exclude module: 'bolts-android'
exclude module: 'bolts-applinks'
exclude module: 'bolts-tasks'
}
compile 'com.facebook.fresco:fresco:0.11.0'
compile 'me.relex:photodraweeview:1.0.0'
compile 'com.jakewharton.rxrelay:rxrelay:1.0.0'
compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
compile 'com.jakewharton.timber:timber:4.0.1'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'com.cloudinary:cloudinary-android:1.2.2:'
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.rockerhieu.emojicon:library:1.3.3'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'com.trello:rxlifecycle:0.5.0'
compile 'com.trello:rxlifecycle-components:0.5.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-recyclerview-v7:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-design:0.4.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.1'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.1'
compile 'net.sourceforge.streamsupport:streamsupport:1.4.3'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'junit:junit:4.12'
}
android {
// General configuration goes here
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
def buildNumber = computeVersionCode()
applicationId 'com.xxx.xxx'
minSdkVersion 19
targetSdkVersion 23
versionCode = buildNumber
versionName '0.2.6'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
dexOptions {
incremental true
javaMaxHeapSize "6g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
debug {
storeFile rootProject.file('debug.keystore')
storePassword 'xxx'
keyAlias 'xxx'
keyPassword 'xxx'
}
beta {
String password = getKeyStorePassword()
println("password::$password")
if (password) {
storeFile file("beta_release.keystore")
storePassword xxx
keyAlias "xxx"
keyPassword xxx
} else {
println "Environment variable BETA_KEYSTORE_PASSWORD needs to be set"
}
}
}
buildTypes {
localDebug {
minifyEnabled false
debuggable true;
signingConfig signingConfigs.debug
buildConfigField "String", "BACKEND_ADDRESS", "\"http://xxx.xxx.dev/\""
buildConfigField "boolean", "MYVAR2", "false"
buildConfigField "String", "MYVAR3", "\"value\""
resValue "string", "BUILD_TYPE_DISPLAY", "Debug(Local)"
applicationIdSuffix ".debug"
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
lintOptions {
abortOnError true
}
splits {
abi {
enable true
reset()
include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a', 'armeabi'
universalApk false
}
}
}
task pmd(type: Pmd) {
ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
ignoreFailures = false
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
xml {
destination "$project.buildDir/reports/pmd/pmd.xml"
}
html {
destination "$project.buildDir/reports/pmd/pmd.html"
}
}
}
def computeVersionCode() {
def buildNumber = System.getenv('BUILD_NUMBER')
if (buildNumber == null || buildNumber.isEmpty()) {
println "No BUILD_NUMBER in environment, using 1 as revision"
return 1
}
buildNumber = buildNumber.toInteger()
println "New revision is ${buildNumber}"
return buildNumber
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:24.0.0'
force 'com.android.support:support-v4:24.0.0'
force 'com.android.support:appcompat-v7:24.0.0'
force 'com.android.support:design:24.0.0'
force 'com.android.support:recyclerview-v7:24.0.0'
}
}
I've spent about a day on this myself and finally figured it out. This is an Android Studio feature - termed a feature, but I'd consider it a bug.
To get instrumentation tests working, you need to set your Build Variants to the following:
Test Artifact: Android Instrumentation Tests
Build Variant: debug
See here for more details
I personally think is makes no sense; it's not like you're using androidTestCompileDebug, and running gradle <app_name>:dependencies repeatedly shows pulling in androidTestCompile dependencies, regardless of the build variant. But for some reason, they only resolve in debug.
I hope this helps.
I can't find the url on maven too build my project.
My android studio gives the following error:
Error:com.mcxiaoke.volley:library:1.0.+ (double-click here to find usages.)
The whole build.gradle file
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 100
versionName "1.00"
}
buildTypes {
release {
runProguard false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'http://clinker.47deg.com/nexus/content/groups/public'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:4.3.23'
compile 'joda-time:joda-time:2.3#jar'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.0'
compile 'com.j256.ormlite:ormlite-core:4.48#jar'
compile 'com.j256.ormlite:ormlite-android:4.48#jar'
compile 'com.loopj.android:android-async-http:1.4.5-SNAPSHOT'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile ('com.fortysevendeg.swipelistview:swipelistview:1.0-SNAPSHOT#aar') {
transitive = true
}
compile project(':libraries:facebook')
}
As you see in the file I added mavenCentral() to the dependencies but that didn't help.
Double check you have the right repository declaration in your build.gradle:
repositories {
mavenCentral()
}