Upgrading to Gradle 2.8 breaks my build - android

I was using Gradle 2.2.1 with Android plugin 1.1.3 and I was a happy man.
However, I decided upgrading to Gradle 2.8 and plugin 1.3.1 and I can't build my project. All I get is an error saying:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> java.lang.NoSuchMethodException: com.android.build.gradle.BasePlugin.getLocalVersion()
> Task with name 'xxxxxxxxx' not found in project ':app'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
This happens whenever I try to build from both Android Studio and command-line.
Any ideas?
PS: My configuration uses the wrapper btw.

Related

Flutter Android resource linking failed and Failed to apply plugin [id 'kotlin-android']

Opened a project after 2 months, got null-safety error changed some plugins, and upgraded others, one thing led to another and now I am stuck at this error!
Tried Flutter clean and deleting the build and .gradle folder but nothing worked.
Launching lib\main.dart on RMX1801 in debug mode...
lib\main.dart:1
3
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\Dell\.gradle\caches\transforms-2\files-2.1\b94a6b46912fba96397655c3d1ce5de0\play-services-ads-lite-19.6.0\AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.
* 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 8m 59s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin audioplayers...
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.18.2\android\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating root project 'audioplayers'.
> Failed to apply plugin [id 'kotlin-android']
> The current Gradle version 4.10.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 5.3 or newer, or the previous version of the Kotlin plugin.
* 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 54s
2
Exception: The plugin audioplayers could not be built due to the issue above.
Exited (sigterm)
You're getting a AAPT: error: unexpected element <queries> found in <manifest>. it looks like you have to update your gradle version to one of the ones listed here
https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting
3.3.3
3.4.3
3.5.4
3.6.4
4.0.1
it looks like you need to downgrade your gradle version since you're using 4.10.2

New dependency React native - gradle clean - could not resolve all dependencies

I've recently added a library to my react-native project. The project was running fine before adding this dependency. However, when I try tryi to run it now through react-native run-android I get this error:
File C:\Users\user\.android\repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.onesignal:OneSignal:23.0.1.
Required by:
project :app
> Could not find com.onesignal:OneSignal:23.0.1.
Required by:
project :app > project :react-native-onesignal
* 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 mins 57.711 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Edit: The android emulator is of course running.
After doing som research I figured out that I could try npm uninstall and install, without success. In the build.gradle I have specified my onesignal_app_id, and compile 'com.onesignal:OneSignal:23.0.1' under dependencies. I therefore tried gradle clean which produced this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-onesignal'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 1s
I had similar problem with Cordova.
I fixed by changing version of gradle from 2.2.3 to 2.3.3.
Below oneliner for this:
sed -i -E 's/com.android.tools.build:gradle:2.2.[0-9]+/com.android.tools.build:gradle:2.3.3/g' build.gradle

OSX Gradle too old

Anyways I installed gradle and when I run terminal to compile the app, it says
Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "30ea056c59524902d1004bd520624b7571f1ad77"
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/Test/Desktop/PieMessage/PieMessage-Android/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Could not create plugin of type 'AppPlugin'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I would prefer not to use android studio or intellij because they are not letting me run the class for some reason, the RUN option is greyed out, only the RUN.. is available and that leads to debug.

How to import ActivityLifecycle.zip from developer.android.com into Android Studio?

I'm going through the Android Developer Training, but I'm currently stuck here. I can't figure out how to import the sample project without gradle breaking. These are the results when I use File > New > Import Project
/path/to/activity-lifecycle$ ./gradlew assembleDebug
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find target with hash string 'android-14' in: /home/user/Android/Sdk
* 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: 3.273 secs
EDIT: Android Studio 1.5.1, Gradle 2.8, Java 1.8.0_65, Debian 8.2
EDIT2: Make sure to update activity-lifecycle/app/build.gradle not activity-lifecycle/build.gradle
In build.grandle , make sure you have
compileSdkVersion 22
If it's still not work open the "SDK Manager" and install the SDK.
For shorten:
Open 'Module setting', Goto 'properties' tab, Choose build version and target.

Jenkins gradle build error on integrating crashlytics fabric with Android studio

I am using Jenkins and trying to build Android Studio project which uses the crashlytics new Fabric.
I am also using gradle 2.2.1
I get error from the following in the Jenkins log-
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'io.fabric']
Could not create plugin of type 'CrashlyticsPlugin'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Any help will be appreciated.

Categories

Resources