Gradle DSL method not found: 'has()' - android

After latest update of android studio , using classpath 'com.android.tools.build:gradle:2.3.0-beta1' , I am getting the following error on gradle sync .
Error:Gradle DSL method not found: 'has()'
Any ideas
Update its casused by android volley , full error :
Error:FAILURE: Build failed with an exception.
Where:
Script 'D:\APPS-MOBI**\Android\volley\bintray.gradle' line: 64
What went wrong:
A problem occurred evaluating script.
Could not find method has() for arguments [release] on project ':volley' of type org.gradle.api.Project.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

The Volley project has given the following warning for a while now:
The has() method has been deprecated and is scheduled to be removed in Gradle 3.0. Please use the hasProperty() or ext.has() method instead.
Changing the line in Volley's bintray.gradle file from
publish = project.has("release")
to
publish = project.hasProperty("release")
Seems to fix the issue

I found the publish=project.has("release") around line 64 in bintray.gradle.
in android studio click the top of the project tree and Edit|FindInPath

Had the same problem then I tried this:
go to your volley module and comment out "publish = project.has("release")" in the "bintray.gradle" file

Related

'com.github.triplet.play' Some problems were found with the configuration of task ':app:generateAppNameReleasePlayResources'

After i have updated android studio to 3.4.2 and gradle,
when i run this line
gradlew publishApkappNameRelease
im getting this error :
* What went wrong: Some problems were found with the configuration of task ':app:generateappNameReleasePlayResources'.
> File 'E:\Projects\packagename\app\src\main\play' specified for property '$1' does not exist.
> File 'E:\Projects\packagename\app\src\appName\play' specified for property '$2' does not exist.
> File 'E:\Projects\packagename\app\src\release\play' specified for property '$3' does not exist.
> File 'E:\Projects\packagename\app\src\appNameRelease\play' specified for property '$4' does not exist.
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 47s 56 actionable tasks: 55 executed, 1 from cache
note: this line is used to auto publish apk using
apply plugin: 'com.github.triplet.play'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
same when i run this command line gradlew --recompile-scripts i get error
Unknown command-line option '--recompile-scripts'
These commands were running fine before the updates.
UPDATE:
when i try to update the triplet.play to any of t hose versions (2.2.1 - 2.2.0 - 2.1.1 - 2.1.0 - 2.0.0 - 2.0.0-rc2) i get this error
Could not find com.github.triplet.gradle:play-publisher:2.2.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.pom
- https://dl.google.com/dl/android/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.jar
- https://jcenter.bintray.com/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.pom
- https://jcenter.bintray.com/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.jar
- https://repo.maven.apache.org/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.pom
- https://repo.maven.apache.org/maven2/com/github/triplet/gradle/play-publisher/2.2.1/play-publisher-2.2.1.jar
Required by:
project :
Apparently this can be fixed by upgrading the version of the play-publisher plugin from 1.1.5 to 2.1.1 as per the GitHub issue here: https://github.com/Triple-T/gradle-play-publisher/issues/532
However, it seems that the newer versions of the plugin aren't available on all artifact repositories. I found it here which has clear steps of doing it: https://plugins.gradle.org/plugin/com.github.triplet.play
Lastly it is advised that you check their GitHub page again to make sure that the config you currently have is still compatible: https://github.com/Triple-T/gradle-play-publisher
With regards to gradlew --recompile-scripts, this has been deprecated and removed in the new version since most of the times the gradle daemon is running and ignores this option. More info here: https://github.com/gradle/gradle/issues/1425
First, add a new repo to your repositories on build.gradle (Project)
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
Now , upgrade your classpath.
classpath 'com.github.triplet.gradle:play-publisher:2.1.1'

Android studio says project not gradle-build when importing .aar in a Flutter app

I'm trying to import an .aar file
to clear variable, I started a new Flutter project in android studio
than I followed the classical procedure:
file-> new-> new module-> import jar/aar package
after selecting the file I get this message:
Unable to get Gradle wrapper properties from:
C:...\myApp\gradle\wrapper\gradle-wrapper.properties
Would you like to recreate the wrapper using the latest supported Gradle version?
Click 'OK' to recreate files, or 'Cancel' to manually set the path of
a local Gradle distribution.
I tried both (every time starting a new app)
and later I'm asked to update gradle (to 4.10.1)
at this point I get the error:
The project 'myApp' is not a Gradle-based project
please not that I don't have any of this problems while importing the same .aar
in to a Kotlin project
can you help me to figure out how to import this .aar please?
thanks in advance
Francesco
[EDIT] I've tried to import manually the .aar file following this LINK
and when I run it gradle fail to build returning this error
[EDIN N°2] I've used 'api/implementation' instead of compile as suggested by ''shadowsheep'', the result is the following:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\...\myApp\android\build.gradle' line: 11
* What went wrong:
Could not compile build file 'C:\...\myApp\android\build.gradle'.
> startup failed:
build file 'C:\...\myApp\android\build.gradle': 11: expecting '}', found 'project' # line 11, column 28.
api/implementation project(':barcodeScannerLibrary')
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Command: C:\...\myApp\android\gradlew.bat app:properties
Any help?

