Gradle only downloads .aar.asc from Maven Central - android

I freshly deployed an Android library named TypedPreferences. I used it in another Android project for some days. Suddenly, it stopped working - dependencies cannot be found any longer. I noticed that Gradle only downloads one file when I clean the project:
Download http://repo1.maven.org/maven2/info/metadude/android/typed-preferences/ \
1.0.0/typed-preferences-1.0.0.aar.asc
These are build files of my pet project:
build.gradle:
// Top-level build file where you can add configuration
// options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url "${System.env.HOME}/.m2/repository"
}
maven {
url "https://github.com/novoda/public-mvn-repo/raw/master/releases"
}
}
}
app/build.gradle:
apply plugin: 'android'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.+'
compile 'com.android.support:appcompat-v7:19.0.+'
compile 'com.squareup.okhttp:okhttp:1.3.+'
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'
compile 'com.novoda:sqliteprovider-core:1.0.+'
compile 'com.androidmapsextensions:android-maps-extensions:2.1.+'
compile 'com.google.android.gms:play-services:3.2.+'
compile 'info.metadude.android:typed-preferences:1.0.0'
}
As you can see, I also enable Gradle to look into my local Maven cache here:
maven {
url "${System.env.HOME}/.m2/repository"
}
I deleted the relevant folders to avoid Gradle loading stuff from there.
There might be a misconfiguration in the build.gradle files of the library - please find them here:
Library files
Please tell me also whether I can test your fix locally without deploying to Maven Central.

Looks like the packaging element of the published POM has the wrong value. It should be aar, not aar.asc.

Also, you always can force the type of artifact to download. Just add dependency like:
compile "group:artifact:version#type"
And in your case it will be
compile "info.metadude.android:typed-preferences:1.0.0#aar"
That's it.

Related

Setting up Gradle for api 26 (Android)

Since I have upgraded my Nexus 5x to Android O DP3 I am not able to test my applications. I get the error for not having configured my Gradle-file to work with the new API-level (26).
So I changed this and the dependencies, but I keep getting errors on ALL my support libraries like
Failed to resolve: com.android.support:design:26.0.0-beta2
Clicking on
Install repository and sync project
Pops up a progressdialog for downloading the right dependency but does not remove the error. Cleaning up project, installing repositories and then rebuilding the project won't work either.
appcompat-v7
On appcompat-v7:26.0.0-beta2 I get (before even a Gradle sync) squickly lines with the error:
When using a compileSdkVersion older than android-O revision 2,
the support library version must be 26.0.0-alpha1 or lower (was 26.0.0-beta2)
Can someone help me get the gradle file to be configured correctly for Android API 26?
Any help would be appreciated.
PS: I'm using Gradle 3.0.0-alpha3 at the moment but get the same error on Gradle 2.3.2
My Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
applicationId "********"
minSdkVersion 21
targetSdkVersion 26
versionCode 3
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0-beta2'
compile 'com.android.support:design:26.0.0-beta2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:26.0.0-beta2'
compile 'com.android.support:recyclerview-v7:26.0.0-beta2'
compile 'com.redbooth:WelcomeCoordinator:1.0.1'
compile 'com.github.kittinunf.fuel:fuel-android:1.4.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.ramotion.foldingcell:folding-cell:1.1.0'
}
Have you added the google maven endpoint?
Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.
Add the endpoint to your build.gradle file:
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
Which can be replaced by the shortcut google() since Android Gradle v3:
allprojects {
repositories {
jcenter()
google()
}
}
If you already have any maven url inside repositories, you can add the reference after them, i.e.:
allprojects {
repositories {
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.keshav.retroft2arrayinsidearrayexamplekeshav"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
Appart from setting maven source url to your gradle, I would suggest to add both design and appcompat libraries.
Currently the latest version is 26.1.0
maven {
url "https://maven.google.com"
}
...
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
You could add google() to repositories block
allprojects {
repositories {
jcenter()
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
maven {
url "https://jitpack.io"
}
google()
}
}
Appears to be resolved by Android Studio 3.0 Canary 4 and Gradle 3.0.0-alpha4.
you must add in your MODULE-LEVEL build.gradle file with:
//module-level build.gradle file
repositories {
maven {
url 'https://maven.google.com'
}
}
see: Google's Maven repository
I have observed that when I use Android Studio 2.3.3 I MUST add repositories{maven{url 'https://maven.google.com'}} in MODULE-LEVEL build.gradle.
In the case of Android Studio 3.0.0 there is no need for the addition in module-level build.gradle. It is enough the addition in project-level build.gradle which has been referred to in the other posts here, namely:
//project-level build.gradle file
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
UPDATE 11-14-2017: The solution, that I present, was valid when I did the post. Since then, there have been various updates (even with respect to the site I refer to), and I do not know if now is valid. For one month I did my work depending on the solution above, until I upgraded to Android Studio 3.0.0

Error: Cause: Peer not authenticated -- Gradle build of android project

I researched similar questions but none of the answers solved my problem. When I try to build the starter code for a coding assignment I get the following error:
Error: Cause: Peer not authenticated
My gradle files are the following:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.sam_chordas.stockhawk"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
compile 'net.simonvt.schematic:schematic:0.6.3'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.android.support:design:23.1.1'
compile('com.github.afollestad.material-dialogs:core:0.8.5.7#aar') {
transitive = true
}
}
I didn't manage any of those files as I don't have gradle experience yet.
Could you help me to figure out what went wrong?
Thank you very much.
P.S.:
The log files give me this error:
2016-03-23 13:01:29,664 [3912009] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/home/madelenko/Desktop/Stock-Hawk master'
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4-all.zip'.
Followed by a gigantic traceback.

How to build and use Mosby library?

I try to add Mosby library to my pet project, but i cannot understand how to include it to project?
I try to add mosby by add as module-> add as Gradle project, but it not compile.
please, can you link me some tutorial how to add projects (source) into my project and how to use it then (i mean a access to libs classes from my code)?
Thank you!
P.S. Project stores at K:\PetProject. Mosby at: K:\mosby.
settings.gradle (of my project):
include ':app', ':mvp', ':sample-dagger2-rx', ':sample', ':mvp-common', ':viewstate', ':sample-kotlin', ':sample-flow', ':testing', ':sample-mail', ':sample-dagger1'
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta7'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle at myproject\app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "net.simplevolk.mafiagm"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/2'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
}
Mosby should be added to your project by adding the following to the dependencies section in your build.gradle at myproject\app rather than as a module as how you did it.
compile 'com.hannesdorfmann.mosby:mvp:2.0.1'
compile 'com.hannesdorfmann.mosby:viewstate:2.0.1' // optional viewstate feature
As for a tutorial for using Mosby, the url at the top of the Mosby github page links to information about the library including a tutorial about how to use it. I found the walk through of the sample-mail app at http://hannesdorfmann.com/mosby/first-app/ helpful when I started using Mosby.

