I am trying to write a test case using Espresso.
I am using Android Studio 1.5.1 (Stable channel), Gradle plugin 1.5, Gradle 2.7.
The problem is that Android Studio doesn't recognize any import related to Espresso (and not only)
So, I tried to clean the project, rebuild, invalidate cache and restart, but nothing.
I added these dependencies in my app module:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
I added the runner in defaultConfig:
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
I created the test suite class under androidTest folder:
What am I doing wrong please?
UPDATE
Here is (part) of my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 5
versionName '1.4'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
//my build type configs
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
disable 'InvalidPackage'
}
dexOptions {
incremental true
preDexLibraries = false
jumboMode = false
javaMaxHeapSize "2g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.viewpagerindicator:library:2.4.1'
compile project(':libraries:RITracking')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.google.code.gson:gson:2.5'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'de.greenrobot:eventbus:2.4.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.7.2'
compile 'com.facebook.android:facebook-android-sdk:4.9.0'
compile 'com.cocosw:bottomsheet:1.2.0#aar' //Bottom Sheet that implement material design used for ShareDialog
compile 'com.github.bumptech.glide:glide:3.6.1' //Glide library
compile 'com.googlecode.libphonenumber:libphonenumber:7.2.3' //Library used to parse/merge phones number to E164 format
compile 'me.leolin:ShortcutBadger:1.1.3#aar' //Used to show badge on application icon, library is optimized to work on most of devices
compile 'com.stripe:stripe-android:1.0.3' //Stripe payment gateway, used to integrate credit card payment
provided 'org.projectlombok:lombok:1.16.6'
apt "org.projectlombok:lombok:1.16.6"
compile 'com.jakewharton:butterknife:7.0.1'
apt "com.jakewharton:butterknife:7.0.1"
compile 'de.greenrobot:greendao:2.1.0' //Green Dao library is ORM implementation for Android SQL lite
compile files('libs/libammsdk.jar')
compile files('libs/apptimize-android-2.9.1.jar')
testCompile 'junit:junit:4.12'
androidTestCompile "com.android.support:support-annotations:23.1.1"
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
}
Perhaps your Build Variant is on "release" mode. you have to change it to debug.
UPDATE 30/11/2016
Just like #Jaymes Bearden said in comment below.
Use testBuildType. Android Studio 2.2, gradle 2.2.2
android {
testBuildType "yourBuildType"
}
OLD ANSWER
I found not solution but some source of problem. In my project I have, a lot of BuildTypes. Especially more than one debug build.
Everything works only in default debug build type. I think that this is some internal Android Studio error.
My AS version - 2.1
You need to use debug build variant. With other build options espresso will not be recongnised.
I'm pretty sure, that you're something missing in your configuration. compare your build.gradle with mine below
def ASVersion = '23.1.1'
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'
apply plugin: 'com.neenbedankt.android-apt'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
dataBinding {
enabled = true
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.piotr.awesome"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
androidTestCompile "com.android.support:support-annotations:$ASVersion"
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
androidTestCompile 'com.android.support.test:runner:0.4.1'
compile "com.android.support:appcompat-v7:$ASVersion"
compile "com.android.support:support-v4:$ASVersion"
compile "com.android.support:design:$ASVersion"
}
Also choose File -> Invalidate cache/restart and try first option.
Hope it help
In Android Studio:
Open Run menu -> Edit Configurations -
Add a new Android Tests configuration
- Choose a module
Add a specific instrumentation runner:
android.support.test.runner.AndroidJUnitRunner
Also try to update the Android Support Library from SDK Manager.
Hope this helped.
You can also try this topic: link
Good luck!
I had the same problem. Here is how i fixed it:
Go the src directory of your project in finder/explorer, select the directory containing your test.
Rename the directory with the prefix "androidTest" followed by the name of the flavor you are trying to test.
Open Android Studio, Invalidate Caches and Restart.
Related
So I am having this error every time I try to sync my project on android studio
The error
Process 'command 'C:\Users\Administrator\AppData\Local\Android\Sdk\build-tools\25.0.2\aapt.exe'' finished with non-zero exit value 1
Here is my build.grable file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.newcoderplus.moneymachinecash"
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "2.0"
multiDexEnabled = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "2g"
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/MANIFEST.MF'
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url "https://bitbucket.org/adscend/androidsdk/raw/master/" }
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
maven { url "http://dl.bintray.com/ironsource-mobile/android-adapters" }
}
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'
})
compile project(':fragmentation_swipeback')
compile files('libs/AdxmiSdk_v6.0.0_2016-10-21.jar')
compile files('libs/NativeXMonetizationSDK_v5.5.9.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/applovin-sdk-7.0.3.jar')
compile files('libs/SuperRewards-3.1b.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.github.GrenderG:Toasty:1.1.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.afollestad.material-dialogs:core:0.9.4.1'
compile 'com.jude:easyrecyclerview:4.4.0'
compile 'com.jude:rollviewpager:1.4.6'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.2'
compile 'me.yokeyword:fragmentation:0.10.4'
compile 'com.github.medyo:android-about-page:1.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile group: 'com.backendless', name: 'backendless', version: '4.0.0-beta3'
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.google.android.gms:play-services-base:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.adcolony:sdk:3.1.2'
compile 'com.ironsource.adapters:admobadapter:3.0.2#jar'
compile 'com.ironsource.sdk:mediationsdk:6.5.3#jar'
compile project(':fragmentation_swipeback')
compile files('libs/AdxmiSdk_v6.0.0_2016-10-21.jar')
compile files('libs/NativeXMonetizationSDK_v5.5.9.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/applovin-sdk-7.0.3.jar')
compile files('libs/SuperRewards-3.1b.jar')
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
I have the lastest version of android studio as of today
Something is not working with my android studio. I am using latest version of Android studio, still it gives me error on gradle build. Any ideas on how I can resolve this problem ?
I had this issue yesterday. with no clue what to do. So google it. But whatever material I came across, had no exact solution for the prob., seems like different things were working for different people.
Here is my observation that can save your time.
1. Please verify, if you've messed anywhere with resources like strings, dimens, colors or in layout xml files.
By mistake I created some prob. with my strings xml file along with layout file.
Even clean build was not working, the same error kept popping after
every rebuild/clean.
You have to look closely, to identify the prob. with your code.
Hope this helps.
First try to clean and rebuild your project from Build menu.
Step 1: go to Build -> Clean Project
Step 2: go to Build -> Rebuild Project
This should solve your problem.
Otherwise try updating Android SDK build tool from SDK manager and modify your build.gradle to use latest buildToolsVersion i.e "27.0.3" as of now
As long as I set the minSdkVersion to 21 everything is fine. But as soon as I set it to 18, the build takes like 18 minutes on my Macbook Pro (2016).
Especially transformClassesWithDexForFullDebug takes like forever.
my build gradle file:
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'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId “my.android.app”
//Todo: change to 18 for final export. Having minSdkVersion 21 reduces build time significantly
minSdkVersion 18
targetSdkVersion 25
versionCode 6
versionName "0.5.1"
testInstrumentationRunner "my.android.app.MockTestRunner"
setProperty("archivesBaseName", “MyApp-v$versionName")
multiDexEnabled true
// externalNativeBuild {
// ndk {
// abiFilters "armeabi-v7a", "x86"
// }
// }
}
sourceSets {
main {
jni.srcDirs = []
}
}
buildTypes {
debug{
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
demo {
applicationIdSuffix ".demo"
versionNameSuffix "-demo"
resValue "string", "app_name", “Appname Demo"
}
full {
resValue "string", "app_name", “Appname”
}
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk false
}
}
// externalNativeBuild {
// ndkBuild {
// path "src/main/jni/Android.mk"
// }
// }
}
repositories {
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
maven{
url 'https://maven.fabric.io/public'
}
}
dependencies {
def supportLibVersion = '25.3.1'
def playServicesVersion = '10.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
//Utils
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex.rxjava2:rxjava:2.0.9'
compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.birbit:android-priority-jobqueue:2.0.1'
compile "com.google.android.gms:play-services-gcm:$playServicesVersion"
compile "com.google.android.gms:play-services-vision:$playServicesVersion"
//UI
compile "com.android.support:support-dynamic-animation:$supportLibVersion"
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.android.support:design:$supportLibVersion"
compile "com.android.support:recyclerview-v7:$supportLibVersion"
compile 'io.realm:android-adapters:2.0.0'
compile 'com.commit451:PhotoView:1.2.5'
compile 'com.squareup.picasso:picasso:2.5.2'
//Used to create Picasso instance wrapping a custom OkHttp client for testing
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
//API calls
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
compile 'com.squareup.okhttp3:okhttp:3.4.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.0'
//Views injection
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile "com.android.support:support-annotations:$supportLibVersion"
//Analytics
compile "com.mixpanel.android:mixpanel-android:5.+"
compile "com.google.android.gms:play-services:$playServicesVersion"
//Crash reporting
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
//Debug database
debugCompile 'com.facebook.stetho:stetho:1.5.0'
debugCompile 'com.uphyca:stetho_realm:2.0.0'
//Testing
androidTestCompile "com.android.support:support-annotations:$supportLibVersion"
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//For recyclerview actions
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
// Necessary to avoid version conflicts
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
testCompile 'junit:junit:4.12'
//Mockito and other dependencies to mock api calls
androidTestCompile 'org.mockito:mockito-core:2.0.2-beta'
androidTestCompile "com.crittercism.dexmaker:dexmaker:1.4"
androidTestCompile "com.crittercism.dexmaker:dexmaker-mockito:1.4"
androidTestCompile "com.crittercism.dexmaker:dexmaker-dx:1.4"
//Library that allows waiting for retrofit calls with espresso
androidTestCompile ('com.jakewharton.espresso:okhttp3-idling-resource:1.0.0'){
exclude module: 'okhttp'
}
androidTestCompile 'com.android.support.test:runner:0.5'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.5'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'com.linkedin.testbutler:test-butler-library:1.3.1'
}
I am looking for a way to bring down the compilation time to max 5 minutes. My guess is that it would help a lot if I could figure out what transformClassesWithDexForFullDebug actually really does on a granular level, which would allow me to remove those library dependencies which are causing this insane build time. Any ideas?
This is a common problem and the reason why many developers use minSdkVersion 21 for debug builds. I myself have two productFlavors, one with minSdkVersion 15 and one with 21. I use the one with minSdkVersion 21 for my day-to-day work, because it builds so much faster than API 15. 18 minutes is extreme though, what is your build time on API 21?
See also: https://developer.android.com/studio/build/optimize-your-build.html
"When developing your app, you should deploy to a device running Android 7.0 (API level 24) or higher whenever possible."
I managed to bring down build time to 2.5 minutes by removing all directories inside ~/.gradle/
rm -rf ~/.gradle/
i just upgraded my android studio to 3.0 canery 1. now am having an issue upon syncing my project which was working fine on my previous version of android studio .
here is my file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.******.app"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
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'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.afollestad:bridge:5.1.2'
compile 'com.vistrav:ask:2.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.thefinestartist:finestwebview:1.2.7'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
exclude org.json its already available in the framework.
compile('com.afollestad:bridge:5.1.2') {
exclude group: 'org.json', module: 'json'
}
Your project having org.json:json:20160810 artifact(direct injection or indirect(like by provider of other artifact)) but not able to do find from local/remote repo.
And make sure you've your repository in your project
repositories {
mavenCentral()
jcenter({url "http://jcenter.bintray.com/"})
}
Hopefully you're connected to Internet so that it can find from remote repo:
You go File > Settings > Gradle Look at the "Offline work" inbox, if it's checked u uncheck and try to sync again.
I'm getting "plugin with id 'com.android.application' not found" error in my app after adding one library project in my app, but now I removed that library project from my app but still same error is persist. I googled a lot and tried almost all the solution but yet unable to resolve this error. For more information, please check the following "app module's build.gradle"--
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.lemo.wikinews"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile project(':easyAndroidAnimationsLibrary')
compile project(':liveSdk')
compile project(':main')
compile project(':zbarSample')
compile project(':stickyHeaderLibrary')
compile project(':starBar')
compile project(':facebookSDK')
compile project(':library')
compile project(':ffmpeg4android_lib')
compile project(':socialNetworkingLib')
compile 'com.google.android.gms:play-services:9.6.1'
compile files('libs/nmdp_speech_kit.jar')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
compile files('libs/CWAC-SackOfViewsAdapter.jar')
compile files('libs/devsmartandroid.jar')
compile group: 'com.google.api-client', name: 'google-api-client', version: '1.6.0-beta'
compile files('libs/google-api-services--v1-1.3.0-beta.jar')
compile files('libs/httpclient-4.4.jar')
compile group: 'oauth.signpost', name: 'signpost-commonshttp4', version: '1.2'
compile group: 'oauth.signpost', name: 'signpost-core', version: '1.2.1.2'
compile group: 'oauth.signpost', name: 'signpost-jetty6', version: '1.2.1.1'
compile 'com.android.support:multidex:1.0.0'
'4.4-alpha1'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3')
{
exclude module: "httpclient"
}
}
And below is my top level 'builg.gradle'--
// 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:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Also please let me know if I can provide more information to understand the problem. Thank you.
Bellow is my way to resolve a import problem,the project use a old studio plugin. Forgive my poor English.
Edit your top moudle build.gradle ,edit gradle plugin to your studio's have . then maybe show this,
Error:Minimum supported Gradle version is 2.14.1. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Administrator\Desktop\SelectCityDome\gradle\wrapper\gradle-wrapper.properties to gradle-2.14.1-all.zip
Fix Gradle wrapper and re-import project
Gradle settings follow the step fix it.
JUST SEE THIS PICTURE
my run and debug buttons in my Android Studio are disabled.
I have seen many answers about this but the solution are not correct in my case.
This is my error in my gradle console:
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Incremental java compilation is an incubating feature.
This is my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "myProjectPackageName"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
}
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.0'
// Zxing libraries Scan
compile 'com.embarkmobile:zxing-android-minimal:2.0.0#aar'
compile 'com.embarkmobile:zxing-android-integration:2.0.0#aar'
compile 'com.google.zxing:core:3.0.1'
//Google api books
compile 'com.google.apis:google-api-services-books:v1-rev80-1.21.0'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
// Dependency for Google Sign-In
compile 'com.google.android.gms:play-services-plus:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
//Facebook Login
compile 'com.facebook.android:facebook-android-sdk:4.13.2'
// Dependency for Firebase
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-storage:9.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
}
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha4'
}
apply plugin: 'com.google.gms.google-services'
Thanks a lot for the help
You need to exclude dependencies inside build.gradle files.
compile('com.google.apis:google-api-services-books:v1-rev80-1.21.0') {
exclude module: 'httpclient'
exclude group: 'org.apache.httpcomponents'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
Try to exclude it from all configurations.
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
Restart studio and then check again. Or either select app module from drop down menu beside Run button.