Gradle - A problems occurred evaluating root project '*'. > Could not find method compile() for arguments [*] on root project '*'

I'm using Eclipse Luna to develop my Android app. I don't have any idea why the error message keep showing again and again. I got this error message after fill up dependencies in build.gradle and run gradle build in my terminal.
build.gradle
dependencies {
compile 'com.lorentzos.swipecards:library:1.0.8#aar'
}
Error message
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/MNurdin/Documents/Github/Swipecards/example/src/main/build.gradle' line: 2
* What went wrong:
A problem occurred evaluating root project 'main'.
> Could not find method compile() for arguments [com.lorentzos.swipecards:library:X.X.X#aar] on root project 'main'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.34 secs
Project: https://github.com/datomnurdin/Swipecards
change to this:
compile 'com.lorentzos.swipecards:library:1.0.8'
I encountered the error when I tried using gradle 2.6 to build a project that was built using gradle 2.3. Make sure the versions are the same.
The compile task is defined by the java plugin. However, as you do not include it in your root project it does not exist there so gradle does not know how to handle it.
In order to resolve it you can either:
Apply the java plugin to your root project. The downside of this approach would be that this plugin will be included automatically in all your sub project that in somecases may be undesired, and also by default there will be an empty jar created for this project.
Define a dummy empty compile task yourself so gradle will be happy.
compile is a dependency configuration that comes from the Java Plugin.
The Android Gradle plugin applies the Java plugin under the covers. I do not see the Android plugin applied in your Gradle script. I think you may be missing a module-level build configuration that applies the Android Gradle plugin which would add dependencies.compile(...) to the DSL.

Android-clean architecture sample program

I'm following an article from http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/ and downloaded the sample git hub project https://github.com/android10/Android-CleanArchitecture.
The project has been build using gradle, since my previous projects was build using the default builder of android, i found this hard building the project.
I already set up the environment of the gradle. but when I tried to build the project using gradle build on the root folder i get this error.(NOTE: Im using Intellij as my IDE)
I first performed gradle build in the root folder but received this error:
* Where:
Build file '/Users/magic/Desktop/android/myProjects/TestingProjects/Android Clean Architecture/Android-CleanArchitecture-master/data/build.gradle' line: 1
What went wrong:
A problem occurred evaluating project ':data'.
Failed to apply plugin [id 'android-library']
Gradle version 1.10 is required. Current version is 2.1. If using the gradle wrapper, try editing the distributionUrl in /Users/magic/Desktop/android/myProjects/TestingProjects/Android Clean Architecture/Android-CleanArchitecture-master/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
So, i went to folder gradle and change the gradle-wrapper.properties to gradle-1.10-all.zip and perfomed ./gradlew build but got this error:
FAILURE: Build failed with an exception.
Where:
Build file '/Users/Magic/Desktop/android/myProjects/TestingProjects/Android Clean Architecture/Android-CleanArchitecture-master/data/build.gradle' line: 9
What went wrong:
A problem occurred evaluating project ':data'.
Could not find method applicationId() for arguments [com.fernandocejas.android10.sample.data] on ProductFlavorDsl_Decorated{name=main, minSdkVersion=-1, targetSdkVersion=-1, renderscriptTargetApi=-1, renderscriptSupportMode=null, renderscriptNdkMode=null, versionCode=-1, versionName=null, packageName=null, testPackageName=null, testInstrumentationRunner=null, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null}.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
and its pointing to line 9
defaultConfig {
applicationId "com.fernandocejas.android10.sample.data" //line 9
minSdkVersion 15
targetSdkVersion 19
}
I would really appreciate your inputs with this.
Thanks.
I just downloaded that project, imported it into Intellij 13.1 (using the gradle wrapper), and it worked out of the box. You have made changes to the build.gradle files that have broken it. It is hard to say what the issue is without all your gradle files posted here. One indication that the gradle files have been modified is that one of the errors you gave was:
Failed to apply plugin [id 'android-library']
But the example does not apply this plugin, it applies the correct one, i.e.:
apply plugin: 'com.android.library'
Try getting that project again and don't change the gradle build files. Also make sure you are importing with the gradle wrapper, and not your local distribution of gradle.
I hope this helps!

Android Studio 0.8 Task assemble not found in root project

I m trying to build the iosched app on ubuntu 14.04 on android studio 0.8 . After importing the setting.gradle file and following the build instruction I get an error saying
Error
:FAILURE: Build failed with an exception.
* What went wrong:
Task 'assemble' not found in root project 'iosched'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
The solution mentioned in this post doesn't work either.
Try to add this: task assemble{} in your root build.gradle file.
According to this thread it helps (it helped me as well).
In my case, it was because my project implemented a Module that was an android-library (deprecated) / com.android.library which used a minSdkVersion lower than my project.
Be sure that your project and android-library / com.android.library have the same minSdkVersion.

Categories

Resources