Very often while compiling I get the following error:
Error:(5, 18) error: cannot find symbol class DaggerDataComponent
Error:(14, 21) error: cannot find symbol class DaggerNetComponent
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
It is enough to start building again with no changes to make the building succeeding.
I have the Instant Run feature disabled.
I'm using Java8 with retrolambda and dagger2 2.8.
This is my build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
}
}
plugins {
id "me.tatarka.retrolambda" version "3.3.1"
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "24.0.2"
compileOptions.incremental = false
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "org.app"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
jackOptions {
enabled false
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
compileOptions {
incremental true
}
/**
* Signing keys config.
*/
signingConfigs {
debug {
storeFile file("ddebug.keystore")
keyAlias "ddebug"
storePassword "07477800086d!"
keyPassword "07477800086d!"
}
release {
storeFile file("drelease.keystore")
keyAlias "drelease"
storePassword "07477800086d!"
keyPassword "07477800086d!"
}
}
buildTypes {
release {
debuggable false
minifyEnabled true
zipAlignEnabled true
renderscriptDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
minifyEnabled false
versionNameSuffix "_dev"
}
}
}
dependencies {
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'
apt 'com.gabrielittner.auto.value:auto-value-with:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
def supportVersion = '25.1.0'
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:cardview-v7:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile "com.android.support:gridlayout-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile 'io.reactivex:rxandroid:0.24.0'
def retrofit2 = '2.1.0'
def okhttp3 = '3.4.1'
compile "com.squareup.retrofit2:retrofit:$retrofit2"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit2"
compile "com.squareup.retrofit2:converter-gson:$retrofit2"
compile "com.squareup.okhttp3:okhttp:$okhttp3"
compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp3"
compile "com.squareup.okhttp3:logging-interceptor:$okhttp3"
def butter_knife = '8.4.0'
apt "com.jakewharton:butterknife-compiler:$butter_knife"
compile "com.jakewharton:butterknife:$butter_knife"
def leak_canary = '1.4-beta2'
debugCompile "com.squareup.leakcanary:leakcanary-android:$leak_canary"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
compile 'com.github.clans:fab:1.6.4'
compile 'io.reactivex:rxjava:1.2.0'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
provided 'com.google.auto.value:auto-value:1.2'
apt 'com.google.auto.value:auto-value:1.2'
compile 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-gson:0.3.2-rc1'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'junit:junit:4.12'
//other dependencies for testing
def hamcrestVersion = '1.3'
testCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-integration:$hamcrestVersion"
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
apply plugin: 'com.google.gms.google-services'
android.packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
Related
Could not find multidex.jar (com.android.support:multidex:1.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex
I have just installed latest version of Android Studio 3.1.3
When i tried to sync my project it shows failed to resolve : multidex
Also i tried https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex this link which shows 404 error. Please help
Project Level :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'buildsystem/dependencies.gradle'
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.5'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
allprojects {
ext {
androidApplicationId = 'com.medikoe.connect'
androidVersionCode = 23
androidVersionName = "1.7.2"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testApplicationId = 'com.medikoe.test'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
repositories {
google()
}
App Level :
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.frogermcs.androiddevmetrics'
configurations {
devDebugCompile
devSignedDebugCompile
devPreReleaseCompile
devReleaseCompile
prodDebugCompile
prodSignedDebugCompile
prodPreReleaseCompile
prodReleaseCompile
}
android {
def globalConfiguration = rootProject.extensions.getByName("ext")
compileSdkVersion globalConfiguration.getAt("androidCompileSdkVersion")
buildToolsVersion globalConfiguration.getAt("androidBuildToolsVersion")
defaultConfig {
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
targetSdkVersion globalConfiguration.getAt("androidTargetSdkVersion")
versionCode globalConfiguration.getAt("androidVersionCode")
applicationId globalConfiguration.getAt("androidApplicationId")
testInstrumentationRunner globalConfiguration.getAt("testInstrumentationRunner")
testApplicationId globalConfiguration.getAt("testApplicationId")
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
dexOptions {
jumboMode true
javaMaxHeapSize "6g"
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
lintOptions {
quiet true
abortOnError false
ignoreWarnings true
disable 'InvalidPackage' //Some libraries have issues with this.
disable 'OldTargetApi'
//Lint gives this warning but SDK 20 would be Android L Beta.
disable 'IconDensities' //For testing purpose. This is safe to remove.
disable 'IconMissingDensityFolder' //For testing purpose. This is safe to remove.
}
signingConfigs {
debug {
storeFile file('../buildsystem/debug.keystore')
storePassword 'android'
keyAlias '********'
keyPassword '******'
}
signedDebug {
storeFile file('../buildsystem/keystore_medikoe.jks')
storePassword '*********'
keyAlias '*********'
keyPassword '**********'
}
preRelease {
storeFile file('../buildsystem/keystore_medikoe.jks')
storePassword '**********'
keyAlias '******'
keyPassword '********'
}
release {
storeFile file('../buildsystem/keystore_medikoe.jks')
storePassword '************'
keyAlias '**********'
keyPassword '************'
}
}
dataBinding {
enabled = false
}
flavorDimensions "default"
productFlavors {
dev {
// Enable pre-dexing to produce an APK that can be tested on
// Android 5.0+ without the time-consuming DEX build processes.
minSdkVersion 19
}
prod {
// The actual minSdkVersion for the production version.
minSdkVersion globalConfiguration.getAt("androidMinSdkVersion")
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
applicationIdSuffix ".debug"
resValue "string", "app_name", "Connect-D"
buildConfigField "boolean", "PRE_RELEASE", "false"
}
signedDebug {
minifyEnabled true
zipAlignEnabled true
shrinkResources true
debuggable true
signingConfig signingConfigs.signedDebug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".signeddebug"
resValue "string", "app_name", "Connect-SD"
buildConfigField "boolean", "PRE_RELEASE", "false"
}
preRelease {
minifyEnabled true
zipAlignEnabled true
shrinkResources true
debuggable false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".prerelease"
resValue "string", "app_name", "Connect-PR"
buildConfigField "boolean", "PRE_RELEASE", "true"
}
release {
minifyEnabled true
zipAlignEnabled true
shrinkResources true
debuggable false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Medikoe Connect"
buildConfigField "boolean", "PRE_RELEASE", "false"
}
}
}
dependencies {
def presentationDependencies = rootProject.ext.presentationDependencies
def presentationTestDependencies = rootProject.ext.presentationTestDependencies
def developmentDependencies = rootProject.ext.developmentDependencies
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27+'
compile project(':Domain')
devDebugCompile project(path: ':Data')
devSignedDebugCompile project(path: ':Data')
devPreReleaseCompile project(path: ':Data')
devReleaseCompile project(path: ':Data')
prodDebugCompile project(path: ':Data')
prodSignedDebugCompile project(path: ':Data')
prodPreReleaseCompile project(path: ':Data')
prodReleaseCompile project(path: ':Data')
devDebugCompile project(path: ':Infrastructure')
devSignedDebugCompile project(path: ':Infrastructure')
devPreReleaseCompile project(path: ':Infrastructure')
devReleaseCompile project(path: ':Infrastructure')
prodDebugCompile project(path: ':Infrastructure')
prodSignedDebugCompile project(path: ':Infrastructure')
prodPreReleaseCompile project(path: ':Infrastructure')
prodReleaseCompile project(path: ':Infrastructure')
//compile files('libs/date4j.jar')
//compile files('libs/commons-collections4-4.1.jar')
annotationProcessor presentationDependencies.daggerCompiler
compile presentationDependencies.dagger
compile presentationDependencies.rxJava
compile presentationDependencies.rxAndroid
provided presentationDependencies.javaxAnnotation
//compile presentationDependencies.autoFactory
compile presentationDependencies.butterKnife
annotationProcessor presentationDependencies.butterKnifeCompiler
compile presentationDependencies.designLibrary
compile presentationDependencies.recyclerView
compile presentationDependencies.cardView
compile presentationDependencies.percent
compile presentationDependencies.glide
compile presentationDependencies.glideOkhttp3
compile presentationDependencies.nineOldAndroids
//compile presentationDependencies.ahBottomNav
//compile presentationDependencies.lapismSearch
//compile presentationDependencies.FragmentNavigator
compile presentationDependencies.flexibleDivider
compile presentationDependencies.materialDialogsCore
compile presentationDependencies.materialFavoriteButton
compile presentationDependencies.fancyButtons
compile presentationDependencies.simpleRatingBar
compile presentationDependencies.circularImageView
compile presentationDependencies.waveLoadingView
compile presentationDependencies.googleAutoFactory
annotationProcessor presentationDependencies.googleAutoFactory
compile presentationDependencies.playServicesPlaces
compile presentationDependencies.playServicesLocation
//compile presentationDependencies.tagGroup
//compile presentationDependencies.expandableTextView
//compile presentationDependencies.expandableLayout
//compile presentationDependencies.touchImageView
//compile presentationDependencies.sublimePicker
compile presentationDependencies.rxpermissions
compile presentationDependencies.rxActivityResult
compile presentationDependencies.rxBinding
compile presentationDependencies.rxPaparazzo
compile presentationDependencies.rxBinding
compile presentationDependencies.parcelerApi
annotationProcessor presentationDependencies.parceler
compile presentationDependencies.guava
compile presentationDependencies.weekView
compile presentationDependencies.jodaTime
compile presentationDependencies.rxPaparazzo
//compile presentationDependencies.collection
compile presentationDependencies.RecyclerViewPager
//compile presentationDependencies.googleAnalytics
compile presentationDependencies.SpotsProgressDialog
compile presentationDependencies.CustomActivityOnCrash
compile presentationDependencies.multiDex
compile presentationDependencies.SaripaarVersion
//compile presentationDependencies.RazorPay
compile presentationDependencies.Timecon
compile presentationDependencies.ClansFab
compile presentationDependencies.MPAndroidChart
compile presentationDependencies.FragNav
compile presentationDependencies.CircularFillableLoaders
compile presentationDependencies.AvatarImageView
compile presentationDependencies.AVLoadingIndicatorView
compile presentationDependencies.Epoxy
annotationProcessor presentationDependencies.EpoxyProcessor
compile presentationDependencies.RelativeTimeTextView
//compile presentationDependencies.AudioPlayerView
compile presentationDependencies.EasyVideoPlayer
compile presentationDependencies.ThreeTenAndroid
//compile presentationDependencies.Steppers
//compile presentationDependencies.RxAccountManager
compile presentationDependencies.MaterialProgressBar
compile presentationDependencies.FloatingView
// compile presentationDependencies.HashtagView{
// //Guava appears to be included explicitly in the list-services.jar
// //Skip the redundant dependency
// exclude group: 'com.google.guava'
// }
compile('com.github.greenfrvr:hashtag-view:1.3.1#aar') {
transitive = false
}
androidTestCompile presentationTestDependencies.mockito
androidTestCompile presentationTestDependencies.dexmaker
androidTestCompile presentationTestDependencies.dexmakerMockito
androidTestCompile presentationTestDependencies.espresso
androidTestCompile presentationTestDependencies.testingSupportLib
androidTestCompile presentationTestDependencies.androidAnnotations
androidTestCompile presentationTestDependencies.autoFactory
// androidTestCompile presentationTestDependencies.guava
//Development
compile developmentDependencies.leakCanary
compile developmentDependencies.DebugDatabase
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile('com.razorpay:checkout:1.4.4')
compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
compile 'com.github.florent37:materialtextfield:1.0.7'
compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
compile('com.github.ganfra:material-spinner:2.0.0')
compile 'com.wdullaer:materialdatetimepicker:3.5.0'
compile 'com.myhexaville:smart-image-picker:1.0'
compile 'com.github.blikoon:QRCodeScanner:0.1.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.IntruderShanky:Frisson:2.1.1'
compile 'com.jsibbold:zoomage:1.1.0'
compile 'com.github.emrekose26:PinchZoom:-SNAPSHOT'
compile 'com.ablanco.zoomy:zoomy:1.0.0'
compile 'xyz.danoz:recyclerviewfastscroller:0.1.3'
compile 'com.irozon.sneaker:sneaker:1.0.2'
compile 'com.kyanogen.signatureview:signature-view:1.2'
compile 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.takusemba:multisnaprecyclerview:1.3.3'
compile 'com.github.chahine:pageindicator:0.2.6'
compile 'com.github.florent37:tutoshowcase:1.0.1'
implementation 'io.supercharge:shimmerlayout:2.1.0'
compile 'com.github.yeriomin:play-store-api:0.19'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.github.antonKozyriatskyi:CircularProgressIndicator:1.0.5'}
configurations.all {
exclude group: 'com.android.support', module: 'support-v13'
}
apply plugin: 'com.google.gms.google-services'
To me what worked was to move google() before jcenter() both on buildscript and on allprojects's repositories element.
In your case:
repositories {
maven {
url 'https://maven.google.com'
}
jcenter()
// Add your other repositories here
}
I also tried the following and both work for me:
repositories {
google()
jcenter()
// Add your other repositories here
}
Silly Mistake , Just make sure you are using
maven { url 'https://maven.google.com' }
above
jcenter()
Thats the problem it was throwing Searched in the following locations: https://jcenter.bintray.com/com/android/support/multidex/1.0.2/multidex
Since you are developing using Android Studio 3.1.3, try to update your build.gradle dependencies and plugin as well to their latest version.
And move your repository google() to the buildscript.
You can try this:
Top-level build.gradle
apply from: 'buildsystem/dependencies.gradle'
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
//maven {
// url 'https://maven.google.com'
//}
}
dependencies {
//Update it to the latest version: 3.1.3
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.5'
classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
allprojects {
ext {
androidApplicationId = 'com.medikoe.connect'
androidVersionCode = 23
androidVersionName = "1.7.2"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
testApplicationId = 'com.medikoe.test'
}
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Remove these lines
// repositories {
// google()
// }
Some other tips:
For your app build.gradle, try to change compile to implementation, since it will be deprecated soon.
for any one who encounters this problem nowadays just put google() before any other repositories, both in buildscrript repositories and allprojects respository inside project level build.gradle file
The error
My 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'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile project(':venuemap')
// compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
// compile "com.android.support:support-v4:$rootProject.supportLibraryVersion"
// compile "com.android.support:design:$rootProject.supportLibraryVersion"
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
// compile "com.google.android.gms:play-services:$rootProject.playServicesVersion"
compile "com.google.android.gms:play-services-location:$rootProject.playServicesVersion"
compile "com.google.android.gms:play-services-maps:$rootProject.playServicesVersion"
compile "com.google.android.gms:play-services-plus:$rootProject.playServicesVersion"
compile "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
compile "com.squareup.okhttp3:okhttp:$rootProject.okhttpVersion"
compile "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttpVersion"
compile 'com.google.maps.android:android-maps-utils:0.4.4'
// compile 'com.google.maps.android:android-maps-utils:0.4+'
// compile 'com.google.maps.android:android-maps-utils:0.5+'
compile 'net.hockeyapp.android:HockeySDK:4.1.1'
compile 'com.flurry.android:analytics:6.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'org.parceler:parceler-api:1.1.9'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.android.support:multidex:1.0.0'
compile "com.google.firebase:firebase- core:$rootProject.playServicesVersion"
compile 'com.facebook.android:facebook-android-sdk:4.+'
// annotationProcessor 'org.parceler:parceler:1.1.9'
compile('com.crashlytics.sdk.android:answers:1.4.0#aar') {
transitive = true;
}
}
android {
def defaultApplicationId = "com.yamo.android"
def defaultVersionName = "1.1.7"
def buildNumber = "53" // increment when merging with master
def defaultVersionCode = Integer.parseInt(buildNumber)
def buildNumberSuffix = " (" + buildNumber + ")"
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
applicationId defaultApplicationId
versionCode defaultVersionCode
versionName defaultVersionName
vectorDrawables.useSupportLibrary = true
// multiDexEnabled true
}
signingConfigs {
debug {
storeFile rootProject.file("keystore/debug.keystore")
}
release {
storeFile rootProject.file("keystore/release.keystore")
storePassword "password"
keyAlias "locassa"
keyPassword "password"
}
}
buildTypes {
debug {
minifyEnabled true
useProguard false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
useProguard true
shrinkResources true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
live {
versionName defaultVersionName + buildNumberSuffix
}
client {
versionName defaultVersionName + "-CLIENT" + buildNumberSuffix
applicationId defaultApplicationId
}
internal {
versionName defaultVersionName + "-INTERNAL" + buildNumberSuffix
applicationId defaultApplicationId + ".internal"
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
}
//apply from:
rootProject.file('config/checkstyle/checkstyle.gradle')
apply plugin: 'com.google.gms.google-services'
}
When building app, I have got this error.
I am using android studio 2.3.3.
CompileSdkVersion is 26 and buildToolsVersion is 26.0.2.
And my gradle version is 2.3.3.
I have been searching the solution about this problem for several days but I didn't find anything on google.
Please help me to resolve this error. Thanks a lot!
This is your Problem :
compile 'com.facebook.android:facebook-android-sdk:4.+'
Use this :
compile 'com.facebook.android:facebook-android-sdk:4.4.0'
This is thrown when trying to open activity using context.startActivity(intent)
java.lang.TypeNotPresentException: Type android/support/v4/app/ActivityCompat$SharedElementCallback23Impl not present
All activities extends AppCompatActivity and I am calling AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) inside a static block of my application.
On newer android versions everyting is ok.
Does anybody met this issue and can share info how to solve it?
Here my gradle configuration
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
lintOptions {
disable 'RestrictedApi'
}
signingConfigs {
release {
keyAlias '****'
keyPassword '*************'
storeFile file('../release.jks')
storePassword '*************'
}
}
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "***.****"
minSdkVersion 19
targetSdkVersion 26
versionCode 8
versionName "1.0.3"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
renderscriptTargetApi 26
renderscriptSupportModeEnabled true
signingConfig signingConfigs.release
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
jcenter()
}
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':googleemoji')
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude module: 'httpclient'
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.http-client:google-http-client-gson:1.22.0') {
exclude module: 'httpclient'
}
compile('com.google.apis:google-api-services-gmail:v1-rev44-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile 'com.google.firebase:firebase-auth:11.4.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.android.gms:play-services-identity:11.4.0'
compile 'com.google.firebase:firebase-messaging:11.4.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'
compile 'com.google.android.gms:play-services-plus:11.4.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'commons-io:commons-io:2.5'
compile 'com.google.android.gms:play-services-location:11.4.0'
compile 'com.google.firebase:firebase-invites:11.4.0'
}
kotlin {
experimental {
coroutines "enable"
}
}
apply plugin: 'com.google.gms.google-services'
The app that we are working on is not very large - most of it is an empty application that gets filled in from various endpoints (server side), but we currently have 18 separate flavors of the app that get built.
The issue is, there will be 78 flavors of the application built and if the build time is linear, we are looking at about 11 hours per ./gradlew build request.
Im not well versed in Gradle at all and I was hoping you guys could help me find some problem areas that might be able to improve our build times
Here is the build.gradle:
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'io.fabric'
apply from: '../jacoco.gradle'
apply from: '../flavors.gradle'
apply from: '../autoTasks.gradle'
ext {
applicationName = 'OurApp'
supportLibVersion = '25.3.0'
playServicesVersion = '9.6.1'
}
android {
signingConfigs {
debug {
keyAlias 'key'
keyPassword 'pass'
storeFile file('../file.keystore')
storePassword 'pass'
}
release {
keyAlias 'key'
keyPassword 'pass'
storeFile file('../file.jks')
storePassword 'pass'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
vectorDrawables.useSupportLibrary true
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
multiDexEnabled true
}
dataBinding {
enabled true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField 'String', 'DFP_NETWORK_ID', '"id"'
buildConfigField 'String', 'YOUTUBE_API_KEY', '"ourkey"'
}
debug {
signingConfig signingConfigs.debug
testCoverageEnabled = true
buildConfigField 'String', 'DFP_NETWORK_ID', '"id"'
buildConfigField 'String', 'YOUTUBE_API_KEY', '"anotherKey"'
}
debuggable.initWith(buildTypes.debug)
debuggable {
testCoverageEnabled = false
}
}
dexOptions {
javaMaxHeapSize "4g"
}
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
createZipProguardTask(variant);
}
updateApkName(variant);
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
annotationProcessor 'com.bluelinelabs:logansquare-compiler:1.3.7'
annotationProcessor 'com.squareup:javapoet:1.8.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile "com.android.support:support-v13:${supportLibVersion}"
compile "com.android.support:percent:${supportLibVersion}"
compile "com.android.support:preference-v14:${supportLibVersion}"
compile "com.google.android.gms:play-services-gcm:${playServicesVersion}"
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile "com.google.firebase:firebase-core:${playServicesVersion}"
compile "com.google.firebase:firebase-messaging:${playServicesVersion}"
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.roughike:bottom-bar:2.2.0'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.l4digital.rxloader:rxloader:2.0.1'
compile 'com.bluelinelabs:logansquare:1.3.7'
compile 'com.github.aurae.retrofit2:converter-logansquare:1.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.google.dagger:dagger:2.7'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true
}
compile(name:'googlemediaframework-release', ext:'aar')
compile "com.google.android.gms:play-services-ads:${playServicesVersion}"
compile "com.google.android.gms:play-services-analytics:${playServicesVersion}"
compile 'com.flurry.android:ads:6.2.0'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.google.android.exoplayer:exoplayer:r1.5.14'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.5.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
debuggableCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.squareup.okhttp3:okhttp:3.5.0'
androidTestCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile('com.android.support.test:rules:0.5') {
exclude module: 'support-annotations'
}
androidTestCompile (name:'cloudtestingscreenshotter_lib', ext:'aar')
androidTestCompile('com.android.support.test:runner:0.5') {
exclude module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2') {
exclude module: 'support-annotations'
}
compile(name:'MapSDK', ext:'aar')
compile('com.twitter.sdk.android:twitter:2.3.2#aar') {
transitive = true;
}
}
def createZipProguardTask(variant) {
def prefix = project.ext.applicationName;
if (project.hasProperty('buildNumber')) {
prefix += '-' + project.getProperties().get('buildNumber');
}
def taskName = variant.flavorName.substring(0, 1).toUpperCase() + variant.flavorName.substring(1);
task("zipProguard${taskName}", type: Zip) {
archiveName = "${prefix}-${variant.flavorName}-proguard.zip";
from "build/outputs/mapping/${variant.flavorName}/release"
destinationDir file('build/outputs/mapping')
}
}
def updateApkName(variant) {
def prefix = project.ext.applicationName;
if (project.hasProperty('buildNumber')) {
prefix += '-' + project.getProperties().get('buildNumber');
}
variant.outputs.each { output ->
def fileName = output.outputFile.name.replace('app', prefix);
def outputFile = new File(output.outputFile.parent.toString(), fileName.toString());
output.outputFile = outputFile;
}
}
Here is what we have in the gradle properties:
org.gradle.jvmargs=-Xmx4608M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.daemon=true
Any input would be greatly appreciated - like I said, I'm not well versed in gradle at all, so I'm open to anything.
Thank you in advance
I'm sure you figured something out by now, but just for future googlers -
Android Studio gradle takes too long to build improved the speed of my gradle build drastically. It suggests enabling Offline work in Android Studio by going to file>settings>build, execution, deployment>gradle and checking the "Offline work" option.
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.