Twitter Fabric fails to install in Android Studio due to missing dependencies - android

I'm setting up a Cordova project with Fabric to enable signing in with Twitter. I just installed Fabric plug-in into Android Studio but when I sync Gradle files I get the following error:
Information:Gradle tasks [:generateDebugSources, :generateDebugTestSources]
Error:A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.squareup.picasso:picasso:2.3.2.
Searched in the following locations:
https://maven.fabric.io/public/com/squareup/picasso/picasso/2.3.2/picasso-2.3.2.pom
https://maven.fabric.io/public/com/squareup/picasso/picasso/2.3.2/picasso-2.3.2.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:tweet-ui:1.0.3
> Could not find com.android.support:support-v4:21.0.0.
Searched in the following locations:
https://maven.fabric.io/public/com/android/support/support-v4/21.0.0/support-v4-21.0.0.pom
https://maven.fabric.io/public/com/android/support/support-v4/21.0.0/support-v4-21.0.0.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:tweet-ui:1.0.3
> Could not find com.squareup.retrofit:retrofit:1.6.1.
Searched in the following locations:
https://maven.fabric.io/public/com/squareup/retrofit/retrofit/1.6.1/retrofit-1.6.1.pom
https://maven.fabric.io/public/com/squareup/retrofit/retrofit/1.6.1/retrofit-1.6.1.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:twitter-core:1.1.1
> Could not find com.google.code.gson:gson:2.2.4.
Searched in the following locations:
https://maven.fabric.io/public/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom
https://maven.fabric.io/public/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
Required by:
:android:unspecified > com.twitter.sdk.android:twitter:1.1.1 > com.twitter.sdk.android:twitter-core:1.1.1
Android SDK updater gives me Support Library 21.0.3 but not 21.0.0, as suggested here by Hemal from Fabric: Android Twitter Fabric SDK conflict with support library
I have no idea about those other libraries, though. Any thoughts?

