I had a problem to run android-studios build gradle, so I tested many solution but unfortunately I couldn't solve my problem:
Now i uninstall my old Android studio and Android-sdk , then I download android studio 1.5.1 that contains default SDK .
I install them and I create an empty project , But it take 30 minutes to build project, I will add dialog window that shown in this period of time .
Finally project created with this error :
Error:(23, 17) Failed to resolve: junit:junit:4.12
Could any one help me ,please ?
build.gradle file content:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.armangar.app.fortest"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
top build.gradle file content:
// 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:1.5.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
}
testCompile is the configuration for unit tests (located in src/test) and androidTestCompile is used for the test api (located in src/androidTest).
The main distinction between the two is that test runs in a regular Java JVM, and androidTest tests run on an Android device (or an emulator).
So, use
testCompile 'junit:junit:4.12'
instead of
androidTestCompile 'junit:junit:4.12'
source: http://tools.android.com/tech-docs/unit-testing-support
I think you have SSL problem.
Try by replacing
jcenter { url 'http://jcenter.bintray.com' }
with
jcenter()
in both repository blocks in build.gradle file and try to build gradle again.
I change jcenter() to mavenCentral() in build.gradle .
So my problem solved
EDIT:
This issue was related to my proxy . So I could not download from jcenter().
If you have a problem same this one, please check your Internet proxy .
Related
I am trying to publish my android library on jitpack.io but when I tried to add dependency to test my artifact I am getting this error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.github.pashaoleynik97:GSBarcodeScannerHelper:0.1.1-alpha.
Open File
Show Details
My gradle files in library project are listed below.
My build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.pashaoleynik97.gsbarcodescannerhelperdemo"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.1"
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:28.0.0'
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 project(':gsbarcodescannerhelper')
}
My build.gradle (gsbarcodescannerhelper):
apply plugin: 'com.android.library'
group='com.github.pashaoleynik97;'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "0.1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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: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 'org.jetbrains.kotlin:kotlin-stdlib:1.3.10'
implementation(name: 'generalscan-sdk-1.0.6', ext:'aar')
}
And finally, my build.gradle (project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs project(':gsbarcodescannerhelper').file('libs')
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I pushed my project on github, created release (through github web interface), then went to jitpack.io and published my library. But when I tried to add this library to my new test project I had errors (listed in top of this post). What I am doing wrong?
UPD
I also tried to add classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' like in this docs: https://jitpack.io/docs/ANDROID/
But result remains the same.
UPD 2
Created issue: https://github.com/jitpack/jitpack.io/issues/3758
This seems to be a persisting issue for a few days, can be found here, the link mentions a workaround here. The workaround is to add www with the jitpack.io. Hence update it to the following:
maven { url 'https://www.jitpack.io' }
Jitpack is very sensative tool. There are a multitude of reasons why this issue comes up. I will try to itemized them.
1) Failing Unit Tests; if you have any failing unit tests, you will be able to create the artifact on jitpack (with no reported issues) but will be unable to reference the artifact. Make sure all your unit tests are working properly.
2) It is advisable that you include in your project level gradle for the project intended to be the artifact, the following:
Top of Project Level Gradle
apply plugin: 'maven-publish'
group = '<add-your-package-name-here>'
and at the very bottom of your project level gradle include
apply from: 'https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/master/gradle-mavenizer.gradle'
Now generate an artifact and see if the reference works
3) Private artifact? Maybe you are not referencing your artifact correctly. If your repo is private, be sure to add the auth token in gradle.properties and then reference it on the project level gradle like this,
gradle.properties
authToken=jp_myfake_token
Project Level Gradle:
maven {
url "https://jitpack.io"
credentials{ username authToken }
}
4) Wait a hour. For whatever reason there is syncing and caching issues with Jitpack. Sometimes all you have to do is wait a hour (or two) and everything starts to work.
Hopefully one of these will help you resolve your issue. Jitpack has easy setup, but it is buggy.
make sure that you add maven { url "https://jitpack.io" }
in build.gradle (Project Level) like this:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
also, make sure that's your Gradle offline mode is disabled
Now it is free only for public repositories...
If you put your repository url in https://jitpack.io and looked up, you will see the following message as log:
Subscription not active
I have searched around a lot but I cannot really find a post that helps I am somewhat new to android so some of this goes over my head. Anyway, my problems started when I got an error saying gradle plugin was old and the sync would not complete. So I changed a few things around not really sure what I did. Now I have:
Error(25,13) Failed to resolve: com.android.support:appcompat-v7 24.0.1
Project gradle file:
// 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.1.3'
// 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
}
app gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.bisesifreelance.maxbisesi.tic_tac_toe"
minSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:24.0.1'
testCompile 'junit:junit:4.12'
}
Also I have installed all build tools in SDK manager I'm not allowed to embed images yet? but it says:
Android SDK Plaform-Tools 24.03 installed
Android SDK Tools 25.2.2 installed
Thank YOu! I'm very lost.
You can also write like this:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
try
compile 'com.android.support:appcompat-v7:24.2.1'
EDIT
For sdk 27
buildToolsVersion "27.0.3"
implementation "com.android.support:appcompat-v7:27.1.1"
Try adding jcenter like this way
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
Rather than
repositories {
jcenter()
}
Make sure that this folder exists:
\your-android-sdk\extras\android\m2repository\com\android\support\appcompat-v7\24.0.1
Of course, 24.0.1 should be replaced by the latest version.
I had this problem because I occasionally renamed 24.0.1 to something else and so the required folder couldn't be found.
I had the same problem after updating Android Studio. In my case it was an issue of permissions as I do my day-to-day programming on my user account, while Android studio was installed and updated with the administrator account.
FIX:
Open the standalone SDK manager and go down to 'extras'. Click on 'Android Support Repository' (which will probably set as 'Not installed') and install the packages. If you are prompted with an error message saying something like 'error trying to rename folder'. Go to the folder that is mentioned in the message and make sure that the permissions are set correctly. After that click 'Try Again' and it should install the package without a problem.
NOTE: This might happen a few more times. Just repeat the process for each file. The problem should then be solved.
Change a character - to :
compile 'com.android.support:appcompat-v7:24.2.1'
rather than
compile 'com.android.support:appcompat-v7-24.2.1'
try update the IDE and remove earlier build version (like 23) after installing later one and rename it to newer one.
Open SDK Manager and update the Extras-->Android Support Repository.
Path ..sdk\extras\android\m2repository\com\android\support\appcompat-v7>
Check for the updated version being installed.
In build.gradle in all projects, add Marvel and add this URL 'https://maven.google.com'
I just downloaded Android Studio and created a new project and I'm getting gradle build errors:
Failed to resolve: com.android.support.test.espresso-core:2.2.2
and
Failed to resolve: com.android.support.appcompat-v7:25.3.1
This error was resolved reinstalling the SDK Tools + Repository + API when launching android studio as admin.
I've installed API Level 25 which what I want to build on and have downloaded the SDK Build-Tools. I have also already download the support repository
Here's my app file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.jtsalas.mirrorcontrol"
minSdkVersion 25
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
}
}
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 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
build.gradle:
// 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.3.2'
// 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
}
From the SDK manager, make sure you have both the Android Support Repository and Google Repository installed and up to date. You should then be able to find the relevant artifacts in sub folders of your /extras/android/m2repository directory
From your error it seems that you are not including espresso libraries. The solution to this is adding espresso core library which is part Android Testing support library which is hosted in the google's Maven repository think this as kind of git repository but for dependencies.
So we tell the gradle build system to look in the Maven repository for dependencies by specifying its URL.
This is done by adding Maven url in the application level build.gradle file under repositories block
repositories {
jcenter()
maven{
url "https://maven.google.com"
}
}
and in the module level build.gradle file mention the dependencies that you want from the maven repository by mention their name as follows:
dependencies{
//other dependencies go here
//testing dependencies
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
}
That is the reason for including Maven repository url in the app level build.gradle file, hope this helps.
In project.gradle file, the allprojects root align this way:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
jitpack is used as the dependency for multiple libraries, if you're not using any sort of library that don't requires it then not include maven line.
Well, I don't know the perfect answer but..... how about comparing with my SDK Tools?
I solved it by uninstalling Android Studios and deleting old versions of Android Studios in my C:\Users[Username] and reinstalled Android Studio as administrator.
It seems like you updated android studio and opening previous project in it.The simplest way is create new project and copy
1. compileSdkVersion 26
2. buildToolsVersion "26.0.1"
3. targetSdkVersion 26
4. compile 'com.android.support:appcompat-v7:26.+'
and paste them in appropriate places in app level build gradle.
it will ask to update to take advantages .. allow it to update.
best luck ... It worked for me.
if your project is Flutter,
clean project [by 'flutter clean' command]
In project.gradle file add [ google() ]
in Android studio: File Menu -> Invalidate...
project.gradle:
allprojects {
repositories {
google()
jcenter()
}
}
So, happily updated my Android Studio from stable version 2.2 to canary channel 2.3.
But, unfortunately, it has serious bug. Project is not able to build.
I tried opening my previous projects and also tried creating new sample application, I got same below error:
Gradle 'MyApplication' project refresh failed
Error:A problem occurred configuring project ':app'.
build.gradle(project):
// 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.3.0-alpha1'
// 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
}
build.gradle(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.chint.myapplication"
minSdkVersion 16
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'
}
}
}
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.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:25.0.0'
testCompile 'junit:junit:4.12'
}
Am I the only one with this issue ?
So, be careful while this dialog appears:
Choose "Remind me later" and NOT "Update"
Stay with the build version you already have.
Incase, you pressed Update, so just rollback your Android Gradle Plugin classpath in build.gradle(project) to below one:
classpath 'com.android.tools.build:gradle:2.2.2'
This worked for me.
You should update your Android Studio gradle manually.
1° Step:
Follow this path and get your gradle version
C:\Users\[USER_NAME]\.gradle\wrapper\dists
Here you will get "gradle-X.X" (X- is version) in my case it was "gradle-3.3-all"
2° Step:
Go to the following link :
https://services.gradle.org/distributions/
Download your respective version zip file and just past it in the last folder with long random name.
C:\Users\[USER_NAME]\.gradle\wrapper\dists\gradle-x.x\55gk2rcmfc6p2dg9u9ohc31212 HERE
Now open the Android studio, I hope this will work.
I fought a similar issue and resolved it with the addition of 2 characters...
And after updating the gradle-wrapper.properties to target 3.2.1 everything was great for me
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip
If you import external libraries apply changes for "allprojects"
// 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.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am unable to fix this error:
dependencies cannot be applied to '(groovy.lang.Closure)
This is my gradle file:
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':FRNDzTER_core')
compile project(':cropper')
compile project(':stickyListHeaders')
compile "com.nostra13.universalimageloader:universal-image-loader:${rootProject.universalImageLoaderVersion}"
compile "com.google.android.gms:play- services:${rootProject.googlePlayServicesVersion}"
compile "de.keyboardsurfer.android.widget:crouton:${rootProject.croutonVersion}"
compile "com.nineoldandroids:library:${rootProject.nineoldandroidsVersion}"
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile 'com.crashlytics.android:crashlytics:1.+'
}
android{
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
}
buildTypes {
release {
debuggable rootProject.prodDebug
proguardFile 'proguard.cfg'
}
}
dependencies {
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
}
You can go to Preferences and select "use default gradle wrapper" then rebuild the project. It worked well for me:
Go to
Windows
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Mac
Preference -> Build, Execution, Deployment -> Build Tools -> Gradle
and select Use default gradle wrapper
Based on what Android Studio generates, you need to have a top-level project file build.gradle, and another for your app build.gradle.
Top-level:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
}
Application level:
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
android{
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode rootProject.versionCode
versionName rootProject.versionName
}
buildTypes {
release {
debuggable rootProject.prodDebug
proguardFile 'proguard.cfg'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
} `
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':FRNDzTER_core')
compile project(':cropper')
compile project(':stickyListHeaders')
compile "com.nostra13.universalimageloader:universal-image- l loader:${rootProject.universalImageLoaderVersion}"
compile "com.google.android.gms:play- services:${rootProject.googlePlayServicesVersion}"
compile " "de.keyboardsurfer.android.widget:crouton:${rootProject.croutonVersion}"
compile "com.nineoldandroids:library:${rootProject.nineoldandroidsVersion}"
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
compile 'com.crashlytics.android:crashlytics:1.+'
}
But even without all that, your problem is that you have a dependencies within your android plugin config.
android {
dependencies {
}
}
remove that empty dependencies block.
EDIT: I also started getting this error with the latest Android Studio, all I had to do was add a newer version of the Gradle plugin, and compileSdkVersion 22.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
If you already are using the "default gradle wrapper" and it doesn't help:
In Menu click: File -> Invalidate Caches / Restart...
If it also doesn't help try in 2 steps:
1) Delete ".gradle" folder (and "build" folder if you have it already)
2) In Menu click: File -> Invalidate Caches / Restart...
After restarting the warning should disappear.
(For me it worked and for Android Studio and for IntelliJ Idea)
My problem is that the whole build.setting file were occupied with cannot be applied to '(groovy.lang.Closure)' warning messages instead of happening on any particular variable.
I have tried all solutions provided by others but none of them works for me.
I ended out doing these steps then it works like a charm. If you are encountering the same issue then give it a try.
Open and edit file: yourproject/gradle/wrapper/gradle-wrapper.properties. Edit content to update the gradle distribution version as shown in the image below then save.
Delete this folder: yourproject/.gradle.
Click Sync project with gradle files, then you are good to go.
I went into the preferences to try one of the other answers when I noticed a warning that my gradle home directory was wrong. So I opened up the file browser and chose the newer gradle version, and all the errors went away. Image shown below.
I bet you the problem is totally unrelated to the piece of code that is giving you warnings, most likely it's your proguard file. I had the following in my code and got the same warning:
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
By commenting out runProguard false, all of my problems go away, go figure :)
I have same problem in android studio 2.2,it work for me:
original:
android {
...
}
dependencies {
...
}
move dependencies in android:
android {
...
dependencies {
...
}
}
I solved the problem in Android Studio by Invalidating the cache and restart.
File-> Invalidate Caches / Restart..
I ran into a similar problem to this in IntelliJ for a Kotlin project. It looks like the issue was that in my project, even though it was set to use JDK 8, the language and API versions somehow got set to 1.3. See Project Preferences > Facets. In my case, I ticked "use project settings," but manually setting them per facet may work as well.
Close the project (File / Close project),
Select “Open an existing Android Studio project” on the start menu and select the folder that contains your Android project.
This work for me.
Gradle files can be made explicit in several places to avoid such errors. E.g. Change
configurations {
to
project.configurations {
or
task {
description 'foo'
to
task {
setDescription 'foo'
To fix the issue simply close the project, then select “Open an existing Android Studio project” on the start menu and select the folder that contains your Android project. Beware, select the folder, not the .iml project file.
Cut and then paste the "buildTypes" at the same place in "android" section and Re-Sync (refresh) Project
For people with M1 Intellij IDEA just add in build.gradle(:app)
//noinspection GroovyAssignabilityCheck
buildFeatures {
viewBinding
}
I fixed this issue with gradle 2.10.
Download it here : http://gradle.org/gradle-download/
And set your local gradle distribution like this :