I am getting Error:This Gradle plugin requires Studio 3.0 minimum when importing project
Project repo: https://github.com/chrisbanes/cheesesquare
I had tried mentioned solution provided here and here but nothing worked :(
The repository you're trying to import uses gradle build tools 3.0.0 and gradle 4.0. These aren't supported in Android Studio 2.3, which means that project can only be opened in Android Studio 3.0 preview.
Your options:
1) Download android studio 3.0 preview and use it for the project
2) Check out repository and revert it to just before commit 822b84a1e58126412f708745d8bcee5a525620ae (which is where the conversion to latest version of gradle happened)
Option #1: Do not attempt to import the project until you upgrade to Android Studio 3.0
Option #2: Modify the project:
Change the project-level build.gradle to refer to com.android.tools.build:gradle:2.3.3 instead of com.android.tools.build:gradle:3.0.0-alpha6
Change gradle/wrapper/gradle-wrapper.properties to refer to https\://services.gradle.org/distributions/gradle-3.3-all.zip instead of https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
Import the project and pray that its author is not depending on things that you changed
replace
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
with
classpath 'com.android.tools.build:gradle:2.3.3'
in the projects build.gradle files.
this Error occurs when you are trying to import Project which is created in studio 3.0 and above into Android Studio 2.3.3 or below. make following changes to work in Studio below 3
1)in Project gradle add below configuration:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
2) in App (or module) gradle file
remove following lines if there are any
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
and change all implementation and annotationProcessor in dependency to compile like below
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'android.arch.lifecycle:runtime:1.0.0'
implementation 'android.arch.lifecycle:extensions:1.0.0-alpha9-1'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
implementation 'android.arch.persistence.room:runtime:1.0.0-alpha9-1'
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha9-1"
implementation 'android.arch.paging:runtime:1.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:26.0.2'
}
To
dependencies {
//implementation fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'android.arch.lifecycle:runtime:1.0.0'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha9-1'
compile "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
compile 'android.arch.persistence.room:runtime:1.0.0-alpha9-1'
compile "android.arch.persistence.room:compiler:1.0.0-alpha9-1"
compile 'android.arch.paging:runtime:1.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.2'
}
I was facing the same issue, it can be resolved by changing the gradle and android plugin version using following steps.
File -> Project Structure -> Project -> change gradle version to 3.3 and android plugin version to the android studio version you are using. -> Rebuild your project.
It may give some error for methods which were not in previous gradle versions. One that you mentioned in one of your comment GradleError:(25, 0) Gradle DSL method not found: 'implementation()' can be resolved by replacing implementation by compile.
May be you have resolved you issue but may help others.
Once I downloaded the project created in Android Studio v3 and I had v2.3.3. So when I tried to launch the project there were some incompatibility issues. And for those who faced the same problem the solution is the following:
1. Go to File=> Project Structure=> Project and change Gradle version to 3.3 and Android Plugin version to 2.3.3
2. In CinemaProject build.gradle file:
2.1. Delete "google()" methods wherever you see it in the file
2.2. Change allprojects section in the file like that:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
In app build.gradle file :
Add buildToolsVersion "26.0.0" in android {} section after compileSdkVersion
Change the following
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'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.8.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'
}
Like that
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mcxiaoke.volley:library:1.0.1'
compile 'com.google.code.gson:gson:2.7'
testCompile 'junit:junit:4.12'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
hi guys i solve this issue i want to explain you you check your android studio ide version first this is the reason if you using ide 1.5 then you cant use gradle version 3.0+.
Related
I made following upgrades today
Android Studio 3.0 -> 3.1
In build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' -> 3.1.0
}
In gradle/wrapper/gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-4.5-all.zip -> gradle-4.6-all.zip
And I am now getting following error with my firebase modules (random module at a time when I build)
Failed to find byte code for
com/google/firebase/storage/StreamDownloadTask$StreamProcessor
or sometimes
Failed to find byte code for
com/google/firebase/database/ChildEventListener
My project implements
dependencies {
compile 'com.google.android.gms:play-services-base:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-firestore:11.8.0'
compile 'com.google.firebase:firebase-invites:11.8.0'
compile "com.google.firebase:firebase-messaging:11.8.0"
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.1.0'
}
I have the same error
Failed to find byte code for com/google/firebase/database/Transaction$Handler
(although i don't use firebase/database).
Have found that disabling instant run in AndroidStudio settings resolve this issue.
This is addressed in the latest react-native-firebase v4 release candidate, available here: https://github.com/invertase/react-native-firebase/releases/tag/v4.0.0-rc.3
The fix was ultimately to update the react-native-firebase build.gradle to use compileOnly instead of compile statements.
In the dependencies add:
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
to be able to use ChildEventListener and StreamDownloadTask$StreamProcessor
Also you may have to write the other firebase dependencies
I am trying to use Anko with my Android Kotlin Project. I have added the line to my dependencies / gradle module file as follows:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.anko:anko:$anko_version"
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-vector-drawable:26.+'
compile 'com.android.support:support-v4:26.+'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
But I get the following error when trying to do a gradle sync:
Error:(36, 0) Could not get unknown property 'anko_version' for object
of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
How can I properly incorporate Anko in my project?
For reference, I am using Android Studio 2.0.
Add anko_version in ext block above the dependencies block:
ext {
anko_version = '0.10.1'
}
Another option, as Naetmul suggested in the comments, is to replace the $anko_version with 0.10.1
You can define it in your project level build.gradle file.
OR
You can replace with current version which is 0.10.1 (on 1 Sep 2017)
This is how I do it and it works great:
Open your project gradle.
Add a ext block within the buildscript block.
Add your versions properties.
Within your app gradle, set your versions like so:
Use this
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Don't use this
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
and don't use this
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
I am new to Android App Development. I am trying to create an Android app using TabLayout and have added the following dependencies in the build.gradle file.
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
testCompile 'junit:junit:4.12'
}
But on running the App, I am getting build error as follows
Error:(27, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'MyFirstapp' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Any suggestions on why this problem is there. I get an option to install Plugin from Android Studio but I don't know which plugin to install.
I'm guessing you are adding dependencies to the wrong build.gradle.
Try doing this:
In your first build.gradle replace the dependencies with this
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
and replace dependencies in build.gradle(Module:app) (2nd build.gradle file) with this
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.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I tried lots of solutions on this website, nothing worked for me,
the error accrued when I try to add firebase. and I can't find a dependency which use play-service. please help
The error and app dependencies:
I got the same problem, but i do this
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0' //use this version as the newest version
}
and i did this too
dependencies {
.
.
.
// compile project(':google-play-services') comment because this version isn't same with my firebase version, try to get the last google-play-service jar / compile the last version
compile 'com.google.android.gms:play-services:10.2.0'
compile ('com.google.firebase:firebase-messaging:10.2.0'){
exclude group: 'com.google.android.gms', module: 'com.google.android.gms'
}
}
apply plugin: 'com.google.gms.google-services' // i do it on every project i have
then sync aand clean your project
may this help you, i think the version of google-play-service should be same as the firebase version
update
try to delete your old google-service-play_lib
and add compile 'com.google.android.gms:play-services:10.2.0' //use the newest
Try to keep the dependencies as follows:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'projects-1'
..........
..........
compile 'com.google.firebase:firebase-storage:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.google.firebase:firebase-database:10.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
and build the gradle again.
Cannot resolve symbol TabLayout ? How to clear this error? Please help me. I already imported import android.support.design.widget.TabLayout;
Had a similar problem, to fix this in Android Studio (AS) I went Build->Clean Project and AS sorted everything out. Make sure in your build.gradle file under dependencies that you have:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:your_api_version_number.0.0'
compile 'com.android.support:design:+'
}
I solved the issue Manually by adding the following two lines:
implementation 'com.android.support:support-v4:22.2.0'
implementation 'com.android.support:design:22.2.0'
under dependencies in \app\build.gradle worked for me.
Note: Your all the support libraries have to be the same version i.e. appcompat-v7 and support-v4 to same version e.g. 23.0.1; otherwise you can get this error
java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintManager`
after code build
Under Gradle Scripts,
Open build.gradle (Module: app)
Inside of dependencies add
compile 'com.android.support:design:25.3.1'
There may be a newer version of the library available, the android studio lint check may detect that.
The full dependencies area may look like this for reference. The above line is the only one I manually added.
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.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
}
An above answer suggested adding
compile 'com.android.support:design:+'
Which is kind of dangerous because it always uses the latest library, you may have trouble isolating bugs with automatic library updates happening in the background.
Android Studio no longer uses "compile", they use "implementation".
Be sure to include the code below when you go to Build Gradle>dependencies{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
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'
}
For Android API Level 29+, add the following dependency in build.gradle (Module:app):
dependencies {
implementation 'com.google.android.material:material:1.0.0'
}
If there is a newer version available, Android Studio will prompt you to use the newest one.
I solve it by Open build.gradle (Module: app) and add
implementation 'com.android.support:design:+'