Dagger2 do not generate Dagger classes - android

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

Related

Configuration 'compile' with android.enableAapt2

When press try again show me some problems.
These are the settings I used in the build.gradle of my application:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId 'com.abc.callrecorder'
minSdkVersion 15
targetSdkVersion 26
versionCode 2
versionName '1.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:11.6.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.gu:option:1.3'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.yqritc:recyclerview-flexibledivider:1.4.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.microsoft.onedrivesdk:onedrive-picker-android:v2.0'
implementation 'com.alimuzaffar.lib:pinentryedittext:1.3.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jaredrummler:android-device-names:1.1.4'
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.jakewharton:butterknife:6.0.0'
implementation 'com.github.AmniX:MaterialPatternllockView:7a45dcaa79'
implementation 'com.scottyab:aescrypt:0.0.1'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-iid:17.0.0'
implementation 'com.google.firebase:firebase-iid-interop:16.0.1'
implementation 'com.google.firebase:firebase-messaging-license:12.0.1'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
These are the setting in build.gradle application:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
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()
maven {
url "https://maven.google.com"
}
maven { url "https://jitpack.io" }
maven { url 'http://guardian.github.com/maven/repo-releases' }
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
These are mistakes :
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2=true' to remove this warning. It
will be removed at the end of 2018..
Configuration 'compile' is obsolete and has been replaced with
'implementation' and 'api'. It will be removed at the end of 2018. For
more information see:
http://d.android.com/r/tools/update-dependency-configurations.html

Cannot resolve symbol MyObjectBox

I am using object box version 1.1.0. Installed with instructions given in documentation of ObjectBox, but getting this error. Even I searched this issue in FAQ section of Objectbox, the solution they provide is to remove android-apt. But in gradle file there is no android-apt used. So, how to overcome this issue please help me. Bellow is my root level gradle file
buildscript {
ext {
_buildToolsVersion = '26.0.1'
_compileSdkVersion = 26
objectboxVersion = '1.1.0'
}
repositories {
jcenter()
mavenCentral()
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
}
}allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven { url "http://objectbox.net/beta-repo/"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The app gradle file is below
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.kingof.android"
minSdkVersion 16
targetSdkVersion 25
versionCode 3
versionName "1.001"
multiDexEnabled = true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
lintOptions {
disable 'ValidFragment'
}
}
repositories{
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:1.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
compile 'com.patrickpissurno:ripple-effect:1.3.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.snatik:storage:2.1.0'
compile 'jp.wasabeef:glide-transformations:2.0.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile "io.objectbox:objectbox-android:$objectboxVersion"
}apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.objectbox'
MyObjectBox class is generated during build and I think you need to have at least one model file with #Entity annotation for it to be generated.
I faced the same issue. In my case, I did not declare the #PrimaryKey attribute in the #Entity class.
#Entity
public class Subject {
#PrimaryKey // This line was missing
#SerializedName("id")
#Expose
private int id;
#SerializedName("title")
#Expose
private String title;
}
I was having the same bug, but it was for a very different reason, I had an entity class in a higher level package than the ObjectBox class was, so putting any class with the #Entity tag in the same package or lower than the ObjectBox class solved my problem

Kapt3: java.io.File cannot be cast to java.lang.String

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.

Problems when running application with Jack and Retrolambda

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
}

java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions exception in API 19

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'

Categories

Resources