The specified Android SDK Build Tools version is ignored in flutter - android

My flutter project was working properly, but when i tried to start the project recently, i got the android error below.
WARNING: The specified Android SDK Build Tools version (25.0.0) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
:app:properties FAILED
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
*What went wrong:
null value in entry: outputFile=null
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I checked my app/build.gradle file but could not find buildToolsVersion '25.0.0'.My compileSdkVersion and targetSdkVersion are both 27.
I tried adding buildToolsVersion '26.0.2' , 27.0.3 and 28.0.1 which have already been installed, but i still get the same 25.0.0 error.
I can't tell what i'm doing or did wrong. Any help will be greatly appreciated.Thank you.

Really dumb suggestion, but have you tried a File->Invalidate Caches/Restart?

The error is in this bit:
FAILURE: Build failed with an exception.
*What went wrong:
null value in entry: outputFile=null
This likely has to do with updating the Gradle version in the project (perhaps unintentionally by click the "Upgrade gradle now" button), which caused a different parse of your Gradle script due to some form of backwards incompatibility.
If the project has source code control this would be pretty easy to check.

Related

Android Studio Error: During launch : com.android.build.gradle.internal.res.ResourceCompilerRunnable

Tried to launch my app and get this error. I'm going crazy with new gradle 8.
How can i fix it?
I've made this command:
./gradlew :MatchUp:dependencies --warning-mode all
And then these are answers:
Starting a Gradle Daemon, 3 incompatible and 3 stopped Daemons could not be reused, use --status for details
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.3.3/userguide/upgrading_version_6.html#jcenter_deprecation
at settings_1i0yjjkfvqy3y2on3vxaqibu6$_run_closure1$_closure2.doCall(/Users/cristiancapannini/Desktop/COLAN_WORKS/Android/MatchUp/settings.gradle:8)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
FAILURE: Build failed with an exception.
Where:
Build file '/Users/cristiancapannini/Desktop/COLAN_WORKS/Android/MatchUp/app/build.gradle' line: 2
What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
Your current JDK is located in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
How can i fix it?
Obviously it needs to be fixed in order to still maintain the backward compatibility of the app. Thanks
with regard
Files gradle
https://drive.google.com/drive/folders/1YEFZI3W9Sn3p6urwHm2eK-Hx8wNHmJeC?usp=sharing
Cristian

Ionic Cordova Confused With The New Bundle Building For Android

I am tearing my hair out with the changes to how you submit an app to google. You now have to submit a bundle which i am trying to generate with ./gradlew bundle but i just keep getting confusing errors below:
* What went wrong:
A problem occurred evaluating project ':app'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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.
==============================================================================
2: Task failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
compileSdkVersion is not specified. Please add it to build.gradle
The first issue is confusing because i have build tools installed, the path output is this:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:~/Library/Android/sdk/tools:~/Library/Android/sdk/platform-tools
Which is the correct location of the sdk.
The second error i don't follow at all, in my config.xml i have this:
I then ionic cordova build android --prod --release before the gradlew command is run. I also looked in the build.gradle file and found the following:
allprojects {
apply from: 'repositories.gradle'
repositories repos
//This replaces project.properties w.r.t. build settings
project.ext {
defaultCompileSdkVersion=29
defaultBuildToolsVersion="29.0.2" //String
defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
}
So it's telling it to use compile sdk version 29 by default for all projects. If i add the following and then run gradlew:
android{
compileSdkVersion=29
}
I get the following issue when running gradlew:
Could not find method android() for arguments [build_86qvliu728ivbijvz823o6ru1$_run_closure2#2ba919e2] on root project 'android' of type org.gradle.api.Project.
I'm at a total loss!
Android SDK build tools are in the Android/sdk/build-tools.
So what I suggest first, please check if you've added ANDROID_SDK_ROOT in your environment variables. And it must refer to your Android SDK location (../Android/sdk)

install gradle wrapper when build failes because of wrong gradle version

I'm new to Gradle and Java development and I'm having a hard time using a Gradle project which requires an old version of Gradle.
Basically, the problem is that every gradle command I run ends up with the same error:
FAILURE: Build failed with an exception.
* Where:
Build file '/var/code/doron/reverb/libpulse-android/build.gradle' line: 10
* What went wrong:
A problem occurred evaluating project ':libpulse-android'.
> Failed to apply plugin [id 'android-library']
> Gradle version 1.10 is required. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in /var/code/doron/reverb/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. 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 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
From what I understood, the recommended way to work with this kind of project is to install and use the gradle wrapper - Use the ./gradlew command instead of the system's gradle. I have searched the internet and reached this web page: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:adding_wrapper Which basically says I should run:
gradle wrapper --gradle-version 1.10
But that ends in the same errors as above!
When searching for an answer, I have encountered this question: Getting error "Gradle version 1.10 is required. Current version is 1.12." when executing "gradle wrapper"? Which have failed to solve my problem. It seems the answers for that question only try to explain why the problem happens and not how to solve it.
Do you see why the problem is absurdly recursive? I can't install a needed version of Gradle in a wrapper because the build fails and the build fails because I don't use a specific version of gradle and I don't use the wrapper which I can't install.
If you don't yet have the Wrapper in your project: what you can do is to create a new temporary Gradle project, configure the wrapper in this project to match your needed gradle version, and then copy the wrapper related files into your initial project. If you already have a wrapper you can simply configure it by changing distribution url in ./gradle/wrapper/gradle.properties:
In details
1) create new empty project
mkdir tmp-project
cd tmp-project
gradle init
2) change wrapper version
gradle wrapper --gradle-version 1.10
3) check version (this will download the distribution)
$ ./gradlew --version
Downloading https://services.gradle.org/distributions/gradle-1.10-bin.zip
......................................
------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------
4) copy the wrapper related resources to your project:
./gradle/ directory
./gradlew script
./gradlew.bat script
open gradle-wrapper.properties in GradleScripts file change distributionUrl like below
#Thu Apr 12 11:14:54 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
don't forget to clean and rebuild project

Android Studio gives error: Gradle version 2.10 is required. Current version is 2.2.1 in Cordova project?

I have a Cordova/Phonegap application, every time when I rebuild the application using cordova build android it gives me below error.
ANDROID_HOME=/Users/name/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/name/Desktop/Ponet/zoomber/platforms/android/build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'android']
> Gradle version 2.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in /Users/name/Desktop/Ponet/zoomber/gradle/wrapper/gradle-wrapper.properties to gradle-2.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
Total time: 1.256 secs
Error: Error code 1 for command: /Users/name/Desktop/Ponet/zoomber/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/name/Desktop/Ponet/zoomber/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
Recently I have updated my Android Studio 1.5 to 2.1 and imported previous project setting. Problem can be solved if I removed my android platform and add it again and rebuild the application. But this is very time consuming to do. Please provide any suggestions or solutions?
I tried below answers: (not Cordova specific)
Gradle version 2.10 is required. Current version is 2.8 Error
Thank you in-advance!
Edit the /Users/name/Desktop/Ponet/zoomber/gradle/wrapper/gradle-wrapper.properties file and set the distributionUrl property to
https\://services.gradle.org/distributions/gradle-2.14-all.zip
(current version at time of writing)

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!

Categories

Resources