I want to integrate Twitter sdk to share, i am using compileSdkVersion 22, buildToolsVersion '22.0.1', Followed all the steps given on the fabric site but getting error which gradle sync
Error:(25, 13) Failed to resolve:
com.twitter.sdk.android:twitter:1.12.1
You can use
dependencies {
compile('com.twitter.sdk.android:twitter:1.12.1#aar') {
transitive = true;
}
}
Go through Twitter
I did following changes into my internal build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile project(':google-play-services_lib')
compile 'com.android.support:multidex:1.0.0'
compile ('com.facebook.android:facebook-android-sdk:4.0.0'){
exclude module: 'bolts-android'
exclude module: 'support-v4'
}
compile('com.twitter.sdk.android:twitter:1.12.1#aar') {
transitive = true;
exclude module: 'support-v4'
}
}
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.package.name"
minSdkVersion 14
targetSdkVersion 22
versionCode 13
versionName "1.0"
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
and made following changes to the outer build.gradle file
// 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:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
And it runs fine.
here is the solution for future reference.
add below line of code at top module level build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
//apply plugin: 'realm-android'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
add google-services.json file in the main directory of module.
This is the reference site for how to integrate twitter login with firebase authentication
https://firebase.google.com/docs/auth/android/twitter-login
Related
After upgrading gradle to 4.1 I faced build error that gradle 3.0.1 is not found So I google and found that we should have to add Google() in main repository from this question . But after changing my build.gradle I am facing multidex error and not able to build. Please help.
Old 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:3.0.1'
}
allprojects {
repositories {
mavenCentral()
}
}
}
repositories {
google()
}
New build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
allprojects {
repositories {
mavenCentral()
}
}
}
/*
repositories {
google()
}*/
gradle-wrapper.properties
#Sun Feb 11 23:10:50 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
project .gradle file
apply plugin: 'com.android.library'
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile ('com.google.android.gms:play-services:11.0.0'){
exclude group: 'com.android.support'
}
//acra
compile ('ch.acra:acra:4.9.2'){
exclude group: 'com.android.support'
}
//compile 'com.android.support:appcompat-v7:22.2.0'
compile ('com.android.support:design:22.2.0'){
exclude module: 'support-v4'
}
compile ('com.stripe:stripe-android:4.1.1'){
exclude group: 'com.android.support'
}
/*Retrofit*/
compile ('com.squareup.retrofit2:retrofit:2.3.0'){
exclude module: 'okhttp'
}
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile ('com.android.support:recyclerview-v7:22.2.0'){
exclude module: 'support-annotations'
exclude module: 'support-v4'
}
/*compile ('com.google.android.gms:play-services-auth:8.3.0'){
exclude group: 'com.android.support'
}*/
}
android {
compileSdkVersion 22
buildToolsVersion "26.0.2"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
dexOptions {
preDexLibraries = false
}
}
You can try:
compile ('com.google.dagger:dagger:2.4') {
exclude group: 'com.google.guava'
}
For image processing i want to sync tessaract OCR in Android..i dont knw how to sync..!! when i tried to do some changes it shows "gradle sync failed"..
Here is setting.gradle and build.gradle
// setting.gradle:
include ':app'
include ':libraries:tess-two'
build.gradle of MyApplication:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.raghavan.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
}
build.gradle of tess-two:
// 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:1.5.0'
// 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
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
}
sourceSets.main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
jniLibs.srcDirs = ['libs']
}
}
ParseStarterProject is really, really frustrating. I tried to add Google Play services to compile in build.gradle and it don't wanted to sync. Then I removed it to make it work again, but it showed that there is settings.gradle file missing. When I tried to create it by myself - it fails to save it... Now I have Failed to resolve: com.parse.bolts:bolts-android:1.2.0 and I don't know what to do with it. I want to make a new project from scratch and copy my code, but seems like it's more complicated than just copy & paste.
ParseStarterProject.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.parse'
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.parse.com/repo' }
}
dependencies {
classpath 'com.parse.tools:gradle:1.+'
}
}
dependencies {
compile 'com.parse.bolts:bolts-android:1.2.0'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
}
android {
compileSdkVersion 22
buildToolsVersion "20"
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
/* Uncomment if you enable ProGuard and you want to automatically upload symbols on build.
parse {
applicationId YOUR_APPLICATION_ID
masterKey YOUR_MASTER_KEY
// Make symbol upload automatic. Otherwise, use e.g. ../gradlew parseUploadSymbolsDebug;
uploadSymbols true
}
*/
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:1.1.3'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
ext {
compileSdkVersion = 22
buildToolsVersion = "22"
minSdkVersion = 9
targetSdkVersion = 22
}
I have been getting Top level exception in android studio, i am using appcompat and sliding menu library. I know i am getting the exception because of conflict of Android Support Libraries as explained in some of the previous threads in stackoverflow. I have tried All the the methods shown in threads like including configuraion etc.
here is my Build.gradle(root)
// 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:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
allprojects {
repositories {
jcenter()
}
}
Here is my Build.Gradle(App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
applicationId "com.danaraddi.cprograms"
minSdkVersion 8
targetSdkVersion 21
versionCode 9
versionName "7.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.2'
}
// animations
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.0#aar'
compile 'com.daimajia.androidanimations:library:1.0.8#aar'
}
// inject views
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.jakewharton:butterknife:5.1.2'
}
dependencies {
// Your other dependencies go here
compile project(':library')
}
Here is my Build.Gradle(Lib - SlidingMenu)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
manifest.srcFile 'AndroidManifest.xml'
}
}
}
Here is my Log Cat
Error:Execution failed for task ':app:dexDebug'.
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v7/app/ActionBar$Callback;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
PS : I Have places configuration in root,app build.gradle too , it builds successfully after a clean project and then after the same error.
Add
dexOptions {
preDexLibraries = false
}
instead of
dexOptions {
incremental true
}
to build.gradle file inside the android block
I have been using Eclipse and ADT for building my project. It has been working fine. Recently, I tried migrating my project to Android studio 0.3.7 and I am facing some issues.
My project has a src project, test project, and a library project that successfully get exported from Eclipse.
When I choose the Import Library option, I get the following error.
"Configuration name default not found".
This is my build.gradle for the top level project:
// 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.5.+'
}
}
And this is my settings.gradle,
include ':tests:MyProjectTest'
include ':mylibrary'
include ':
The only modification I have done after the eclipse export is to change the following file:
./gradle/wrapper/gradle-wrapper.properties
To change
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
I changed the above line to use 1.8 instead of 1.6.
Any ideas?
You should do like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/my_lib_jar.jar')
compile project(':mylibrary')
compile 'com.android.support:support-v4:18.0.+'
}
android {
compileSdkVersion 19
buildToolsVersion '19.0.0'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
By the way, your tests must have path 'project_directory/tests/java/package_name/test'
You should have a structure like this:
Root
- MyProjectTest
build.gradle
src
res
- myLibrary
build.gradle
src
res
settings.gradle
build.gradle
In settings.gradle:
include ':MyProjectTest', ':myLibrary'
In myLibrary/build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion XX
targetSdkVersion 19
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
In Project/build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
dependencies {
// Libraries
compile project(':myLibrary')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion XX
targetSdkVersion 19
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
In your script you are using:
classpath 'com.android.tools.build:gradle:0.5.+'
Gradle 1.8 require 0.6.3 version.
You can use
classpath 'com.android.tools.build:gradle:0.6.+'