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
Related
I am looking for the answer that can help me to solve this problem. I am trying to solve this problem for last 2 days.But still, I didn't get the answer that can solve my problem. I have tried so many solutions which are given here.But no solution worked for me.
Please help me to solve this problem.Any help will be appreciated.
The actual problem is:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForGlobalServerDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
this is occurring every time when I run my existing project on android studio 3.0
I have tried so many solutions for this like:
1- To add mutidexenabled true in gradle
2- To change the version of dependencies
3- To change the compile keyword with the implementation
4- To clean and rebuild the project
5- Delete the Gradle file(this was so difficult because when you again
restarted the project no Gradle file will be auto-regenerated) etc.
I am looking for the solutions which are other than those which are mentioned above. Please help me out. Please...
code of gradle file is given below:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
repositories {
maven { url 'http://clojars.org/repo' }
}
android {
signingConfigs {
config {
keyAlias 'example'
keyPassword 'example'
storeFile file('/Users/standarduser/Documents/Android_Projects/example.jks')
storePassword '########'
}
}
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.example.example'
minSdkVersion 16
targetSdkVersion 24
versionCode 9 // both Latest
versionName "2.0.7"
multiDexEnabled true
useLibrary 'org.apache.http.legacy'
vectorDrawables.useSupportLibrary = true
signingConfig signingConfigs.config
}
dexOptions {
incremental = true
preDexLibraries = false
javaMaxHeapSize "4g"
}
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
packagingOptions
{
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
lintOptions{
abortOnError false
}
}
dependencies {
compile files('libs/httpcore-4.4.1.jar')
compile('com.twitter.sdk.android:twitter:2.1.1#aar') { //1.6.1#aar
transitive = true;
}
compile('com.github.afollestad.material-dialogs:core:0.8.5.2#aar') {
transitive = true
}
compile('io.socket:socket.io-client:0.8.2') { // 0.6.3
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
testCompile 'junit:junit:4.12'
compile 'com.writingminds:FFmpegAndroid:0.3.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'io.nlopez.smartlocation:library:3.2.9'
// compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services-appinvite:9.8.0'
//9.0.1
compile 'com.google.android.gms:play-services-gcm:9.8.0'
compile 'com.google.android.gms:play-services-location:9.8.0'
compile 'com.google.android.gms:play-services-places:9.8.0'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.google.android.gms:play-services-ads:9.8.0'
compile 'com.google.android.gms:play-services-auth:9.8.0'
compile 'com.google.android.gms:play-services-plus:9.8.0'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
// implementation 'org.apache.httpcomponents:httpmime:4.3.6'
// implementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.android:facebook-android-sdk:4.23.0'
compile 'com.pusher:pusher-java-client:1.1.2'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.6'
compile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.9'
compile 'com.commit451:PhotoView:1.2.4'
compile 'commons-lang:commons-lang:2.3'
compile 'com.karumi:dexter:2.3.1'
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
implementation 'com.android.support:multidex:1.0.2'
compile 'org.ocpsoft.prettytime:prettytime:3.2.7.Final'
compile 'com.koushikdutta.async:androidasync:2.+'
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'net.danlew:android.joda:2.9.4.1'
compile 'com.albinmathew:photo-crop-library:1.0.3'
compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.+'
compile 'com.wang.avi:library:2.1.3'
compile 'com.wowza.gocoder.sdk.android:com.wowza.gocoder.sdk:1.0b7#aar'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
compile('com.crashlytics.sdk.android:crashlytics:2.6.4#aar') {
transitive = true;
}
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
// compile 'com.cocosw:bottomsheet:1.+#aar'
compile project(':libbambuser7')
compile 'com.squareup.okhttp:okhttp:2.0.0'
}
apply plugin: 'com.google.gms.google-services'
Add this in your build.gradle
android {
defaultConfig {
multiDexEnabled true
}
}
First sync gradle then
From the Build menu -> press the Clean Project button.
When task completed, press the Rebuild Project button from the Build menu.
compile is now deprecated so it's better to use implementation or api
hope this helps you.
Try this
Use this
com.google.android.gms:play-services:11.6.0
com.google.android.gms:play-services-location:11.6.0
Instead of this
com.google.android.gms:play-services:9.8.0
after Sync -> clean -> rebuild
Android studio build issue Google sign in and Firebase latest version 10.2.4
google sign in was working fine until I have put firebase jar in gradle and its throwing "Error:(149, 28) The type com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable cannot be found in source files, imported jack libs or the classpath"
below is app level build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "viksit.com.viksit.pro.viksitpro"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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'
}
android {
useLibrary 'org.apache.http.legacy'
}
compile project(':linkedin-sdk')
compile(group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1') {
exclude group: 'xpp3', module: 'xpp3'
}
compile('com.udojava:EvalEx:1.0') {
exclude group: 'junit', module: 'junit'
}
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.android.support:appcompat-v7:25.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.afollestad.material-dialogs:commons:0.9.4.2'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-auth:10.2.4'
compile 'com.google.android.gms:play-services-auth:10.2.4'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.android.support:support-v4:25.0.2'
compile 'com.felipecsl:gifimageview:2.1.0'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.android.support:design:25.3.0'
compile 'com.github.vipulasri:timelineview:1.0.5'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.truizlop.sectionedrecyclerview:library:1.2.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'link.fls:swipestack:0.3.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
testCompile 'junit:junit:4.12'
}
below is project level build.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:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Looks like you skipped this step
apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
https://developers.google.com/android/guides/google-services-plugin
Sidenote: You have Glide and Picasso, two-way gif drawable libraries, and two shaped imageview libraries. Each pair do the same thing. Clean out your dependencies to reduce your app size and chances of errors
I had a similiar problem with firebase yesterday and this worked for me:
Just add this to gradle file and rebuild it:
android {
....
dexOptions {
// Prevent OutOfMemory with MultiDex during the build phase
javaMaxHeapSize "4g"
}
}
Actually few hours ago my project has no error, but I don't know what changes happened from me unknowingly and now I'm getting following error--
"Error:(36, 0) Project with path ':easyAndroidAnimationsLibrary' could not be found in root project 'wikiReviews'". I googled and checked for my project hierarchy, gradle file, setting file everything seems to be OK but unable to trace the real problem yet. Please see the following image to check hierarchy--
My build.gradle is--
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.myleomo.wikiReviews"
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"
}
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
repositories {
jcenter()
}
}
allprojects {
repositories {
jcenter()
}
}
Below is my top level build. 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()
}
}
Below is my settings.gradle--
include ':easyAndroidAnimationsLibrary'
include ':facebookSDK'
include ':liveSdk'
include ':socialNetworkingLib'
include ':starBar'
include ':stickyHeaderLibrary'
include ':zbarSample'
include ':ffmpeg4android_lib'
include ':library'
include ':main'
include ':wikiReviews'
Please let me know if I can provide more information for the same. Thank you.
your project should be wikiReviews.
I guess the way of your project loaded from android studio maybe wrong
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.
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.