I have updated my android studio to 3.4.
I am getting error while making release build.
Unable to find method
'com.android.tools.r8.Version.getVersionString()Ljava/lang/String;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after
a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping
all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible
with the other plugins in the project or the version of Gradle
requested by the project.
In the case of corrupt Gradle processes, you can also try closing the
IDE and then killing all Java processes.
I have updated my dependencies in gradle
Here is my gradle file
dependencies {
//Retrofit networking libraries
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
//Use for converting JsonObject to Plain Text in retrofit
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
//http logging interceptor
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
// For circular progressbar design
implementation 'me.relex:circleindicator:1.2.2#aar'
//Crashlytics library dependency
implementation('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
//ViewModel concept used in
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:livedata-core:1.1.1'
//RangeSeekBar Design
implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-library:0.1.0'
//Clevertap events
implementation 'com.clevertap.android:clevertap-android-sdk:3.2.0'
//For volley networking library implementation
implementation 'com.android.volley:volley:1.1.0'
//For token passing classes
implementation 'com.auth0.android:jwtdecode:1.1.1'
//Rooted device finding library
implementation 'com.scottyab:rootbeer-lib:0.0.7'
//Facebook integration
implementation 'com.facebook.android:facebook-android-sdk:4.35.0'
//New Relic interation library
implementation 'com.newrelic.agent.android:android-agent:5.9.0'
//Calender library
implementation project(':library')
//Channel level encryption library
implementation files('libs/bcprov-jdk15on-160.jar')
//Injection tool
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
implementation 'com.jakewharton:butterknife:6.1.0'
/*annotationProcessor 'com.jakewharton:butterknife:10.1.0'
implementation 'com.jakewharton:butterknife:10.1.0'*/
//Image Loading library
implementation 'com.github.bumptech.glide:glide:3.7.0'
//Secure SQLite Database
implementation 'net.zetetic:android-database-sqlcipher:3.5.9#aar'
//Branch .io library
implementation('io.branch.sdk.android:library:2.+') {
exclude module: 'answers.shim'
}
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.google.android.gms:play-services:11.0.1'
implementation 'com.google.android.gms:play-services-maps:11.0.1'
implementation 'com.google.firebase:firebase-core:11.0.1'
implementation 'com.google.firebase:firebase-messaging:11.0.1'
implementation 'com.android.support:support-v4:26.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':mpointintegration')
}
I am not using kotlin.
I checked various resources like below but none worked
java.lang.NoSuchMethodError - Ljava/lang/String;)Ljava/lang/String;
Android Studio 3.0 - Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List'
also tried with
Re-download dependencies and sync project
&
Stop Gradle build processes (requires restart)
but none worked.
Project Level gradle File
// Top-level build file where you can add configuration options common
to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
maven { url "http://storage.googleapis.com/r8-releases/raw"}
}
dependencies {
classpath ('com.android.tools:r8:1.3.52' ) { transitive false }
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath "com.newrelic.agent.android:agent-gradle-plugin:5.9.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' }
google()
}
}
ext {
minSdkVersion = 15
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = '26.0.2'
sourceCompatibilityVersion = JavaVersion.VERSION_1_8
targetCompatibilityVersion = JavaVersion.VERSION_1_8
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext.deps = [
// Test dependencies
junit : 'junit:junit:4.10',
festandroid: 'com.squareup:fest-android:1.0.7',
robolectric: 'org.robolectric:robolectric:2.2',
intellijannotations: 'com.intellij:annotations:12.0'
]
The issue is that you have a fixed version dependency on R8 1.3.52:
classpath ('com.android.tools:r8:1.3.52' ) { transitive false }
And the com.android.tools.r8.Version method
public String getVersionString()
is only present in the R8 1.4 versions and above.
I assume that you are using a fixed version of R8 due to a bug fix in that version. However that should also be fixed in the latest version, so I suggest that you remove the fixed R8 version dependency and use what is shipped with Android Studio.
I solved it. From android studio 3.4 R8 versioning is added in android studio.
So i did some changes in my build.gradle file and gradle.properties file
In my app level build.gradle file in release section I added one line
useProguard false
& in gradle.properties file
android.enableR8=true
so it will use R8 Versioning to create my APK.
Incase if you dont want to use R8 versioning and want to continue with proguard then make
android.enableR8=false //in gradle.properties file
Hope this will help someone
Trying to create a simple app with FireStore and Google Authentication. Having problem with the gradle:
In project 'app' a resolved Google Play services library dependency
depends on another at an exact version (e.g. "[15.0. 1]", but isn't
being resolved to that version. Behavior exhibited by the library will
be unknown.
Dependency failing: com.google.android.gms:play-services-flags:15.0.1
-> com.google.android.gms:play-services-basement#[
15.0.1], but play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or
have transitive dependencies that lead to the art ifact with the
issue.
-- Project 'app' depends onto com.google.firebase:firebase-firestore#17.1.5
-- Project 'app' depends onto com.firebaseui:firebase-ui-auth#4.2.0
For extended debugging info execute Gradle from the command line with
./gradlew --info :app:assembleDebug to see the dep endency paths to
the artifact. This error message came from the google-services Gradle
plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding
"googleServices { disableVersionCheck = false }" to your b uild.gradle
file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "myapp.com"
minSdkVersion 19
targetSdkVersion 27
versionCode 11
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin
Project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
Can somebody help me?
There are many answers here for individual solutions that do not really get down to the problem. Here is how to solve this in general:
As the original log output suggests, it is useful to run the build in the terminal with the following command:
./gradlew --info assembleDebug
This will give you a list of all dependencies that are involved in the conflict. It looks similar to this (I removed the package name stuff to make it a bit more readable):
Dependency Resolution Help: Displaying all currently known paths to any version of the dependency: Artifact(groupId=com.google.firebase, artifactId=firebase-iid)
-- task/module dep -> firebase-analytics#17.2.0
---- firebase-analytics:17.2.0 library depends -> play-services-measurement-api#17.2.0
------ play-services-measurement-api:17.2.0 library depends -> firebase-iid#19.0.0
-- task/module dep -> firebase-core#17.2.0
---- firebase-core:17.2.0 library depends -> firebase-analytics#17.2.0
------ firebase-analytics:17.2.0 library depends -> play-services-measurement-api#17.2.0
-------- play-services-measurement-api:17.2.0 library depends -> firebase-iid#19.0.0
-- task/module dep -> play-services-measurement-api#17.2.0
---- play-services-measurement-api:17.2.0 library depends -> firebase-iid#19.0.0
-- task/module dep -> firebase-iid#19.0.0
-- task/module dep -> firebase-messaging#17.1.0
---- firebase-messaging:17.1.0 library depends -> firebase-iid#[16.2.0]
-- task/module dep -> com.pressenger:sdk#4.8.0
---- com.pressenger:sdk:4.8.0 library depends -> firebase-messaging#17.1.0
------ firebase-messaging:17.1.0 library depends -> firebase-iid#[16.2.0]
From this list you get to know 2 things:
Where is the conflicting depedency found
What versions of the conflicting dependency are set up
In my case the conflicting dependency is firebase-iid: It's either #19.0.0 or #16.2.0
To fix this you must define the top-level dependency of the wrong firebase-iid explicitly in your build.gralde.
So in the upper log you can see that there are 2 examples of an out-dated version of firebase-iid#16.2.0. One comes from -- task/module dep -> firebase-messaging#17.1.0 the other one from a third-party library (pressenger). We don't have influence on the third-party library, so nothing to do here.
But for the other dependency, we have to declare it explicitly with the correct version:
implementation 'com.google.firebase:firebase-messaging:20.0.0'
Now the build works again. Happy ending :)
There's a known bug with Google Services 4.2.0 that may cause this. Downgrading your google-services version to 4.1.0 in your project's build.gradle may resolve the issue
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.1.0' //decreased from 4.2.0
}
}
The problem was it was missing a dependency.
Adding com.google.firebase:firebase-auth solved the issue.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
// implementation'com.google.firebase:firebase-core:16.0.6'
// implementation'com.google.firebase:firebase-storage:16.0.5'
implementation'com.google.firebase:firebase-auth:16.1.0' => add this line
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
}
There was a bug related to google-services that was eventually fixed in version 4.3.3.
So you can either use 4.3.3 or the latest version (check here)
classpath 'com.google.gms:google-services:4.3.3' // or latest version
or downgrade to 4.1.0
classpath 'com.google.gms:google-services:4.1.0'
i added the latest version of firebase messaging to build.gradle (Module: app) in my project and problem solved
implementation 'com.google.firebase:firebase-messaging:20.0.0'
Your app/build.gradle might have these lemon color blocked on dependencies part in Android Studio like on the picture below,
These (lemon color blocks) mean it's not latest version of dependency. just put mouse on each block, then IDE (Android Studio) tells the numbers that have to be changed.
Updating all my Google Play Services libraries to the latest in ALL modules solved the issue for me. I don't see that you have any Google Play Services libraries, but I wanna leave this answer here to those that might find this useful.
My project was working fine (No build issues). All of a sudden, I got this error
"resolved Google Play services library dependency depends on another at an exact version.."
I figured out that it was because I was building offline.
If anyone gets the same error, check if you are building offline.
Thanks, but unfortunately, this didn't entirely work for me. I also had to add the following to my build.grade (Module:app)
implementation 'com.google.android.gms:play-services-flags:16.0.1'
implementation 'com.google.android.gms:play-services-basement:16.0.1'
The problem was fixed after upgrading this lib in my project's build.gradle:
classpath 'com.google.gms:google-services:4.3.3'
and these ones in the app module's build.gradle:
implementation 'com.google.firebase:firebase-core:17.3.0'
implementation 'com.google.firebase:firebase-messaging:20.1.5'
After this, use Android Studio's Clean menu
I am using One Signal and caught this error once a time.
The reason was:
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
to put apply plugin for one signal before 'com.android.application'.
Maybe this will be useful for some other apply plugin too.
Add FCM to your App added Lower dependency Then I changed the dependency to the latest version this problem has solved.
compile 'com.google.firebase:firebase-messaging:17.3.4'
to
implementation 'com.google.firebase:firebase-messaging:20.0.0'
None of the other answers worked for me. My use-case is with React-Native 61+ trying to setup FCM and Analytics. What worked for me was using the latest google-services in android/build.gradle
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
classpath "com.google.gms:google-services:4.3.3" // Need the latest here
}
And then adding the gradle dependencies to android/app/build.gradle required for the products I'm using (in my case Analytics and Cloud Messaging) from here
dependencies {
...
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
...
}
I just tried #live-love's accepted answer myself and agree with the approach.
It might be more precise, however, to correct your dependencies according to the latest Google Services library version.
For my case, it happened when I just added/activated a Firebase service to the app.
You need to follow the latest version in project and Gradle app.
My app/build.gradle
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//Android Support Design Library
implementation 'com.android.support:design:27.1.1'
//RecyclerView
implementation 'com.android.support:recyclerview-v7:27.1.1'
// Support multidex
implementation 'com.android.support:multidex:1.0.3'
// Firebase Core
// implementation 'com.google.firebase:firebase-core:16.0.1'
//Firebase Authentication
implementation 'com.google.firebase:firebase-auth:19.3.1'
// Firestore Firestore
implementation 'com.google.firebase:firebase-firestore:21.4.3'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
// glide
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
// Circle ImageView
implementation 'de.hdodenhof:circleimageview:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
My project's build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Don't forget to sync the Gradle again.
The working solution for me was to remove "firebase-auth" and add "firebase-core" dependency. But after a couple of project rebuilds I started experiencing another compilation issue so I had to add the "firebase-auth" dependency in addition to the "firebase-core" in order to make it work:
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
Add the line below in you Project's build.gradle (See image below)
classpath 'com.google.gms:google-services:4.3.3'
Then update your Firebase related packages by going to :
File > Project Structure > Dependencies > app
Update Firebase modules to latest version (See the image below)
In my case I am using :
implementation 'com.google.firebase:firebase-database:19.3.0'
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-messaging:20.1.7'
implementation 'com.google.firebase:firebase-core:17.4.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
Don't forget to add :
apply plugin: 'com.google.gms.google-services'
See my Module's build.gradle file below.
The ML Kit library had versioning problems in the latest release.
Google Play services library dependency depends on another at an exact version error (thrown by the google-services plugin)
Here is the link to the solution.
https://firebase.google.com/support/release-notes/android#bom_v25-8-0
This is new thing happen to me that If your network is not secure and you are getting prompt of Untrusted Certificate.
If you will Accept or Reject, It will give this error until your network will not be secure.
You can work offline by checking Setting -> Gradle -> Offline Mode
If you used song haesuk answer, you need to do it for both build.gradle Project (classpath in dependencies), and in build.gradle app (implementations). Also do the same if you change builds for any libraries imported to the app.
I use suggestions provided by android studio and it changed implementations but did not change dependencies hence during build, there was a conflict between the two and it gave me same error.
I replicated the issue when I accidentally added com.google.firebase:firebase-ml-vision twice with different versions.
I resolved it by simply clearing the app-level dependencies block leaving just the default Android dependencies like so:
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'androidx.multidex:multidex:2.0.0'
}
This worked for me!
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
classpath "com.google.gms:google-services:4.3.3" // Need the latest here
}
dependencies {
...
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
...
}
In my case updating the firebase-bom and play services library to their latest version solved the issue:
In app level gradle :
implementation platform('com.google.firebase:firebase-bom:30.3.2')
In project level gradle :
classpath 'com.google.gms:google-services:4.3.13'
My app uses API 19, I put a MapView inside of one of my layouts and added the google maps implementation. Now I'm getting a warning from gradle that I'm mixing versions.
Here is the warning:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-rc02, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc02 and com.android.support:support-media-compat:26.1.0 more... (Ctrl+F1)
Here are my gradle dependencies:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
The warning is showing for 'com.android.support:appcompat-v7:28.0.0-rc02'.
I'm unsure where to find the correct version to use for play-services-maps or how to resolve this issue properly. I do not want to downgrade my min version from 19.
Add this at the end of your build.gradle (:app)
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
details.useVersion '26.1.0'
}
}
}
the suggestion reads:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
this means, that you'd have to exclude 26.1.0 and provide 28.0.0-rc02 instead:
implementation "com.android.support:support-media-compat:28.0.0-rc02"
implementation "com.android.support:support-v4:28.0.0-rc02"
implementation ("com.google.android.gms:play-services-maps:15.0.1") {
exclude group: "com.google.android.gms", module: "support-media-compat"
exclude group: "com.android.support", module: "support-v4"
}
there might be further versions clashing, while fixing them works the same.
1.Go to project/.idea/libraries folder on your file system and see which libraries are different.
2.You will have to manually include these libraries with the same version in your build.gradle file.
3.Then, sync your project
In Your Case:-
implementation 'com.android.support:animated-vector-drawable:28.0.0-rc02'
You need to add Dependency :-
implementation 'com.android.support:support-media-compat:28.0.0-rc02'
//put this things in build.gradle(Project) file
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
google()
}
}
You need to fallow the below steps.
1- project/.idea/libraries
here you will see which library is different.
You can correct the different one according to your all libraries.
Then, sync your project.
Just add this lins
implementation 'com.android.support:customtabs:28.0.0-rc02'
implementation 'com.android.support:support-media-compat:28.0.0-rc02'
implementation 'com.android.support:support-v4:28.0.0-rc02'
Confronted to the same issue, I solved it by doing the following:
Checked the sdk version for my project, in the build.gradle file, to know the version and change the libraries accordingly
Then I had to override the libraries and change the versions that are inline with the sdk
The image attached shows the libraries I had to override:
com.android.support:animated-vector-drawable changed to 28.0.0
com.android.support:support-media-compat changed to 28.0.0
com.android.support:support-v4 changed to 28.0.0
What I understood is that the android support, drawable and compat libraries were predefined with the 26.1.0 version and my sdk version and target was 28 so I had to change that.
My gradle runs smoothly, and have not yet experienced any problem.
I am trying to add below libraries into my app
ext {
roomLibraryVersion = '1.1.0'
lifeCycleVersion = '1.1.1'
}
//room data base
implementation "android.arch.persistence.room:runtime:$roomLibraryVersion"
implementation "android.arch.persistence.room:compiler:$roomLibraryVersion"
annotationProcessor "android.arch.persistence.room:compiler:$roomLibraryVersion"
//life cycle
implementation "android.arch.lifecycle:runtime:$lifeCycleVersion"
implementation "android.arch.lifecycle:compiler:$lifeCycleVersion"
implementation "android.arch.lifecycle:extensions:$lifeCycleVersion"
// rx android
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation "io.reactivex.rxjava2:rxjava:2.1.14"
implementation 'android.arch.persistence.room:rxjava2:1.1.0'
//paging
implementation 'android.arch.paging:runtime:1.0.0'
I am getting below exception while running the code. Can anybody please help me to solve this issue
Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- compiler-1.1.1.jar (android.arch.lifecycle:compiler:1.1.1)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
Change:
implementation "android.arch.lifecycle:compiler:$lifeCycleVersion"
to:
annotationProcessor "android.arch.lifecycle:compiler:$lifeCycleVersion"
If you're using Kotlin, replace 'implementation' with 'kapt'
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
kapt "android.arch.lifecycle:compiler:$lifecycle_version"
And put this at the top of your app level Gradle file
apply plugin: 'kotlin-kapt'
I try to use Dagger2 in my Android project;
When I use apt, every things is right.But apt is not supported in AndroidStudio 3.0, so I use annotation processor.But no Dagger2 code created after I click "Make Project";
And I'm sure the annotetion processing is enable in AndroidStudio,because the Butterknife annotation processor is all right.
the follow is the build.gradle:
dependencies {
annotationProcessor 'com.google.dagger:dagger-android-processor:2.13'
compile 'com.google.dagger:dagger-android:2.13'
compile 'com.google.dagger:dagger-android-support:2.13'
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
}
use this in android studio 3.0 version
implementation 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
these are the dependences for dagger2 and butter in andriod studio 3.0
//ButterKniffe
compile "com.jakewharton:butterknife:8.8.1"
kapt "com.jakewharton:butterknife-compiler:8.8.1"
//dagger
compile "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
It is one of the breaking changes coming with gradle:3.0 that Google announced at IO17 gradle:3.0
the compile configuration is now deprecated and should be replaced by implementation or api
From the gradle docs :
Dependencies appearing in the api configurations will be transitively exposed to consumers of the library, and as such will appear on the compile classpath of consumers.
Dependencies found in the implementation configuration will, on the other hand, not be exposed to consumers, and therefore not leak into the consumers' compile classpath. This comes with several benefits:
List item dependencies do not leak into the compile classpath of consumers anymore, so you will never accidentally depend on a transitive dependency
faster compilation thanks to reduced classpath size
less recompilations when implementation dependencies change: consumers would not need to be recompiled
cleaner publishing: when used in conjunction with the new maven-publish plugin, Java libraries produce POM files that distinguish exactly between what is required to compile against the library and what is required to use the library at runtime (in other words, don't mix what is needed to compile the library itself and what is needed to compile against the library).
The compile configuration still exists but should not be used as it will not offer the guarantees that the api and implementation configurations provide.