Please follow this code example to make sure your build.gradle file is similar:
buildscript {
repositories {
jcenter() // <- *add this
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
// The Fabric Gradle plugin uses an open ended version to
// react quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application' // <- *make sure this is the same
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
jcenter() // <- *add this
maven { url 'https://maven.fabric.io/repo' }
}
I had the same issue, spent half a day on this until opened twitters official documentation and came across this:
https://dev.twitter.com/twitter-kit/android/integrate
Too many answers by the Fabric team on SO and other forums that did not work. This works.

Change jcenter() to mavenCentral() or you can keep both jcenter and mavenCentral
also change url from https://maven.fabric.io/repo to https://maven.fabric.io/public
buildscript {
repositories {
mavenCentral() // <- *add this
maven { url 'https://maven.fabric.io/public' }
}
}

It's not enough to install the fabric plugin, you have to use it too. Clicking on the fabric button in Android Studio guides you through the process of including twitter fabric in your app, it even modifies the build.gradle properly for you (with your permission of course). When you follow the steps given, your build.gradle would be looking like what #AlexVPerl's answer says.

Other answers were outdated for me. I fixed the problem by updating build.gradle according to the latest on the github:
https://github.com/twitter/twitter-kit-android

Related

./gradlew assembleRelease BUILD FAILED with Could not find com.linkedin.dexmaker:dexmaker:2.21.0

It's a react-native project with expo bare workflow.
./gradlew assembleDebug works normally and I'm able to run the app.
However ./gradlew assembleRelease build fails with the following output:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':expo-json-utils:debugAndroidTestRuntimeClasspath'.
> Could not find com.linkedin.dexmaker:dexmaker:2.21.0.
Searched in the following locations:
- file:/Users/<MY USERNAME>/.m2/repository/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
- file:/Users/<MY PROJECT PATH>/node_modules/react-native/android/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
- file:/Users/<MY PROJECT PATH>/node_modules/jsc-android/dist/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
- https://dl.google.com/dl/android/maven2/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
- https://repo.maven.apache.org/maven2/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
- https://www.jitpack.io/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
Required by:
project :expo-json-utils > io.mockk:mockk-android:1.10.6 > io.mockk:mockk-agent-android:1.10.6
expo-json-utils is not listed in package.json dependencies so it must be a child dependency of one of the packages.
Adding jcenter() to android/build.gradle doesn't fix the issue.
Any ideas which package may use expo-json-utils or how to get rid of this issue?
Addidng jcenter() to the settings.gradle solved the issue:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
jcenter() // <- this
}
}
There were 2 problems.
Expo and related packages were updated recently and these lines were still in android/app/build.gradle:
apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
They should be removed.
Still need to add jcenter() to android/build.gradle file's section:
allprojects {
repositories {
Looks like only the latest version 2.28.1 is added to maven central:
https://mvnrepository.com/artifact/com.linkedin.dexmaker/dexmaker-mockito
Older versions are in jcenter and transitive dependency version from expo-json-utils#0.2.0 is 2.21.0

Why removing jcenter() repository fails my Android Application build for sqlite-android:3.36.0

I've updated my Android Application gradle to use AGP 7.0
my gradle repositories resembles this
repositories {
google()
mavenCentral()
jcenter()
}
This shows that JCenter Maven repository is no longer receiving updates: newer library versions may be available elsewhere
When I remove jcenter() my build fails with this error
* What went wrong:
Execution failed for task ':app:mergeDevelopmentDebugNativeLibs'.
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
> Could not find io.requery:sqlite-android:3.34.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/requery/sqlite-android/3.34.1/sqlite-android-3.34.1.pom
- https://repo.maven.apache.org/maven2/io/requery/sqlite-android/3.34.1/sqlite-android-3.34.1.pom
Required by:
project :app > project :background:worker > project :background:database
As my application employs api 'io.requery:sqlite-android:3.34.1'
The requery GitHub README.md file states I need to use the following gradle entry
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
However adding the above does not fix my gradle build error
Where am I going wrong?
I updated to sqlite-android:3.36.0 and stil get...
* What went wrong:
Execution failed for task ':app:mergeDevelopmentDebugNativeLibs'.
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
> Could not find io.requery:sqlite-android:3.36.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/requery/sqlite-android/3.36.0/sqlite-android-3.36.0.pom
- https://repo.maven.apache.org/maven2/io/requery/sqlite-android/3.36.0/sqlite-android-3.36.0.pom
- https://jitpack.io/io/requery/sqlite-android/3.36.0/sqlite-android-3.36.0.pom
Required by:
project :app > project :background:worker > project :background:database
I have identified the issue
When I have this entry my build works:-
implementation 'com.github.requery:sqlite-android:3.36.0'
When I have this entry my build fails:-
api 'com.github.requery:sqlite-android:3.36.0'

Where have google moved the latest gradle tool

For new android studio tool with following build script
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
I am getting following error.
A problem occurred evaluating root project 'android'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
unspecified:unspecified:unspecified
There website shows that we need to add google in buildscript, which is right there.
https://developer.android.com/studio/releases/gradle-plugin

Could not find gradle 2.2.0-rc1

After updating to Android Studio 2.2 RC, it asked me to update gradle plugin to 2.2.0-rc1. When I update I get the following error:
Error:Could not find com.android.tools.build:gradle:2.2.0-rc1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0-rc1/gradle-2.2.0-rc1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.0-rc1/gradle-2.2.0-rc1.jar
Required by:
:my_project:unspecified
Any clues on how I may fix it?
According to: https://code.google.com/p/android/issues/detail?id=221529
The problem is already fixed (exactly: hour ago). Just for sure rebuild your project.
Replace jcenter() instead of mavenCentral() in your project level build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}

Android Studio gradle 2.1.3 issue

Gradle Issue in Android Studio 2.1.3
I got those errors when i run the Desktop application that i've created based on the Tutorial.
where i can find that Gradle 2.1.3? Please help me. Im using Libgdx framework. Thank you in advance.
Error:Gradle: A problem occurred configuring root project 'Flapp Bird'.
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:2.1.3.
Searched in the following locations:
file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom
file:/C:/Users/Unknown/.m2/repository/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.
https:://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.pom
https:://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.1.3/gradle-2.1.3.jar
Required by:
:Flapp Bird:unspecified
The Gradle version 2.1.3 exists, but is not in the Maven central, as said here.
To fix the issue, just add jcenter() after mavenCentral() in your build script.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
No, Ivan is right. The latest version of Android Studio insists on upgrading to Android Plugin for Gradle, Revision 2.1.3 (August 2016), Gradle 2.14.1 or higher and Build Tools 23.0.2 or higher.
But the moment it does that, it breaks compilation with that error:
Could not resolve all dependencies for configuration ':classpath'. Could not find com.android.tools.build:gradle:2.1.3. Searched in the following locations:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.7.3'
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
For me adding this: classpath 'com.android.tools.build:gradle-experimental:0.7.3' did the trick.
AFAIK, the latest version of Gradle is 2.1.2. You might be confusing the gradle version with the gradle plugin. A similar question to yours was also answered over here Just change 'com.android.tools.build:gradle:2.1.3' to 2.1.2and you should be set.

Categories

Resources