Could not find ButterKnife compiler - android

I integrated ButterKnife into my project, since then it has been impossible for me to build it
I've tried different versions of the library but nothing seems to work
Here is the error during the build:
Could not find com.jakewharton:butterknife-compiler:7.0.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/jakewharton/butterknife-compiler/7.0.1/butterknife-compiler-7.0.1.pom
- https://dl.google.com/dl/android/maven2/com/jakewharton/butterknife-compiler/7.0.1/butterknife-compiler-7.0.1.jar
- https://jcenter.bintray.com/com/jakewharton/butterknife-compiler/7.0.1/butterknife-compiler-7.0.1.pom
- https://jcenter.bintray.com/com/jakewharton/butterknife-compiler/7.0.1/butterknife-compiler-7.0.1.jar
- https://jitpack.io/com/jakewharton/butterknife-compiler/7.0.1/butterknife-compiler-7.0.1.pom
- https://jitpack.io/com/jakewharton/butterknife-compiler/7.0.1/butterknife-compiler-7.0.1.jar
Required by:
project :app
And this is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.toto"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Retrofit Dependencies
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
// Butter Knife
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'com.android.support:support-annotations:28.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:7.0.1'
// ZXing
implementation 'com.github.tobrun:QR-Vision-Fragment:master-SNAPSHOT'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.android.support:design:28.0.0'
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.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
}
I have already added the jitpack repositories in the project build.gradle:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}

try this
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

If you are building an old android project and do not want to upgrade your butterknife dependency then add this to your gradle(app level) file. It wokred for me. Happy Coding :)
android {
...
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
}
}

Use This:
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'

from this butterknife-compiler version 7.0.1 not listed(founded) in mvn repository
so use the latest lib version
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'

Related

no versions of com.onesignal:OneSignal are available grade error

I am getting the following error our of no where
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not find any matches for com.onesignal:OneSignal:[3.9.1,3.99.99] as no versions of com.onesignal:OneSignal are available.
I can not figure out why this would be happening. Any help would be greatly appreciated.
Here is my entire gradle file.
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 28
defaultConfig {
applicationId "-----"
minSdkVersion 15
targetSdkVersion 28
versionCode 65
versionName "1.0.65"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id: '-----',
onesignal_google_project_number: 'REMOTE'
]
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.github.apl-devs:appintro:v4.2.3'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
implementation 'com.android.volley:volley:1.1.1'
implementation 'de.hdodenhof:circleimageview:3.1.0'
compile 'com.google.zxing:core:3.2.1'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
}
apply plugin: 'com.google.gms.google-services'
I just had this issue too.
I changed version to just 3.1.9 like below and everything worked fine.
I mean like this:
compile 'com.onesignal:OneSignal:3.9.1'
change the line as like this
implementation 'com.onesignal:OneSignal:3.9.1'
for me work also! thanks
INFO: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

Trying to add Crashlytics in Android Studio (could not find method...)

I try to add Crashlytics to my project but Gradle is not syncing well.
This is my build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.26.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.smartvibes.smartbeat"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.volley:volley:1.1.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.squareup.okio:okio:1.7.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.4.0'
implementation 'org.osmdroid:osmdroid-android:6.0.3'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'io.nlopez.smartlocation:rx:3.3.3'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.github.MikeOrtiz:TouchImageView:1.4.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.jakewharton.rxbinding:rxbinding:0.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9#aar' {
transitive = true;
}
}
This is what I added in my manifest:
<meta-data
android:name="io.fabric.ApiKey"
android:value="my key"
/>
I manually changed
compile ('com.crashlytics.sdk.android:crashlytics:2.9.9#aar') {
transitive = true;
}
To
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9#aar' {
transitive = true;
}
Because compile is not supported anymore.
The error when I try to sync it is:
ERROR: Could not find method com.crashlytics.sdk.android:crashlytics:2.9.9#aar() for arguments [build_ebny41u4h7onhh3ybv447hi4b$_run_closure3$_closure8#7d0b1f54] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
I Googled on this issue but could not find an appropriate solution.
Anyone knows how to deal with this?
You are almost there. Just need to write this with ( ) :
implementation ('com.crashlytics.sdk.android:crashlytics:2.9.9#aar') {
transitive = true;
}

Add library in android studio?

when I want to add this library:
implementation 'com.github.bumptech.glide:glide:4.9.0'
My android take this error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.9.0.
and this is my app module
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mahdi.chatapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-config:16.3.0'
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.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
}
apply plugin: 'com.google.gms.google-services'
Have you added this code in Gradle file
repositories {
mavenCentral()
google()
}
to use latest version of glide i.e. above version 4,
you have to add one extra dependency(glide compiler)
dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
and in repositories you have to add
repositories {
mavenCentral()
google()
}
reference: https://github.com/bumptech/glide
You have not added the annotationProcessor
repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
compile 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
This is the code for downloading glide given in the Glide documentation. See this link: http://bumptech.github.io/glide/doc/download-setup.html#gradle

Unable to merge dex error when building my android project

I am trying to build my android project and getting the error "Unable to merge dex"
I tried different options that are mentioned in other posts. Some of them are
Remove unused libraries
Add multidexenabled=true to gradle file
Add implementation 'com.android.support:multidex:1.0.3' to gradle file
Clean , delete .gradle folder and rebuild
The problem is still present and am not sure what is wrong. Kindly please share your thoughts.
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
My app/build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.resta.com.restaurantapp"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.7
sourceCompatibility 1.7
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
with support libraries 27.1.1 it builds:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-firestore:17.1.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
implementation 'com.android.support:multidex:1.0.3'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
testImplementation 'junit:junit:4.12'
}
if not, add the whole DexArchiveMergerException and not only that notice, which tells nothing.

Adding dagger2 to android studio 3.1 preview

Can anyone tell my why dagger2 isn't working for me in Android Studio 3.1 preview?
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.orbitlab.mowerapp"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
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:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'com.google.firebase:firebase-database:11.4.2'
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation "com.google.firebase:firebase-firestore:11.4.2"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
implementation 'com.android.support:customtabs:26.1.0'
implementation 'com.google.android.gms:play-services-fitness:11.4.2'
implementation 'com.google.android.gms:play-services-auth:11.4.2'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
implementation 'com.google.dagger:dagger:2.10'
}
apply plugin: 'com.google.gms.google-services'
This is how my app's build.gradle file looks like. I haven't added anything in the project's build.gradle file.
Can anyone help?
Edit:
The gradle syncs now, but i get dex errors when trying to deploy to my device (havent used Dagger in this project yet).
The error is:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'
Try to update dagger version and check it like this.
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
implementation 'com.google.dagger:dagger:2.10'
You need to add following code to gradle file,
android {
defaultConfig {
multiDexEnabled true
}
}
Then,
1.Clean your project
2.Build the code

Categories

Resources