Cannot add CircularReveal library by ozodrukh in Android studio

I am using Android Studio 1.1.0 and am trying to add CircularReveal library .I have followed the instructions mentioned there.
my build.gradle(Module: app) is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.geronimo.myapplication"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.github.ozodrukh:CircularReveal:(latest-release)#aar'
}
I have added the repository in `build.gradle(Project: MyApplication3)`
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}
The error that I am getting is
D:\Workspaces\AndroidStudio\Studio1.0\MyApplication3\app\build.gradle
Error:(24, 13) Failed to resolve: com.github.ozodrukh:CircularReveal:(latest-release)
Show in File<br>Show in Project Structure dialog
I have tried variations of the dependency too ie:
compile 'com.github.ozodrukh:CircularReveal:(latest-release)#aar'
compile 'com.github.ozodrukh:CircularReveal:(v1.0.4)#aar'
compile 'com.github.ozodrukh:CircularReveal-v1.0.4 #aar'
The error always remains as Failed to resolve...
Is there any other way to import a remote aar file and to add this dependency?
Copy #aar file to the libs directory manually. Then by going to
Files>Project Structure>Dependency
on the right red cross choose library dependency. This will prompt you a dialog where you can search for your dependency and add them.
or
download circularReveal library from github and import it as Module Dependency from Files>Project Structure>Dependency
You need to put only version number without brackets and 'v' char
com.github.ozodrukh:CircularReveal:1.0.4#aar
I had the same problem before. After I checked, I saw that the problem was the miniSDKversion which was lower than 15. Once I changed it to 15, it worked.
minSdkVersion 14 (change it to 15 or above)
targetSdkVersion 26
Then paste this to your library dependency
implementation ('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
Also add remote maven url
repositories {
maven {
url "https://jitpack.io"
}
}

Android Studio gradle sync failed to find library

So I'm working on project in AndroidStudio 0.8.1 beta and I want to make use of a library I found on github (https://github.com/derekbrameyer/android-betterpickers). I add the dependency like it says inside the README.md but when I try to sync the project with the gradle files it says:
Failed to find: com.doomonafireball.betterpickers:library:1.5.2
Here is my build.gradle file:
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId 'gtsarandum.syncc'
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.+'
compile project(':extendedCalendarView')
compile project(':src')
compile 'com.github.gabrielemariotti.cards:library:1.7.3'
compile 'com.github.gabrielemariotti.cards:library-extra:1.7.3'
compile 'com.doomonafireball.betterpickers:library:1.5.2'
}
Last time I had this problem with gabriellemariotti.cards:libraryd:1.7.3 I added maven { url 'http://repo1.maven.org/maven2' } inside the buildscript as you can see above.
Is there something else I have to add? If not, how do I solve this problem?
Many thanks in advance!
My fix was to add:
allprojects {
repositories {
mavenCentral()
}
}
to the build.gradle file
Try alter 'gradle.settings' with an include statement for the path/lib not being found.
Don't use HTTP Proxy. Android Studio -> File -> Settings-> HTTP Proxy -> No proxy

Categories

Resources