I've deployed artifact to bintray as it whitten in documentation (using their plugin). All looks fine. It is opened in browder, structure looks fine: https://dl.bintray.com/flymob/maven/
Now I want to use it via gradle in Android Studio before publishing to jcenter(). I've read their documentation https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_gradle
I've tried:
buildscript {
repositories {
jcenter()
maven {
url "https://dl.bintray.com/flymob/maven"
}
}
}
and
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0'
or
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0#aar'
I'm getting error:
Failed to resolve: flymob-sdk-sample:FlyMobSdk:1.3.0
What am I doing wrong?
you added "https://dl.bintray.com/flymob/maven" inside the buildscript section. Those are the repos used by the buildscript (a.k.a. gradle script) only. Those are the repos where the system will find the plugins from apply plugin
to fix it is easy. Just move it to the repositories on the "root" of the script. Something like:
buildscript {
repositories {
// repos for the build script
jcenter()
... etc
}
dependencies {
// dependencies from the plugins from the build script
classpath 'com.android.tools.build:gradle:2.1.2'
... etc
}
}
apply plugin: 'android-sdk-manager'
apply plugin: ... etc
repositories {
jcenter()
maven { url "https://dl.bintray.com/flymob/maven" } <<<<< HERE
}
dependencies {
compile ... etc
Related
When I add firebase perf dependency into my project i am getting this error Illegal class file: Class module-info is missing a super type. Class file version 53.
My Gradle and google services project-level dependencies are
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
and I followed the exact steps mentioned in their docs https://firebase.google.com/docs/perf-mon/get-started-android.
I have tried clean and rebuild and clearing the Android Studio cache.
And also tried similarly issue resolution from StackOverflow
Project level build gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:perf-plugin:1.3.1' // Performance Monitoring plugin
}
}
allprojects {
repositories {
google()
jcenter()
}
}
App level build gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// Apply the Performance Monitoring plugin to enable instrumentation
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com'
}
}
dependencies {
// Not added all dependencies , Just the firebase one SINCE ITS PRETTY LONG
implementation 'com.google.firebase:firebase-perf:19.0.0'
}
Adding this to your app-level build.gradle file solves the problem temporarily
debug {
FirebasePerformance {
// Set this flag to 'false' to disable #AddTrace annotation processing and
// automatic HTTP/S network request monitoring
// for a specific build variant at compile time.
instrumentationEnabled false
}
}
EDIT as per other answers and comments
Change the gradle plugin to 3.6.0 to resolve it as it has been fixed in that version
FYI, this was an AGP bug...it's been fixed in AGP 3.6
On updating build Gradle from 3.5.1 to 3.6.0 fixed my issue.
Also remove this from gradle.properties if you happen to have it there for any reason:
android.enableR8=false
(I got the error even with com.android.tools.build:gradle:4.1.2 if the above line was present)
I have a project configured through the triple of:
Declare repository in top-level build.gradle:
buildscript { repositories { google() }}
allprojects { repositories { google() }}
Declare classpath dependency, so plugin artifact gets downloaded from the appropriate repository, in top-level build.gradle
buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.1.3' }}
Then, in the app build.gradle file, apply the plugin:
apply plugin: 'com.android.application'
I want to migrate this to use the new plugins DSL as enabled by the PluginsDependenciesSpec.
I then:
Declared the repository in settings.gradle:
pluginManagement { repositories { google() }}
Declared the plugin dependency in the app build.gradle:
plugins { id "com.android.application" version "3.1.3" }
But this fails to resolve:
FAILURE: Build failed with an exception.
Where: Build file '…/build.gradle' line: 2
What went wrong: Plugin [id: 'com.android.application', version: '3.1.3'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'com.android.library:com.android.library.gradle.plugin:3.1.3')
Searched in the following repositories:
Google
BintrayJCenter
maven(https://maven.fabric.io/public)
Gradle Central Plugin Repository
What am I missing to get Gradle to connect the dots here, so that it can connect the plugin.id to the appropriate JAR fetched from the appropriate repository?
Within the pluginManagement you can use resolutionStrategy and force usage of specific artifact from the google() repository.
pluginManagement {
repositories {
google()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id in ['com.android.application', 'com.android.library']) {
useModule("com.android.tools.build:gradle:${getProperty('version.plugin.android')}")
}
}
}
}
Then you can apply android plugins with using new plugins DSL:
plugins {
id 'com.android.application'
}
or
plugins {
id 'com.android.library'
}
Here is the documentation.
So our group has a private maven repository with a large number of libraries 'in-house'. So there only available on a vpn. bintray and jcenter is available on my vpn. What i want to do is have gradle check for a dependency first on the private maven repo, if not found then search bintray/jcenter for the library. How can i do this ? this is what i have tried:
In the top level build.gradle file i have:
buildscript {
repositories {
maven { url "https://myprivateRepo.com/libraries"
}
jcenter()
}
my assumption was that it would first check maven private repo and then check with jcenter afterwards but it seems to not be working, can anyone verify the set up ?
You're adding the repositories for your buildscripts (or plugins). You need to add it to your project / dependencies level.
Using it with buildscript will resolve plugins. You need that e.g. if you are using apt: apply plugin: 'com.neenbedankt.android-apt'
Remove the wrapping buildscript block:
repositories {
maven { url "https://myprivateRepo.com/libraries" }
mavenCentral()
jcenter()
}
dependencies {
compile "my:library:1.0.0"
// ...
}
Alternatively just set it on the project root build.gradle and apply to all projects like this
allprojects {
repositories {
maven { url "https://myprivateRepo.com/libraries" }
mavenCentral()
jcenter()
}
}
Recently I have updated my Android Studio to latest version from Latest Android Studio Canary Build: 2.0 Preview
After updating to the new version, my current working directory stop working at all. Every single time when I am trying to clean and build a project they will give me an error like this
Blockquote
'Error:Could not find com.android.tools.build:gradle:2.0.0-alpha2.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
Required by:
:android 3:unspecified'
Anyone have an idea how to solve this problem. Thanks in advance.
UPDATE: I am using a Mac machine and installation directory look like
Apparently the build tools have been moved from maven to jcenter so you need to change the code from:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
to this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
More details on the changes:
Android Tools Project Site
http://tools.android.com/recent
Android Developer Tools community https://plus.google.com/communities/114791428968349268860/stream/7f20992b-7d9a-4309-9d94-6fbe08f0ad6e
In the main build.gradle file, add jcenter() as main repo, just like that :
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()
}
}
Remove other repositories or make sure jcenter is the first one.
On my side travis build failed with error message "Could not find com.android.tools.build:gradle:3.0.1".
After addeing google() as additional repository the problem was gone.
buildscript {
repositories {
jcenter()
google()
My local build did not fail because i had installed before "com.android.tools.build:gradle:3.0.1" with anddroid-sdk-manager
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories block should be in buildscript.
Check to see if gradle 2.0.0-alpha1 is available on your system. Look in your android/tools/build/gradle folder. In my case, despite the confusing message "This project is using a preview version of the Gradle plugin (2.0.0-alpha2) and a newer version is available (2.0.0-alpha2) You can update to 2.0.0-alpha2." the version in my folder was 2.0.0-alpha1, and changing my build.gradle to:
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
fixed my build problem.
I removed the newest folder gradle-4.1-all in C:\Users\YOUR_USER_NAME\ .gradle\wrapper\dists\ and then I created a new project in Android Studio and the following message disappeared:
"Gradle sync failed: Could not find com.android.tools.build: Gradle:
3.0.0-beta6. "
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried something like
platfoms > android > cordova >lib > builders > Gradlebuilder.js
Downloaded zip and given path
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file\:///C:/MyPC/Documents/softwares/gradle-2.14.1-all.zip';
and linking path is
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven{url "http://jcenter.bintray.com"}
}
}
It worked for me.
this is for Ionic developers *
This seems to be a very long issue(years on the making)...most of the hints are about settings and gradle scripts. After a few days of digging around and backing from BumbleBee to 3.4.2 I kept on getting the same issue no matter what I tried. In the end the gradle on line URLs are blocked for my location due to network ... so easy for Google to say check the access is proper and not keep us blindfolded throwing darts in the dark
I'm trying to add Appdynamics into my application, I'm doing those steps: https://docs.appdynamics.com/display/PRO40/Instrument+an+Android+Application#InstrumentanAndroidApplication-ToaddtheAppDynamicsAndroidagentrepositorytoyourproject but after all I have error:
Error:(15, 13) Failed to resolve: com.appdynamics:appdynamics-runtime:1.0
This is how my build.gradle (for all project) looks like:
buildscript {
configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
repositories {
maven { url uri("adeum-maven-repo") }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3', 'com.appdynamics:appdynamics-gradle-plugin:2.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
and build.gradle (from app module):
apply plugin: 'adeum'
repositories {
flatDir {
dirs 'lib'
}
maven {
url uri('adeum-maven-repo')
}
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:1.0'
and adeum-maven-repo paste into project. Any idea what am I doing wrong?
That error means that gradle is unable to resolve the dependency on com.appdynamics:appdynamics-runtime. The easiest way to fix this problem is to use the AppDynamics libraries from maven central rather than the adeum-maven-repo directory. You can do that by editing your top level gradle file to look like this:
buildscript {
configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.appdynamics:appdynamics-gradle-plugin:4.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Then your project-level gradle file would look like:
apply plugin: 'adeum'
repositories {
flatDir {
dirs 'lib'
}
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:4.+'
}
Note that I have removed the references to adeum-maven-repo, and changed the version numbers on the AppDynamics artifacts to refer to them as they exist in maven central. Once you've done this, you no longer need adeum-maven-repo in your project, since gradle is now downloading these dependencies automatically.