I'm unable to build the Android Fit basic sensors sample due to a missing dependency. I'm new to gradle so I don't know how to fix the build issue. How do I add this missing dependency?
Pre-requisites says:
Android API Level >v9
Android Build Tools >v19
Android Support Repository
My environment:
Android SDK Build-tools: 23.0.5
Android 5.0 (API 21)
Android Support Repository 7
Android Support Library 21
Google Play services 21
Build:
$ gradlew build
Relying on packaging to define the extension of the main artifact has
been deprecated and is scheduled to be removed in Gradle 2.0
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration
':app:_debugCompile'.
Could not find any version that matches
com.google.android.gms:play-services:6.1.+.
Required by: BasicSensorsApi:app:unspecified 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.582 secs
You need to install the Google Repository as well:
https://developer.android.com/sdk/installing/adding-packages.html
Related
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'
I am working in an android project with Android Studio 2.2 that uses OpenCV 3.1.0 library. I imported the library according to this answer. The situation is the following:
When I compile the project for a device with API >= 21 (exactly API 23), everything goes well.
When I compile the project for a device with API < 21 (exactly API 19, the minimum API that I want to support), I get the following compilation error:
Gradle log
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> java.lang.ClassNotFoundException: android.hardware.camera2.CameraAccessException
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)...
I found these similar questions:
Error: package android.hardware.camera2 does not exist OpenCV
Can't import import android.hardware.camera2 classes
In both of them the solution was to set the compileSdkVersion to minimum 21 (the version where camera2 API was introduced) and make sure that build.gradle files of the project and OpenCV match.
Unfortunately, it does not work for me. I still get the same error. Any idea?
My code is available here: Github repository.
Thanks for your help!
Finally, I found a temporal solution thanks to #JavierMollá.
Switching off Instant Run solved the issue. Go to File > Settings > Build, Execution, Deployment > InstantRun and uncheck Enable Instant Run to hot swap code....
Instant Run is a major feature of Android Studio, but unfortunately it seems that it is still work-in-progress... As #AndreKR suggests, it can be related with this issue #212672.
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)
I am working on Monaca.io and try to build android with Google maps plugin by the structions from cordova plugin google maps
After build it shown error below:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
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: 10.305 secs
How do I fix it?
From within Monaca, go to Config -> Manage Plugins. Remove and reinstall the plugin via uploading the master.zip which can be found here: https://github.com/mapsplugin/cordova-plugin-googlemaps
The tutorial you linked to and the instructions followed were for Cordova 3.X. Monaca IDE is currently using 5.2.0. As such and as the tutorial states, the guide will no longer work as it generates the errors you describe.
I m using Android Studio v0.8.6
I have an Android app using google-play-service and I get this error when I try to build:
Executing tasks: [clean, :libraries:BaseGameUtils:generateDebugSources, :app:generateDebugSources]
Configuration on demand is an incubating feature.
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:21.0.2.
Required by:
RIGHTER-android:app:unspecified
RIGHTER-android:app:unspecified > com.google.android.gms:play-services:6.1.11
RIGHTER-android:app:unspecified > RIGHTER-android.libraries:BaseGameUtils:unspecified > com.android.support:appcompat-v7:20.0.0
> Could not find com.android.support:support-v4:21.0.2.
Required by:
RIGHTER-android:app:unspecified > RIGHTER-android.libraries:BaseGameUtils:unspecified
> Could not find com.android.support:support-v4:21.0.2.
Required by:
RIGHTER-android:app:unspecified > com.github.filippudak.progresspieview:library:1.0.4
* 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.405 secs
This Error just happened recently and I didn't update a thing.
Any help will be appreciated, Thanks in advance!
Don't forget to update the Android SDK Manager once in a while :-}
AS I can understand my comment: "Can you check in Android SDK Manager if you have installed Android Support Library 21.0.2?" helped you.
But coming to core of issue. I think, that core of your issue was dependencies part in build.gradle. I strongly believe, that in:
compile 'com.google.android.gms:play-services:x.y.z'
you had somewhere '+', and it means, that version of library, that you are using is not set once, and can change, and this happened with Google Play Services Library.
Always try to put full version number of library, to not have this kind of issues in feature.
Just open the Android SDK manager and install the Android Support Library and the Android Support Repository.