Closed ohshi000 closed 6 years ago
I got this problem too. Have you solved it?
Use 9.0.0-SNAPSHOT for now.
@JakeWharton Thank you for your reply, I have solved this problem。wishing your life delectation
@liugongce how did you solve it? why I use 9.0.0.0-SNAPSHOT, it could not find
@wangbin0802 you should add repository maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
in your root build file.
Just remove classpath 'me.tatarka:gradle-retrolambda:3.7.0' and downgrade butterknife version to 8.4.0 classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
Don't forget to remove apply plugin: 'me.tatarka.retrolambda' from app level build gradle.
For anyone wanting to use this in a production app using Android Gradle Plugin 3.x with a no-SNAPSHOT policy: there's no need to use the same version of butterknife
/butterknife-compiler
and butterknife-plugin
:
android_plugin_version=3.0.1
butterknife_version=8.8.1
buildscript {
repositories {
jcenter()
google()
// TODO remove after butterknife 9 graduates to stable
maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "com.android.tools.build:gradle:${android_plugin_version}"
// TODO Upgrade to 9.0.0 when released and use ${butterknife_version}
// Needed because 8.8.1 plugin is not compatible with Android Plugin 3.x:
// https://github.com/JakeWharton/butterknife/issues/1130
classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-20171223.061039-23"
}
}
repositories {
jcenter()
google()
// notice there's no need for Sonatype here, so no SNAPSHOTs can leak into the app
}
dependencies {
implementation "com.jakewharton:butterknife:${butterknife_version}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterknife_version}"
}
9.0.0-20171223.061039-23 is only a single commit ahead of 8.8.1: https://github.com/JakeWharton/butterknife/commits/master/butterknife-gradle-plugin 8.8.1 was released in 2017 August.
If it helps anyone. I have solved this problem by downgrading butterknife gradle plugin to 8.4.0
@JakeWharton, we were using 9.0.0-SNAPSHOT
in the project. Now after the APG version is changed to alpha version, we are no longer able to use the snapshot, thus we have to fallback to 8.4.0
. But that also isn't working for us, because ButterKnife lacks to correctly bind views inside library modules.
Thus, what we are left is to attach snapshot sources itself and downgrade AGP version to the stable 3.0.1
.
Can you advice a better option?
Solved by downgrading butterknife gradle plugin to 8.4.0 or 8.5.0.
@JakeWharton would it be possible to release 8.8.2 with this simple fix included or 9.0.0 coming soon?
I got the same issues too.
Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'. Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) <a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. <a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
# Will they release new version to solve it?
I got the same issues too. Now I fallback to 8.4.0 , look forward to the new version to solve the problem
For me trying to use 9.0.0-SNAPSHOT results to this:
Error:Could not find com.github.javaparser:javaparser-core:3.5.14. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.pom file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.jar https://maven.fabric.io/public/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.pom https://maven.fabric.io/public/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.jar https://oss.sonatype.org/content/repositories/snapshots/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.pom https://oss.sonatype.org/content/repositories/snapshots/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.jar https://mvnrepository.com/artifact/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.pom https://mvnrepository.com/artifact/com/github/javaparser/javaparser-core/3.5.14/javaparser-core-3.5.14.jar Required by: project :xxx > com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT
Eventhough JavaParser-Core should be there https://mvnrepository.com/artifact/com.github.javaparser/javaparser-core/3.5.14.
My library module build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://mvnrepository.com/artifact" }
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
repositories {
maven { url "https://maven.google.com" }
maven { url "https://mvnrepository.com/artifact" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
@batati Not sure but you can try to add mavenCentral() in your repositories.
@glureau-betclic Tried adding it to all different repositories, unfortunately it didn't help.
emmmm......like this //buid.gradle Project buildscript { repositories { google() jcenter() mavenCentral() maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } }
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT"
}
}
allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } } //buid.gradle app dependencies{ implementation "com.jakewharton:butterknife:9.0.0-SNAPSHOT" annotationProcessor"com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT" } It's OK.
I am having this problem , need help ASAP! Here is my code , scroll down for explanation of problem !
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
//External Code Starts
buildscript {
repositories {
jcenter()
google() // Gradle 4.0+
maven { url "https://maven.google.com" } // Gradle < 4.0
mavenCentral()
maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "com.android.tools.build:gradle:${android_plugin_version}"
/* // TODO Upgrade to 9.0.0 when released and use ${butterknife_version}
// Needed because 8.8.1 plugin is not compatible with Android Plugin 3.x:
// https://github.com/JakeWharton/butterknife/issues/1130
*/ classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-20171223.061039-23"
}
}
// External Code Ends
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.qihancloud.librarydemo"
minSdkVersion 19
targetSdkVersion 26
versionCode 20170413
versionName "1.1.7"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation "com.jakewharton:butterknife:${butterknife_version}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterknife_version}"
api(name: 'QihanOpenSDK_2.0.0', ext: 'aar')
}
repositories {
flatDir {
dirs 'libs'
}
jcenter()
google()
}
Now , basically what I need to do is that I need to include it in my gradle file , but it always shows that
Could not get unknown property 'android_plugin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Also for the code below
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
//External Code Starts
buildscript {
repositories {
google() // Gradle 4.0+
maven { url "https://maven.google.com" } // Gradle < 4.0
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
classpath "com.android.tools.build:gradle:3.1.3"
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
}
}
// External Code Ends
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.qihancloud.librarydemo"
minSdkVersion 19
targetSdkVersion 26
versionCode 20170413
versionName "1.1.7"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
api(name: 'QihanOpenSDK_2.0.0', ext: 'aar')
}
repositories {
flatDir {
dirs 'libs'
}
google()
}
I get the Error Failed to resolve: com.jakewharton:butterknife:8.4.0
.
Now tell me what to do , coz I am frustrated as hell !!
@Skali7 top-level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
...
//for butterknife 9 snapshot
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
...
}
dependencies {
...
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
}
}
allprojects {
repositories {
...
}
}
...
}
module level
apply plugin: 'com.android.application'
...
{
...
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
...
}
...
apply plugin: 'com.google.gms.google-services'
If you're using butterknife from a library there's a few extra steps, like applying the plugin and using R2 for things you bind to
...
Yesterday I was actually having this really annoying issue where I couldn't resolve the Butterknife class - all I did was remove the dependency, sync, clean, add the dependency and then sync again and that was that 👍
Thanks @SaikCaskey , I had resolved the problem just after posting this message and I forgot to close this Issue , will remember it from next time onwards , btw I did the same thing as you mentioned in your post.
Just remove classpath 'me.tatarka:gradle-retrolambda:3.7.0' and downgrade butterknife version to 8.4.0 classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
Don't forget to remove apply plugin: 'me.tatarka.retrolambda' from app level build gradle.
Thank you. it works like a champ (y)
For anyone wanting to use this in a production app using Android Gradle Plugin 3.x with a no-SNAPSHOT policy: there's no need to use the same version of
butterknife
/butterknife-compiler
andbutterknife-plugin
:android_plugin_version=3.0.1 butterknife_version=8.8.1
buildscript { repositories { jcenter() google() // TODO remove after butterknife 9 graduates to stable maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { classpath "com.android.tools.build:gradle:${android_plugin_version}" // TODO Upgrade to 9.0.0 when released and use ${butterknife_version} // Needed because 8.8.1 plugin is not compatible with Android Plugin 3.x: // https://github.com/JakeWharton/butterknife/issues/1130 classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-20171223.061039-23" } } repositories { jcenter() google() // notice there's no need for Sonatype here, so no SNAPSHOTs can leak into the app } dependencies { implementation "com.jakewharton:butterknife:${butterknife_version}" annotationProcessor "com.jakewharton:butterknife-compiler:${butterknife_version}" }
9.0.0-20171223.061039-23 is only a single commit ahead of 8.8.1: https://github.com/JakeWharton/butterknife/commits/master/butterknife-gradle-plugin 8.8.1 was released in 2017 August.
Would anyone happen to have a 9.0.0 snapshot that doesn't force targeting API 28? I'm unable to support API 28 right now for a current project but would like to keep using butterknife.
For anyone wanting to use this in a production app using Android Gradle Plugin 3.x with a no-SNAPSHOT policy: there's no need to use the same version of
butterknife
/butterknife-compiler
andbutterknife-plugin
:android_plugin_version=3.0.1 butterknife_version=8.8.1
buildscript { repositories { jcenter() google() // TODO remove after butterknife 9 graduates to stable maven { name 'Sonatype SNAPSHOTs'; url 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { classpath "com.android.tools.build:gradle:${android_plugin_version}" // TODO Upgrade to 9.0.0 when released and use ${butterknife_version} // Needed because 8.8.1 plugin is not compatible with Android Plugin 3.x: // https://github.com/JakeWharton/butterknife/issues/1130 classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-20171223.061039-23" } } repositories { jcenter() google() // notice there's no need for Sonatype here, so no SNAPSHOTs can leak into the app } dependencies { implementation "com.jakewharton:butterknife:${butterknife_version}" annotationProcessor "com.jakewharton:butterknife-compiler:${butterknife_version}" }
9.0.0-20171223.061039-23 is only a single commit ahead of 8.8.1: https://github.com/JakeWharton/butterknife/commits/master/butterknife-gradle-plugin 8.8.1 was released in 2017 August.
Would anyone happen to have a 9.0.0 snapshot that doesn't force targeting API 28? I'm unable to support API 28 right now for a current project but would like to keep using butterknife.
I haven't tried the snapshot you're using but do you mean for upgrade of the build tools? You should just use the latest.
I was using this before / am using on machines without sdk28, so I don't think it's anything special about Butterknife, unless something has changed here that I haven't experienced yet
If it helps anyone. I have solved this problem by downgrading butterknife gradle plugin to 8.4.0
Thank you so much ,i have solved this problem by your method. And we need to remove apply plugin: 'com.jakewharton.butterknife' in gradle
@rdugue here's how we use it: butterknife-working-snapshot.zip
@JakeWharton I really think there should be a 8.8.2 release based on a commit from 2018 Q1
8.8.1 gradle 3.0.0 Android Studio 3.0 Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'. 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.