Gradle cannot download from remote maven repository - android

On few github libraries like in here: https://github.com/commonsguy/cwac-endless I found references to repository stored on amazon.
repositories {
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
dependencies {
compile 'com.commonsware.cwac:endless:1.2.3'
}
Problem is, that I can't make it works in gradle to download dependency from this kind of repository.
Here is example of my build.gradle file:
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
}
}
apply plugin: 'android-library'
apply plugin: 'android-maven'
repositories {
mavenLocal()
mavenCentral()
maven {
url "http://repo.commonsware.com/"
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.commonsware.cwac:endless:1.2.3'
compile project(':FontLibrary')
}
I am using Intellij Idea 13 and the result is:
Gradle 'OSKExplorer' project refresh failed:
Could not find com.commonsware.cwac:endless:1.2.3.
Required by:
OSKExplorer:SwipeListViewComponent:unspecified > OSKExplorer:CommonLibrary:unspecified

Don't know if using the https://repo.commonsware.com.s3.amazonaws.com URL did it for you, but I'd put that maven{url} bit in like so:
allprojects{
repositories{
mavenCentral()
maven{ url "https://repo.commonsware.com.s3.amazonaws.com"}
}
}
gl!

replace the https to http like this, http://repo.commonsware.com.s3.amazonaws.com
it's work for me.

The url is not correct. Use this one works for me
maven {url "http://s3.amazonaws.com/repo.commonsware.com" }

Replace
repositories {
mavenCentral()
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
maven {
url "https://jitpack.io"
}
}
with
repositories {
mavenCentral()
maven {
url "http://repo.commonsware.com.s3.amazonaws.com"
}
maven {
url "http://jitpack.io"
}
}

Related

BillingClient and PurchasesUpdateListener classes not available

I'm trying to add in-app billing as described here:
https://developer.android.com/google/play/billing/integrate
and think I have set up dependencies as instructed, but still, both the BillingClient and PurchasesUpdateListener classes as in the code example on the page are not available.
My project's build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.myproject"
minSdkVersion 17
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:19.5.0'
implementation 'com.android.billingclient:billing:3.0.1'
}
My top-level build.gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
How to fix this?
Changing my global build.gradle as follows helped me to resolve the missing dependencies:
buildscript {
repositories {
jcenter()
google()
mavenLocal()
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "http://oss.sonatype.org/content/repositories/releases/" }
maven { url "https://maven.springframework.org/release" }
maven { url "https://maven.restlet.com" }
maven { url "https://jcenter.bintray.com" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
Hopefully this helps someone.
Make sure the global build.gradle is using the latest versions.
Then resyncing will resolve all the issues.

Integrating Crashlytics in a multi-module project

I have an Android project with a main module plus multiple other sub-modules. I integrated Crashlytics in the project successfully, by updating the project-level build.gradle and the main module build.gradle:
Project-level gradle:
buildscript {
repositories {
jcenter()
maven {url 'https://maven.google.com'}
maven {url 'https://maven.fabric.io/public'}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
allprojects {
repositories {
jcenter()
google()
maven {url 'https://maven.fabric.io/public'}
}
}
Main-module build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
...
}
dependencies {
implementation ('com.crashlytics.sdk.android:crashlytics:2.10.1') {
transitive = true;
}
...
implementation project(':modules:sensordata:collection:ambient:module-wifinetwork')
...
}
repositories {
maven { url 'https://dl.bintray.com/rvalerio/maven' }
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
jcenter()
}
build.gradle for module module-wifinetwork (similar for every module):
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility = 1.8
sourceCompatibility = 1.8
}
}
dependencies {
implementation ('com.crashlytics.sdk.android:crashlytics:2.10.1') {
transitive = true;
}
...
}
My problem is that crash reports from the main-module are correctly sent to the firebase backend, while crash reports in other modules are not, even though they are correctly identified, because if I put this command in a class in the sub-module:
Crashlytics.getInstance().crash();
I receive the following:
2019-12-18 10:19:54.328 29944-30002/it.unitn.disi.witmee.sensorlog E/EventBus: Could not dispatch event: class it.unitn.disi.witmee.modules.core.systembus.model.BusObject to subscribing class class it.unitn.disi.witmee.modules.core.systembus.core.SensorlogMainBus
java.lang.ArrayIndexOutOfBoundsException: length=2; index=10
at com.crashlytics.android.core.CrashTest.indexOutOfBounds(CrashTest.java:30)
at com.crashlytics.android.core.CrashlyticsCore.crash(CrashlyticsCore.java:635)
at com.crashlytics.android.Crashlytics.crash(Crashlytics.java:340)
at it.unitn.disi.witmee.modules.sensordatacollection.ambient.wifinetwork.runnables.SensorRunnable.run(SensorRunnable.java:38)
at it.unitn.disi.witmee.modules.sensordatacollection.sensormodule.receivers.StartAllBroadcastReceiver.busEventCallback(StartAllBroadcastReceiver.java:23)
at it.unitn.disi.witmee.modules.core.systembus.core.SensorlogMainBus.onEvent(SensorlogMainBus.java:219)
at java.lang.reflect.Method.invoke(Native Method)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:507)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:501)
at org.greenrobot.eventbus.BackgroundPoster.run(BackgroundPoster.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Any clue why this is not working in the sub-module? Thank you
I found the issue, just had to rebuild the project. So the solution is to add the following elements to the project-level build.gradle and to the main-module build.gradle, nothing to be added to individual modules build.gradle. And then clean and rebuild your project.
Project-level build.gradle:
buildscript {
repositories {
...
maven {url 'https://maven.fabric.io/public'}
...
}
dependencies {
...
classpath 'io.fabric.tools:gradle:1.31.2'
}
}
allprojects {
repositories {
...
maven {url 'https://maven.fabric.io/public'}
}
}
Main-module build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
...
}
dependencies {
implementation ('com.crashlytics.sdk.android:crashlytics:2.10.1') {
transitive = true;
}
...
repositories {
...
}

Cannot add task ':app:reportSourceSetTransformTest' as a task with that name already exists

Minimum supported gradle version 4.6 Current version is 4.4.
After updating gradle version to 4.6, am getting this error
Cannot add task ':app:reportSourceSetTransformTest' as a task with that name already exists.
How can I avoid this error. It seems like two different files have same task. But I didnot find any or explicitly define any task in my app level build.gradle file.
My project level build.gradle file is this:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and app level build.gradle file is this:
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 27
buildToolsVersion '27.0.1'
flavorDimensions "default"
defaultConfig {
applicationId "com.applicationId"
minSdkVersion 16
targetSdkVersion 27
versionCode 3
versionName "1.0.2"
vectorDrawables.useSupportLibrary = true
}
aaptOptions {
cruncherEnabled = false
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
}
dependencies {
implementation project(':demo')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation('junit:junit:4.12')
implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
}
In my case I had a conflict with my flavour name and new gradle plugin.
The problem was solved when I changed the names of my flavours (Production, Test) -> (production, develop)

Android- Could not resolve android.arch.persistence.room:runtime:1.0.0

I've been trying to add room library dependency to my project. but I keep seeing this error:
Error:Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.0.0.
I've searched a lot to solve the problem but I couldn't
build.gradle file of the Project
android {
compileSdkVersion 25
defaultConfig {
applicationId "com.reminder"
minSdkVersion 24
targetSdkVersion 25
buildToolsVersion '26.0.2'
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}
dependencies {
// Room
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}
root build.gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add like this:
allprojects {
repositories {
jcenter()
google()
}
}
and:
dependencies {
// Room
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}
EDIT:
If you are using Offline Mode of Gradle, then disable the offline mode and sync gradle again. You can turn on Offline Mode after successful sync.
Offline Mode:
File > Settings > From left Pane: Build, Execution, Deployment > Gradle
Change "Offline work" to enable/disable Offline Mode

Remote jar not found in build.gradle

In my application (MyApp), I am using an another project(Appox) as library and in this (Appox) project, I want to include bugsense-jar from their repository. Now in build.gradle of Appox, I am including it in this way
apply plugin: 'android-library'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
repositories {
mavenCentral()
maven { url 'http://www.bugsense.com/gradle/' }
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.bugsense.trace:bugsense:3.6'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
sourceSets {
main {
//....
}
}
}
But on compiling I am always getting the error Failed to find com.bugsense.trace:bugsense:3.6
Am I including it in the correct way? Is it possible that the file is not even present in their repo?
Just to bring this up to date, Bugsense has been renamed Mint, so the references to the bugsense.com repo are broken. So, update your Gradle file with the following:
apply plugin: 'android'
repositories {
maven { url "https://mint.splunk.com/gradle/" }
}
dependencies {
compile "com.splunk.mint:mint:4.3.0"
}
From: http://docs.splunk.com/Documentation/MintAndroidSDK/latest/DevGuide/Requirementsandinstallation
If you're updating old code, you'll also need to update your imports and rename any instances of BugSenseHandler in your code to Mint. (http://docs.splunk.com/Documentation/MintAndroidSDK/latest/DevGuide/AddSplunkMINTtoyourproject)
Try something like this :
apply plugin: 'android-library'
buildscript {
repositories {
maven { url 'http://www.bugsense.com/gradle/' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
compile 'com.bugsense.trace:bugsense:3.6'
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
sourceSets {
main {
....
}
}
}
Changes made :
All Maven repositories declared at the same time
mavenCentral() is declared in the last position
Sources :
http://blog.bugsense.com/post/58900337206/gradle-repository-is-now-available-for-bugsense
http://gradleproject.wordpress.com/2013/02/14/multiple-maven-repositories-in-gradle/

Categories

Resources