After an update I made on 27-03-2018, my gradle sync is failing.I am getting the error
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2.
I am posting my gradle files below. I have tried cleaning and rebuilding the project, but it is still not working.
Project level gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.loopj.android:android-async-http:1.4.9'
// 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
}
App level gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId 'app.myapp.com'
minSdkVersion 15
targetSdkVersion 25
versionCode 33
versionName "1.1.30"
useLibrary 'org.apache.http.legacy'
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':android-async-http-1.4.9')
// compile 'com.daimajia.androidanimations:library:1.0.3#aar'
compile project(':PayTabs_SDK_NOSCAN')
compile('com.twitter.sdk.android:twitter:1.14.1#aar') {
transitive = true;
}
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
compile files('libs/signpost-core-1.2.1.2.jar')
// Discovery and Outlook services
compile('com.microsoft.services:discovery-services:1.0.0#aar') {
transitive = true
}
compile('com.microsoft.services:outlook-services:1.0.0#aar') {
transitive = true
}
compile 'org.sufficientlysecure:html-textview:3.3'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'cz.msebera.android:httpclient:4.3.6'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'org.codepond:wizardroid:1.3.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.zxing:core:3.2.0'
compile 'io.card:android-sdk:5.3.0'
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'me.dm7.barcodescanner:zbar:1.8.2'
compile 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.cloudrail:cloudrail-si-android:2.11.0'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.ss.bannerslider:bannerslider:1.8.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.7.3'
// compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
I tried all that I know, but nothing is working for now. Android Studio and Gradle are updated to the latest version. The app used to work before the update. I followed the instructions in developer.android.com about gradle migration, but nothing is mentioned there that might help me with the issue.
I am posting the error I get here
Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2.
Searched in the following locations:
https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom
https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar
Required by:
project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1
project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.build:builder:3.0.1
project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1
project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.build:builder:3.0.1 > com.android.tools:sdk-common:26.0.1
project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.build:builder:3.0.1 > com.android.tools:sdklib:26.0.1 > com.android.tools:repository:26.0.1
project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1 > com.android.tools.lint:lint-checks:26.0.1 > com.android.tools.lint:lint-api:26.0.1
i too came up with the same issue. seems like android studio seeking to update the kotlin plugin as well.
go to Tools > Kotlin > Configure Kotlin Plugin Update and update the plugin.
then restart studio, and it will sync the gradle on restart.
I found the answer. I changed the versions of gradle plugins.I am adding my Gradle files below
Project Level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.1.1'
classpath 'com.loopj.android:android-async-http:1.4.9'
// 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
}
App Level build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId 'app.ecopon.com'
minSdkVersion 15
targetSdkVersion 25
versionCode 33
versionName "1.1.30"
useLibrary 'org.apache.http.legacy'
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':android-async-http-1.4.9')
// compile 'com.daimajia.androidanimations:library:1.0.3#aar'
compile project(':PayTabs_SDK_NOSCAN')
compile('com.twitter.sdk.android:twitter:1.14.1#aar') {
transitive = true;
}
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
compile files('libs/signpost-core-1.2.1.2.jar')
// Discovery and Outlook services
compile('com.microsoft.services:discovery-services:1.0.0#aar') {
transitive = true
}
compile('com.microsoft.services:outlook-services:1.0.0#aar') {
transitive = true
}
compile 'org.sufficientlysecure:html-textview:3.3'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'cz.msebera.android:httpclient:4.3.6'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'org.codepond:wizardroid:1.3.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.zxing:core:3.2.0'
compile 'io.card:android-sdk:5.3.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'me.dm7.barcodescanner:zbar:1.8.2'
compile 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.cloudrail:cloudrail-si-android:2.11.0'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.ss.bannerslider:bannerslider:1.8.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.7.3'
compile 'com.github.barteksc:android-pdf-viewer:2.8.2'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
Now, everything is working perfectly
Found a solution to this. You need to add google() to the buildscript and allprojects repository section as below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
1- Go to http://services.gradle.org
2- Go to Distributions
3- Click on the latest one to download it (I downloaded "gradle-4.6-rc-2-all.zip")
4- Unzip or Extract it
5- In Android Studio go to File > Settings > Build, Execution, Deployment > Gradle > Use local gradle distribution > then choose the file (that you just download and unzip it) from your computer
6- Click Ok
7- Inside "build.gradle(Module:app)" make sure that compileSdkVersion and targetSdkVersion are same
8- Click Sync Now
Resource: https://www.youtube.com/watch?v=q_qWUQNbFLY
Change your Buildscript part of your build.gradle To this , Actully Remove google() & jcenter(). This Worked for me.
buildscript {
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
You could try updating your Kotlin version and maybe add https://maven.google.com to the repositories tag of allProjects.
Your project level build.gradle should look something like this afterwards:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.loopj.android:android-async-http:1.4.9'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Besides that, try cleaning the project and maybe removing your .gradle folders manually
Try to invalidate cache(did it a few times) or reinstall studio, or check gradle-wrapper.properties distributionUrl should be like this:
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Related
My project suddenly couldn't build gradle. The following Error happens:
Error:Failed to resolve: play-services-basement
Here is my build.grdle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
As I searched, there were two solutions:
add jcenter{url "http://jcenter.bintray.com/"} instead of jcenter()
move google() before jcenter()
but none worked. What Should I do?
tnx
P.S
I know my question is similar to this and this but the solutions doesn't work for me.
update 1:
app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.my.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "0.7"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
google()
jcenter()
}
dependencies {
implementation 'com.android.support:recyclerview-v7:26.1.0'
// implementation 'com.google.firebase:firebase-core:16.0.1'
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 'im.crisp:crisp-sdk:0.1.10'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
compile 'com.stephentuso:welcome:1.4.1'
compile 'co.ronash.android:pushe-base:1.4.0'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:customtabs:26.1.0'
// compile 'com.google.firebase:firebase-auth:16.0.2'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.code.gson:gson:2.7'
compile('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
udpate2:
project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I imported my project and since then I have been getting this error.
There is no error when I just build the project or use 'sync project with gradle files' option.
I am getting this error while trying to build the apk:
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/auth/api/signin/zzc.class
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.mahe.myapplication"
minSdkVersion 20
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
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.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:customtabs:26.0.1'
compile 'com.android.support:design:26.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'maven'
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
this is the build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
apply plugin: 'maven'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.1'
}
}
}
}
Please refer: https://github.com/firebase/FirebaseUI-Android#dependencies
You must use FirebaseUI version 2.2.0 (not 0.6.2) with Firebase/GooglePlay version 11.0.4
By the way, you can also remove this section from the app/build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
My gradle sync fails because of this error:
I don't know exactly what is wrong with my gradle configuration (It must be something with maven import). Here are the files:
build.gradle (Top level)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
maven { url 'https://repo.spring.io/libs-milestone' }
flatDir {
dirs 'libs'
}
}
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.confidential.packageid"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res-img']
}
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name:'sdk-release', ext:'aar')
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.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.android.support:support-v4:25.3.1'
...
testCompile 'junit:junit:4.12'
...
compile 'com.noveogroup.android:androidlogger:1.3.6'
compile 'com.github.ybq:Android-SpinKit:1.0.5'
}
apply plugin: 'com.google.gms.google-services'
Which part of my gradle files is wrong?
Well, this exists... https://jcenter.bintray.com/com/noveogroup/android/android-logger/1.3.6/
(You're missing a dash. android-logger)
And maybe follow directions here? https://github.com/ybq/Android-SpinKit#gradle-dependency
For example,
allprojects {
jcenter()
// mavenCentral()
repositories {
maven { url "https://jitpack.io" }
...
}
Remember: jcenter() is a superset of mavenCentral()
Android buildscript repositories: jcenter VS mavencentral
Then, regading other things
// compile 'com.android.support:appcompat-v7:25.3.1' // not needed
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1' // Should really use 'database' or 'messaging' instead
compile 'com.google.android.gms:play-services:10.2.1' // Should be split
// compile 'com.android.support:support-v4:25.3.1' // not needed
Refer to "Selectively compiling APIs into your executable" https://developers.google.com/android/guides/setup
On my new project i would like to integrate Crashlytics from Fabric.io
I've already installed Fabric on others projects without issue, one project with the tutorial here : https://fabric.io/kits/android/crashlytics/install
And on the other project, I've using the plugin Fabric integrated into Android Studio (picture)
here's the problem :
import android.app.Application;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
public class UILApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics()); // Fabric not found
}
}
Error:(6, 31) error: package com.crashlytics.android does not exist
Error:(7, 29) error: package io.fabric.sdk.android does not exist
Error:(20, 31) error: cannot find symbol class Crashlytics
Error:(20, 9) error: cannot find symbol variable Fabric
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugJavaWithJavac FAILED
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
my build.gradle (Project) :
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
build.gradle (Module:app) :
buildscript {
repositories {
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
// maven { url 'https://maven.fabric.io/public' } THIS LINE FORGOTTEN
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
//classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: "com.android.application"
//apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
// maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion = 24
buildToolsVersion = "23.0.3"
defaultConfig {
applicationId "agemos.testkalman1"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-SNAPSHOT#aar'){
transitive=true
}
// // Crashlytics Fabric io
// compile('com.crashlytics.sdk.android:crashlytics:2.6.3#aar') {
// transitive = true;
// }
}
I've change compileSdkVersion 23 to 24 but nothing has changed, someone had this problem ?
Thanks in advance for your help :)
I've forgot one line
Now it works ! sorry for the inconvenience ^^'
Mike from Fabric here.
It appears that you've commented out all initialization of Fabric in your build.gradle? If you un-comment the lines below, that should work.
classpath 'io.fabric.tools:gradle:1.+'
apply plugin: 'io.fabric'
maven { url 'https://maven.fabric.io/public' }
// Crashlytics Fabric io
compile('com.crashlytics.sdk.android:crashlytics:2.6.3#aar') {
transitive = true;
}
The full build.gradle would have all of the following changes:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.3#aar') {
transitive = true;
}
clear and Rebuild and Restart Android Studio Its Working
build.gradle project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle module
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.holostik.ozoneoverseas"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
defaultConfig {
multiDexEnabled true
}
}
dependencies {
// TODO FCM
// implementation 'com.google.firebase:firebase-messaging:11.0.4'
//compile 'com.google.firebase:firebase-messaging:11.0.4'
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.+'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'me.dm7.barcodescanner:zxing:1.9.7'
compile 'com.android.support:cardview-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.volley:volley:1.0.0'
// compile 'com.google.android.gms:play-services-location:7.8.0' // TODO Previous working
// compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.google.android.gms:play-services-location:11.0.4'
// compile "com.google.android.gms:play-services-gcm:9.2.0"
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
//TODO camera Crop dependency working
// compile files('libs/ksoap2-android-assembly-2.5.7-jar-with-dependencies.jar')
// implementation 'com.google.firebase:firebase-messaging:11.0.4'
// compile 'com.google.android.gms:play-services:11.4.0'
compile 'com.google.android.gms:play-services:11.0.4'
// compile 'com.facebook.android:facebook-android-sdk:4.8.0' // Works here
compile 'com.facebook.android:facebook-android-sdk:4.13.1' // Works here
compile('com.crashlytics.sdk.android:crashlytics:2.9.0#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:2.0.2#aar') {
transitive = true;
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
/*buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}*/
// TODO FCM
//apply plugin: 'com.google.gms.google-services' // TODO FCM add auto in Bottom When Google Service Add uncomment this
//dependencies {
// implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:26.1.0'
// implementation 'com.android.support.constraint:constraint-layout:1.0.2'
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.1'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//}
crashlytics {
enableNdk true
androidNdkOut 'src/main/obj'
androidNdkLibsOut 'src/main/libs'
}
manifest.xml
<meta-data
android:name="io.fabric.ApiKey"
android:value="1864e6d3e59158a5206d2d073e7e14c7ad811cbd" />
Splash Activity
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
}
Error:Execution failed for task ':app:incrementalDebugJavaCompilationSafeguard'.
java.io.IOException: Could not delete folder
C:\Users\XXXX\AndroidStudioProjects\XXXX\app\build\intermediates\classes\debug\com\bluejamesbond
Its a fresh instaltion of Android Studio en Windows 8 and the app was running after that but in Windows 7.
My gradles
// 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:2.1.2'
classpath 'com.google.gms:google-services:3.0.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
}
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
}
}
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.XXX.XXX"
minSdkVersion 15
targetSdkVersion 23
versionCode 23
versionName "1.9.6"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':volley')
compile('com.github.worker8:tourguide:1.0.16-SNAPSHOT#aar') { transitive = true }
compile('com.crashlytics.sdk.android:crashlytics:2.6.0#aar') { transitive = true; }
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
compile 'com.bignerdranch.android:expandablerecyclerview:2.1.1'
compile 'com.github.clans:fab:1.6.2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:1.0.0'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.sothree.slidinguppanel:library:3.2.1'
compile 'io.card:android-sdk:5.3.4'
compile 'com.github.techery:ProperRatingBar:v0.0.3'
compile ('com.mercadopago:sdk:BETA_WORKSHOP#aar') { transitive = true }
compile 'com.android.support:palette-v7:24.0.0'
compile 'com.github.arimorty:floatingsearchview:2.0.1'
compile ('com.lamudi.phonefield:phone-field:0.0.8#aar') { transitive = true }
compile 'com.android.support:support-vector-drawable:24.0.0'
compile 'com.android.support:animated-vector-drawable:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-appindexing:9.2.0'
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-auth:9.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.1'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
Thanks!
I have this problem after moving my project folder. I solve it by cleaning it.
Build>Clean Project, then rebuild it Build>Rebuild Project.