I added ButterKnife to my android project. Like the documentation says, i added this dependencies to the build.gradle:
dependencies {
...
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}
And i'm getting this error when gradle syncs:
Error:Could not download rxjava.jar (io.reactivex:rxjava:1.1.3): No cached version available for offline mode
Do you know how to fix this?
Thanks.
You should Turn Off the offline gradle build in android studio's gradle settings.
Then it will take the updated library from repo.
Related
I create empty project in android studio 2.3.3 and it by default has compile 'com.android.support:appcompat-v7:26.+' in it's module level build.gradle file and it compiles ok, but when I specify any concrete version from https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-2
gradle sync fails with message
I also tried the following notation compile group: 'com.android.support', name:'v7-appcompat', version: '26.0.0', still no success.
I have
jcenter()
maven {
url "https://maven.google.com"
}
in repositories secion. Install repository and sync project button is not clickable. Support repository is updated:
You misswrote the artefact name. Change it as below:
compile 'com.android.support:v7-appcompat:26.0.0'
to
compile 'com.android.support:appcompat-v7:26.0.0'
Be sure to use:
compileSdkVersion 26
buildToolsVersion "26.0.0"
or later.
Invalidate Cache, go to File > Invalidates Caches
Just click in the Install Repository and sync Project link to install the missing dependencies.
Then sync your project with the gradle files again.
Second solution, try uninstalling an reinstalling Android Support Repository again (I think its similar to clean cache):
Check the error message:
Failed to resolve com.android.support:v7-appcompat:26.0.0'
The right library is appcompat-v7 and not v7-appcompat
Use:
compile 'com.android.support:appcompat-v7:26.x.x'
I'm trying to setup OneSignal push notifocation in my Android app. I have changed my build.gradle to include the required dependencies (or so I think).
No matter what I do I keep getting
Failed to resolve: com.onesignal:OneSignal:3.4.3
or
Could not find com.onesignal:OneSignal:3.4.3
Can anyone give me a slight push please? Thanks in advance :-)
I should mention that I have checked the trouble shooting section on OneSignals home page. All is in order.
Here's the dependencies section of my gradle file:
dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.firebase:firebase-analytics:9.6.0'
compile 'com.google.firebase:firebase-crash:9.6.0'
compile files('src/main/libs/simple-xml-2.7.jar')
compile files('src/main/libs/date4j.jar')
compile files('src/main/libs/picasso-2.5.2.jar')
compile 'com.onesignal:OneSignal:3.4.3#aar'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
}
The OneSignal SDK is hosted on Maven Central so I would first make sure you can access this from your system. Next double check the following as well.
Make sure you're using Android Studio version 1.4.0 or newer.
Go to File>Settings. Search for Offline work and uncheck that option.
Add the following to your .gradle file.
Root build.gradle
repositories {
mavenCentral()
}
4. Try restarting Android Studio and then going to Tool>Android>Sync Project again.
5.Try building OneSignal's example Android Studio project. If this works then the problems is related to your project.
Screenshots for some of these steps below.
https://documentation.onesignal.com/docs/troubleshooting-android
Well... what finally fixed this issue for me was to replace
mavenCentral()
with
jcenter()
go figure... :-)
I really do not understand why it was always so much trouble of adding Gradle plugin in the Android app.
I started my project by creating a fresh app.
This is in my gradle.properties:
distributionUrl = https \: //services.gradle.org/distributions/gradle-3.0-all.zip
and this project and says build.gradle:
buildscript {
repositories {
jcenter ()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0'
}
}
and the error I get is
The build tools for Android do not support version 3.0 at present.
If you check the gradle build tool project on Bintray, you can see the latest available versions.
At present, that is 2.2.0-rc1 so to use it you should add this to your project-level build.gradle:
compile 'com.android.tools.build:gradle:2.2.0-rc1'
If you want to use the latest stable version 2.1.3 replace it with,
compile 'com.android.tools.build:gradle:2.1.3'
You should also checkout tools.android.com for the latest up-to-date information on the Android Build Tools
Adding a gradle project with compile has been working for me very well, but I noticed after updating the Android studio to 1.2.2, or maybe the version just before it, that adding a library is not working anymore.
So for example I tried to add this and I did the "Sync Now" and it was successful but the library doesn't seem to be recognized. When I try to use ProgressWheel in Java and I hit ctrl+Enter it doesn't find the library, anyone have an idea of what should I do?
dependencies {
compile 'com.android.support:support-v4:21.0.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/universal-image-loader-1.9.3.jar')
compile 'com.romainpiel.shimmer:library:1.4.0#aar'
//the above libraries were added before the update, everything was
//working fine, the below isn't
compile 'com.pnikosis:materialish-progress:1.5'
}
Please note that I tried many other libraries and all had the same result.
The project README (front page of https://github.com/pnikosis/materialish-progress) says it's on Maven Central. Android Studio uses jCenter (by Bintray) by default. Add this in your module's build.gradle file:
repositories {
mavenCentral()
}
I've taken an Android project that was created in IntelliJ and imported it into AndroidStudio. After looking at Googles hopeless instructions for how to migrate a project to Gradle I pressed buttons at random and prayed to the gods of droid whilst sacrificing a small innocent child and somehow eventually ended up with a Gradle controlled project that synced, built and ran on my Android devices.
I then added some additional dependencies to my build.gradle file:
compile 'com.octo.android.robospice:robospice:1.4.12'
compile 'com.octo.android.robospice:robospice-spring-android:1.4.12'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.http-client:google-http-client-jackson:1.18.0-rc'
compile 'com.octo.android.robospice:robospice-google-http-client:1.4.12'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
Now when I try to sync Gradle I get the following message:
Gradle Project sync Failed. Basic functionality (e.g. editing, debugging) will not work properly.
In the Gradle Sync window I get the following messages:
Unresolved Dependencies:
Error:com.google.http-client:google-http-client-gson:1.18.0-rc
Error:com.octo.android.robospice:robospice-spring-android:1.4.12
...
and so on for each of the dependencies that I have listed.
How might I resolve this?
OK I've figured it out.
I added
allprojects {
repositories {
mavenCentral()
}
}
to the bottom of my build.gradle file.
It was obviously struggling to find a repository to load from.
The script already had
buildscript {
repositories {
mavenCentral()
}
This it would seem was insufficient.