I think there is a bug in android studio when i try to use lottie library
from lottie introduction :
Gradle is the only supported build configuration, so just add the dependency to your project build.gradle file:
dependencies {
...
compile 'com.airbnb.android:lottie:2.2.5'
... }
I've added the dependency , but project is not sync and not being built.
-here is complete error :
Error:Execution failed for task ':app:prepareComAndroidSupportAnimatedVectorDrawable2610Library'.
Unable to unzip 'C:\Users\ramin\.gradle\caches\modules-2\files-2.1\com.android.support\animated-vector-drawable\26.1.0\abdf83a0192c03ff190f941c6c885af18d257a2c\animated-vector-drawable-26.1.0.aar' to 'C:\Users\ramin\.android\build-cache\6b7ed6c6f6a25dd18477727c16a13e0789c57b4e\output'
any idea ?
build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "chavosh.com.bztebuses"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile 'com.github.devlight.navigationtabstrip:navigationtabstrip:1.0.4'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.boxme:squarecamera:1.1.0'
compile 'com.minimize.library:seekbar-compat:0.2.5'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.github.medyo:fancybuttons:1.8.4'
compile 'com.airbnb.android:lottie:2.2.5'
}
allprojects {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/gigamole/maven/" }
maven { url "http://dl.bintray.com/ahmedrizwan/maven" }
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Related
I get the error message Gradle sync failed. I already searched for solutions on stackoverflow and found similar problems but the solution there could not solve my problem:
Example-->
syncing android gradle appcompat 27.0.1
build Gradle//Project is like this-->:
buildscript {
repositories {
jcenter()
maven { url "http://jcenter.bintray.com"}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
mavenCentral()
jcenter{ url "http://jcenter.bintray.com/" }
maven {
//url "https://jitpack.io"
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and the build gradle module is like this-->:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "hibo.testxml"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:27.3.1'
// FireBase
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
testCompile 'junit:junit:4.12'
}//Add this line
apply plugin: 'com.google.gms.google-services'
I hope somone can help me solve this problem.
ps:thanks in advance :D
By The way your problem is that you are using different versions for build tools and in dependencies.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "hibo.test"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:25.3.1'
// FireBase
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
testCompile 'junit:junit:4.12'
}//Add this line
apply plugin: 'com.google.gms.google-services'
Now use this in your gradle. May be you have not 27.0.3 install. Then an error will come in gradle Console. Then install these tools by clicking the error.
I have Android Studio 3.0.1. After added new library, when I tried launching the app it did not launch with the message:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
But I don't know how to solve this error. I googled this but with no success.
My app gradle:
apply plugin: 'com.android.application' android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.xxxxxxx.app"
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
versionCode 3
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile 'com.android.volley:volley:1.0.0'
compile files('libs/KGJsonConverter.jar')
compile files('libs/gson-2.2.4.jar')
compile 'com.github.amigold.fundapter:library:1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/PhotoUtil.jar')
compile files('libs/GenAsync.1.2.jar')
compile files('libs/MD5Simply.jar')
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.quickblox:quickblox-android-sdk-core:3.3.0'
compile 'com.quickblox:quickblox-android-sdk-chat:3.3.0'}
my project gradle:
buildscript {
repositories {
jcenter()
google()
} dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'}}allprojects {
repositories {
jcenter()
google() maven{ url 'https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/'}}}task clean(type: Delete) { delete rootProject.buildDir}
Use the dependencies below.
compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:3.3.3#aar'
compile 'com.quickblox:quickblox-android-sdk-content:3.3.3#aar'
compile('com.quickblox:quickblox-android-sdk-chat:3.3.3#aar') {
transitive = true
}
when I place the
apply plugin: 'com.google.gms.google-services'
in library module in app level it show an error like
'Could not get unknown property 'LibraryVariants' for object of type com.android.build.gradle.LibraryExtension'
So I removed the plugin it build successfully. But the data is not store in FireStore. How can I store the data when I place the plugin in library module.
How to solve that problem ?
Root level app module :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.vijayasrivudanti.pages"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.stripe:stripe-android:4.1.5'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.android.gms:play-services:11.4.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-firestore:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
testCompile 'junit:junit:4.12'
compile project(':pays')
}
apply plugin: 'com.google.gms.google-services'
Library app module :
// enter code here
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.stripe:stripe-android:4.1.5'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.android.gms:play-services:11.4.2'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-firestore:11.4.2'
//compile project(':ReactAndroid')
//compile (project(':react-native-firestack')){exclude group: 'com.google.android.gms' }
}
apply plugin: 'com.google.gms.google-services'
Add the below in your root build.gradle file
classpath 'com.google.gms:google-services:3.1.0'
In a library module, you do not need to add the plugin; you can directly use the compile repo of Google services. Just make sure it is there in app level build.gradle file.
Below is a sample whole file:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.firebase:firebase-plugins:1.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
jcenter()
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
here is a sample app level build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.ncommunity.agriculture"
minSdkVersion 15
targetSdkVersion 26
versionCode 11
versionName "1.10"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
resValue("string", "PORT_NUMBER", "8081")
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
debugCompile project(':debug-db')
compile project(':tracker')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.3'
/* compile 'com.google.android.gms:play-services:11.4.0'*/
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-crash:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.github.Kunzisoft:Android-SwitchDateTimePicker:1.7'
compile 'com.github.safetysystemtechnology:location-tracker-background:v1.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:26.1.0'
testCompile 'junit:junit:4.12'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
After updating android studio and several dependencies i now get this error message
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzeg.class
this is my gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "REMOVED_FOR_PRIVACY"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.firebaseui:firebase-ui:1.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:mediarouter-v7:26.0.2'
compile 'com.google.android.gms:play-services-location:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-crash:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-perf:11.2.0'
compile 'com.firebaseui:firebase-ui-auth:2.0.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:design:26.0.2'
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support:multidex:1.0.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I already tried Cleaning and Rebuilding the project but nothing seems to work
okay what seemed to actually work was replacing
'com.google.android.gms:play-services-location:11.2.0'
with
'com.google.android.gms:play-services:11.2.0'
Bump up your build tool version to:
buildToolsVersion "26.0.2"
And exclude Play Services from Facebook, for example
compile ('com.facebook.android:facebook-android-sdk:[4,5)'){
exclude group:"com.google.android.gms"
}
I'm getting this error
Error:Could not find com.android.tools.build:gradle-core:3.0.0-alpha5.
Searched in the following locations:
file:/C:/Program Files/Android/android-studio-3/gradle/m2repository/com/android/tools/build/gradle-core/3.0.0-alpha5/gradle-core-3.0.0-alpha5.pom
file:/C:/Program Files/Android/android-studio-3/gradle/m2repository/com/android/tools/build/gradle-core/3.0.0-alpha5/gradle-core-3.0.0-alpha5.jar
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0-alpha5/gradle-core-3.0.0-alpha5.pom
https://jcenter.bintray.com/com/android/tools/build/gradle-core/3.0.0-alpha5/gradle-core-3.0.0-alpha5.jar
Required by:
project : > com.android.tools.build:gradle:3.0.0-alpha5
My gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.the360ls.a360"
minSdkVersion 19
targetSdkVersion 26
versionCode 10
versionName "0.8.1e"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
buildscript {
repositories {
jcenter()
maven { url 'https://dl.google.com/dl/android/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha6'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://raw.github.com/Tpaga/tpaga-android-sdk/releases"
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-beta2'
compile 'com.android.support:design:26.0.0-beta2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:cardview-v7:26.0.0-beta2'
compile 'com.android.support:recyclerview-v7:26.0.0-beta2'
compile 'com.android.support:support-vector-drawable:26.0.0-beta2'
compile 'com.android.support:support-v4:26.0.0-beta2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-database:11.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
testCompile 'junit:junit:4.12'
compile 'co.tpaga:android:1.0.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
I dont know how to fix it, Im tryng everything
change the dependencies
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
change the gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
Change
dependencies in "build.gradle" with existing latest version of the android studio
change the "distributionUrl" in gradle-wrapper.properties to latest version
My version is "Android Studio 3.0 Canary 7" and my changes are as follows
1.dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
}
2.
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip