There is an exception when using apply plugin: 'kotlin-kapt' and running Gradle to build my app:
Caused by: java.lang.ClassCastException: java.io.File cannot be cast to java.lang.String
at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.disableAnnotationProcessingInJavaTask(Kapt3KotlinGradleSubplugin.kt:293)
at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.buildOptions(Kapt3KotlinGradleSubplugin.kt:156)
at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.createKaptKotlinTask(Kapt3KotlinGradleSubplugin.kt:246)
at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.apply(Kapt3KotlinGradleSubplugin.kt:136)
at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.apply(Kapt3KotlinGradleSubplugin.kt:48)
at org.jetbrains.kotlin.gradle.plugin.SubpluginEnvironment.addSubpluginOptions(KotlinPlugin.kt:685)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin.processVariantData(KotlinPlugin.kt:452)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin.access$processVariantData(KotlinPlugin.kt:326)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin$apply$2.execute(KotlinPlugin.kt:370)
at org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPlugin$apply$2.execute(KotlinPlugin.kt:326)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy15.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
... 56 more
This exception happens on configuration phase:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
More info:
using Android Gradle Plugin 2.2.0 (tried 2.3.0, 2.+)
using Kotlin 1.1.1 (tried 1.0.4 - 1.0.5-3)
using Dagger 2.2 (tried 2.7)
using Realm 1.0 (tried newest version as well)
using Android Data Binding 2.2.0
using Retrolambda
not using Android-apt
Root build.gradle:
buildscript {
ext.kotlinVersion = '1.1.1'
ext.supportLibraryVersion = '23.2.1'
ext.androidPluginVersion = '2.2.0'
ext.testSupportLibraryVersion = '0.5'
ext.newRelicAgentLibraryVersion = '5.11.0'
ext.spekLibraryVersion = '1.0.89'
ext.okhttpVersion = '3.6.0'
ext.packetZoomVersion = '3.2.25'
ext.mockitoLibraryVersion = '1.10.19'
ext.powermockLibraryVersion = '1.6.2'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath "com.android.tools.build:gradle:$androidPluginVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'me.tatarka:gradle-retrolambda:3.3.0'
classpath 'io.fabric.tools:gradle:1.21.6'
classpath "io.realm:realm-gradle-plugin:1.0.0"
classpath "com.newrelic.agent.android:agent-gradle-plugin:$newRelicAgentLibraryVersion"
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'https://maven.fabric.io/public'
}
maven {
url "https://s3.amazonaws.com/repo.commonsware.com"
}
maven {
url "http://repository.jetbrains.com/all"
}
mavenLocal()
}
}
build.gradle for module app:
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'newrelic'
android {
compileSdkVersion 23
buildToolsVersion "25.0.2"
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
config
}
defaultConfig {
applicationId "com.example.android"
targetSdkVersion 23
signingConfig signingConfigs.config
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
javaMaxHeapSize "4g"
}
productFlavors {
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 16
}
}
buildTypes {
release {
minifyEnabled true
proguardFile 'proguard-support.pro'
proguardFile 'proguard-retrofit.pro'
proguardFile 'proguard-butterknife.pro'
proguardFile 'proguard-retrolambda.pro'
proguardFile 'proguard-crashlytics.pro'
proguardFile 'proguard-newrelic.pro'
proguardFile 'proguard-duktape.pro'
proguardFile 'proguard-packetzoom.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
retrolambda {
jvmArgs '-noverify'
}
if (project.hasProperty('releaseKeyStore') &&
project.hasProperty('releaseKeyPassword') &&
project.hasProperty('releaseKeyStorePassword') &&
project.hasProperty('releaseKeyAlias')) {
android.signingConfigs.config.keyAlias = releaseKeyAlias
android.signingConfigs.config.storeFile = file(releaseKeyStore)
android.signingConfigs.config.storePassword = releaseKeyStorePassword
android.signingConfigs.config.keyPassword = releaseKeyPassword
} else {
android.signingConfigs.config.keyAlias ""
android.signingConfigs.config.storeFile null
android.signingConfigs.config.storePassword ""
android.signingConfigs.config.keyPassword ""
}
testOptions {
unitTests.returnDefaultValues = true
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
}
kapt {
generateStubs = true
}
dependencies {
kapt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.8'
kapt 'com.google.dagger:dagger-compiler:2.2'
kapt "com.android.databinding:compiler:$androidPluginVersion"
kapt "io.realm:realm-annotations:1.0.0"
kapt "io.realm:realm-annotations-processor:1.0.0"
kapt 'com.jakewharton:butterknife:6.1.0'
kapt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile 'com.android.support:multidex:1.0.1'
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support:percent:$supportLibraryVersion"
compile "com.android.support:gridlayout-v7:$supportLibraryVersion"
compile "com.android.support:cardview-v7:$supportLibraryVersion"
compile "com.android.support:customtabs:$supportLibraryVersion"
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'io.reactivex:rxjava:1.1.4'
compile 'com.jakewharton.rxbinding:rxbinding:0.1.0'
compile 'com.trello:rxlifecycle:0.5.0'
compile 'com.trello:rxlifecycle-components:0.5.0'
compile 'com.trello:rxlifecycle-kotlin:0.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.dagger:dagger:2.2'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'me.relex:circleindicator:1.1.3#aar'
compile 'com.jakewharton.timber:timber:3.0.2'
compile 'com.cocosw:bottomsheet:1.+#aar'
compile "com.newrelic.agent.android:android-agent:$newRelicAgentLibraryVersion"
compile "com.newrelic.agent.android:class-rewriter:$newRelicAgentLibraryVersion"
compile 'me.tatarka:bindingcollectionadapter:0.15'
compile 'me.tatarka:bindingcollectionadapter-recyclerview:0.15'
compile 'com.github.pwittchen:reactivenetwork:0.1.3'
compile 'org.apmem.tools:layouts:1.10#aar'
compile 'com.sothree.slidinguppanel:library:3.2.1'
compile 'com.squareup.duktape:duktape-android:0.9.5'
compile 'com.commonsware.cwac:provider:0.4.1'
compile "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:converter-scalars:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile "com.packetzoom:pz-android-sdk:$packetZoomVersion"
compile "com.packetzoom:pz-okhttp3-interceptor:$packetZoomVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile 'org.jetbrains.kotlinx:kotlinx-support-jdk7:0.1'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.github.lukaspili.autodagger2:autodagger2:1.1'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.squareup.flow:flow:1.0.0-alpha2-SNAPSHOT'
testCompile 'junit:junit:4.12'
testCompile 'pl.pragmatists:JUnitParams:1.0.4'
testCompile "org.mockito:mockito-core:$mockitoLibraryVersion"
testCompile "org.powermock:powermock-api-mockito:$powermockLibraryVersion"
testCompile "org.powermock:powermock-module-junit4:$powermockLibraryVersion"
testCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
testCompile "org.jetbrains.spek:spek-api:$spekLibraryVersion"
testCompile "org.jetbrains.spek:spek-junit-platform-engine:$spekLibraryVersion"
testCompile 'org.junit.platform:junit-platform-runner:1.0.0-M2'
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
testCompile 'com.natpryce:hamkrest:1.2.3.0'
androidTestCompile "com.android.support.test:runner:$testSupportLibraryVersion"
androidTestCompile "com.android.support.test:rules:$testSupportLibraryVersion"
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile "org.mockito:mockito-core:$mockitoLibraryVersion"
androidTestCompile 'org.hamcrest:hamcrest-integration:1.3'
androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile "com.android.support:support-annotations:$supportLibraryVersion"
}
// Plugin declared at the bottom of the build.gradle file according to requirements described in documentation:
// https://developers.google.com/android/guides/google-services-plugin#introduction
apply plugin: 'com.google.gms.google-services'
How do I fix the issue?
It turns out that I've been mis-applying Realm plugin, so that the issue is in order of plugin application. Realm's plugin should be applied after Kotlin's ones:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
That solved the issue for me.
Related
I recently had a lot of problems trying to debug in my application when using Retrolambda, because of that I wanted to include Jack on my Gradle for debugging purposes.
jackOptions {
enabled true
}
Because of that, I have been going through this error and I still without finding a way to solve it.
Jackson : NoSuchMethodError for com.google.common.base.Preconditions.checkState
I have check different posts looking for a solution:
Android Studio: Gradle - build fails -- Execution failed for task ':dexDebug'
Lambda expressions crash with IncompatibleClassChangeError in Android when using jack
A larger heap for the Gradle daemon is recommended for running jack
But none of the solutions have fixed my problems. Right now my Gradle looks like:
buildscript {
ext {
use_jack = true
dagger_version = "2.8"
firebase_version = "9.6.1"
rx_version = "2.0.3"
rx_firebase_version = "1.0.0"
rx_android_version = "2.0.1"
gson_version = "2.8.0"
butterkinfe_version = "8.4.0"
support_version = "25.0.0"
target_sdk_version = 24
}
}
apply plugin: 'com.android.application'
if (!use_jack) { //Backport to apt / RetroLambda
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.myaplicattion"
minSdkVersion 15
targetSdkVersion project.properties.target_sdk_version
versionCode 1
versionName "0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled use_jack
}
}
buildTypes {
debug {
minifyEnabled false
testCoverageEnabled = true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//Support
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:design:$support_version"
//Util
compile 'com.intellij:annotations:12.0'
compile 'com.jakewharton.timber:timber:4.3.1'
compile "com.jakewharton:butterknife:$butterkinfe_version"
if (use_jack) annotationProcessor "com.jakewharton:butterknife-compiler:$butterkinfe_version"
else apt "com.jakewharton:butterknife-compiler:$butterkinfe_version"
compile 'com.github.mukeshsolanki:country-picker-android:1.1.6'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
//Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
//Firebase
// compile "com.firebaseui:firebase-ui-database:0.4.0"
compile "com.google.firebase:firebase-storage:$firebase_version"
compile "com.google.firebase:firebase-messaging:$firebase_version"
compile "com.google.firebase:firebase-common:$firebase_version"
compile "com.google.firebase:firebase-auth:$firebase_version"
compile "com.google.firebase:firebase-core:$firebase_version"
compile "com.google.firebase:firebase-database:$firebase_version"
compile "com.google.firebase:firebase-crash:$firebase_version"
compile "com.github.frangsierra:rx2firebase:$rx_firebase_version"
//GSON
compile "com.google.code.gson:gson:$gson_version"
//Facebook
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
//Dagger
compile "com.google.dagger:dagger:$dagger_version"
if (use_jack) annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
else apt "com.google.dagger:dagger-compiler:$dagger_version"
//Rx
compile "io.reactivex.rxjava2:rxjava:$rx_version"
compile "io.reactivex.rxjava2:rxandroid:$rx_android_version"
//Test
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support.test:runner:0.5'
}
apply plugin: 'com.google.gms.google-services'
And my appgradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenLocal()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Dagger2 does not create classes Dagger*. I created the interface MyContainerComponent, but the class DaggerMyContainerComponent not created!
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath "com.android.databinding:dataBinder:1.0-rc4"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.6"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
in build.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.android.databinding'
apply plugin: 'kotlin-android'
apply plugin: 'com.frogermcs.androiddevmetrics'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.tegra.module.profile"
minSdkVersion 15
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'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
kapt 'com.android.databinding:compiler:1.0-rc4'
//dagger
compile 'com.google.dagger:dagger:2.8'
apt 'com.google.dagger:dagger-compiler:2.8'
provided 'javax.annotation:jsr250-api:1.0'
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
//rxAndroid
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
//autoFactory
compile group: 'com.google.auto.factory', name: 'auto-factory', version: '1.0-beta3'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile group: 'com.squareup.retrofit2', name: 'adapter-rxjava', version: '2.1.0'
//OkHttp
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
//timber
compile 'com.jakewharton.timber:timber:4.5.1'
//stetho
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
//constraint-layout
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}
kapt {
generateStubs = true
}
MyContainerComponent.kt
package com.tegra.module.profile.ioc
#Component(modules = arrayOf(ProfileModule::class))
#Singleton
public interface MyContainerComponent {
fun inject(profileActivity: ProfileActivity)
}
ProfileModule.kt
package com.tegra.module.profile.bl.di
#Module
class ProfileModule(val application: Application) {
#Provides
#Singleton
fun provideApplication(): Application {
return application
}
#Provides
#Singleton
fun provideContext(): Context {
return application
}
}
Any solutions? Already tried to: change gradle version, Clean, Rebuild, Change dependecy versions, also deleting the Gradle cache and reinstalling Android Studio.
In order to use Dagger annotations in Kotlin files you have to use kapt for Dagger compiler:
kapt 'com.google.dagger:dagger-compiler:2.8'
Also, delete all apt dependencies because kapt handles annotations in Java too.
Official docs
When i use ./gradlew assembleDebug and generate debug version of application it's install correctly but when i use ./gradlew assembleRelease and generate release version app couldn't be install in android v.6 "Marshmallow".whats wrong with this? this my gradle.build 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'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
signingConfigs {
config {
keyAlias 'eCommerce Social Network'
keyPassword '*****************'
storeFile file('/home/saeed/Keys/ShareIno/sharino.jks')
storePassword '!##$s#EED 13710554$##!'
}
}
defaultConfig {
applicationId "com.shareino.android"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
}
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
maven { url "https://jitpack.io" }
}
//compile 'com.labo.kaji:fragmentanimations:0.1.0'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-messaging:9.2.1'
compile 'com.google.android.gms:play-services-auth:9.2.1'
androidTestCompile 'com.android.support:support-annotations:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.squareup.okhttp:logging-interceptor:2.7.0'
compile 'com.squareup.retrofit:converter-jackson:2.0.0-beta2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
compile 'com.appsee:appsee-android:+'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
My Android app is running on Android Lollipop and Marshmallow version but when i run it on API 19 it gives exception
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions exception
I am not using any firebase in may application. I search some related problem on Internet and apply in my app but right now i could not found any solution. Please help me
below is my top gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
below is my app 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' }
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.dp.needdepartmentalstore"
minSdkVersion 14
targetSdkVersion 23
versionCode 29
versionName "5.16"
multiDexEnabled true
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "16c778cf-8ebc-47a8-9ba8-6815f0223a0e",
onesignal_google_project_number: "253919422974"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.mikepenz:actionitembadge:3.1.8#aar') {
transitive = true
}
compile('com.weiwangcn.betterspinner:library-material:1.1.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile project(':niceSpinner')
compile files('libs/PGSDK_v1.0.jar')
compile files('libs/App42_ANDROID_SDK_3.8.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile('com.instabug.library:instabugsupport:1+') {
exclude group: 'com.mcxiaoke.volley', module: 'library'
}
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.bignerdranch.android:expandablerecyclerview:2.0.3'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.miguelcatalan:materialsearchview:1.3.0'
compile 'com.wdullaer:materialdatetimepicker:2.0.2'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
//compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.intuit.sdp:sdp-android:1.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
I'm getting an error in Android Studio 1.5.1 and I can't figure it out for the life of me. It reads,
"Error:Execution failed for task ':app:dexguardDebug'.
No such property: bootClasspath for class: com.android.builder.core.AndroidBuilder"
When running ./gradle2 debugCompile --stacktrace from the command line, it shows this:
What went wrong:
Task 'compileDebug' is ambiguous in root project 'BestWestern'.
Candidates are: 'compileDebugAidl', 'compileDebugAndroidTestAidl',
'compileDebugAndroidTestJavaWithJavac', 'compileDebugAndroidTestNdk',
'compileDebugAndroidTestRenderscript',
'compileDebugAndroidTestSources', 'compileDebugJavaWithJavac',
'compileDebugNdk', 'compileDebugRenderscript', 'compileDebugSources',
'compileDebugUnitTestJavaWithJavac', 'compileDebugUnitTestSources'.
I'm not exactly sure what to do from this point
Here are my grade files:
//////////////////////
// Module: app
//////////////////////
apply plugin: 'com.android.application'
apply plugin: 'dexguard'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bestwestern.android"
minSdkVersion 14
targetSdkVersion 23
versionCode 143
versionName "5.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
/*release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}*/
debug {
proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
proguardFile 'dexguard-project.txt'
proguardFile 'proguard-project.txt'
}
release {
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.txt'
proguardFile 'proguard-project.txt'
}
}
packagingOptions {
exclude 'LICENSE.txt'
}
/*productFlavors {
}*/
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
dependencies {
//compile 'com.android.support:multidex:1.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.google.android.gms:play-services-location:7.0.0'
compile project(':androidtimessquare')
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
//compile 'com.squareup.picasso:picasso:2.+'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'de.hdodenhof:circleimageview:1.2.2'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'de.greenrobot:eventbus:2.4.0'
//compile(name: 'masterpass-android-library-release', ext: 'aar')
// AndroidJUnit Runner dependencies
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
// Espresso dependencies
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
compile files('libs/adobeMobileLibrary-4.6.1.jar')
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
//compile 'org.twitter4j:twitter4j-core:4.0.2'
compile('com.twitter.sdk.android:tweet-composer:0.8.0#aar') {
transitive = true;
}
compile 'com.github.bumptech.glide:glide:3.6.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile project(':googlemapssdkm4b_lib')
compile files('libs/RootShell.jar')
//compile files('libs/dexguard-util.jar')
}
//////////////////////
// Project:
//////////////////////
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
mavenCentral()
flatDir dirs: 'lib'
}
dependencies {
/*classpath ('com.android.tools.build:gradle:1.0.0') {
exclude module: 'proguard-gradle'
}
classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1"
classpath ('net.sf.proguard:proguard-gradle:5.0') {
force = true
}*/
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:1.5.0'
classpath ':dexguard:'
}
}
allprojects {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
}
This will be most likely caused incompatible versions of Android Gradle Plugin and DexGuard library. Try to downgrade a version of Android Gradle Plugin to 1.3.1.
Could I ask which version of DexGuard are you using?