Failed to resolve: support-v4 - android

I am getting the error Failed to resolve: support-v4 I've tried loads of solutions online but none work. This started happening after I migrated to androidX and after I updated Android Studio.
I've tried changing version around. Im not quite sure if there is any conflicting library's or if that is even an problem. Please help , I'm really struggling.
Thank you in advance
Here are my gradle files;
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.7.0'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
android {
compileSdkVersion setup.compileSdk
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.virtualflight.VirtualHub"
minSdkVersion setup.minSdk
targetSdkVersion setup.targerSdk
versionCode 39
versionName "3.5.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
android {
defaultConfig.applicationId="com.virtualflight.VirtualHub"
defaultConfig {
manifestPlaceholders = [onesignal_app_id: "977e8aef-4b31-4d36-91e4-2555572b9efe",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
customDebugType {
debuggable true
}
}
productFlavors {
}
}
repositories {
mavenCentral()
google()
maven { url 'https://maven.fabric.io/public' }
}
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'
})
//Google dependencies bellow
compile "com.android.support:support-compat:28.0.0"
compile 'com.android.support.constraint:constraint-layout:1.1.3'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:design:28.0.0'
compile 'com.android.support:cardview-v7:28.0.0'
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.thefinestartist:finestwebview:1.2.7'
compile 'com.github.barteksc:android-pdf-viewer:2.8.2'
compile 'com.github.medyo:fancybuttons:1.8.4'
compile 'com.intuit.sdp:sdp-android:1.0.4'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.sothree.slidinguppanel:library:3.4.0'
//MultiDex
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
//Ads
compile 'com.google.android.gms:play-services-ads:11.6.0'
//Firebase Below
compile 'com.google.firebase:firebase-core:11.6.0'
testCompile 'junit:junit:4.12'
//Material search bar
compile 'com.github.mancj:MaterialSearchBar:0.7'
//Mapbox dependencies bellow
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.2#aar') {
transitive = true
}
compile ('com.thoughtworks.xstream:xstream:1.4.7') {
exclude group: 'xmlpull', module: 'xmlpull'
}
compile 'com.onesignal:OneSignal:3.6.5'
compile 'com.mapbox.mapboxsdk:mapbox-android-services:2.1.0'
compile 'com.mapbox.mapboxsdk:mapbox-java-core:2.1.0'
compile 'com.mapbox.mapboxsdk:mapbox-java-services:2.1.0'
compile 'com.mapbox.mapboxsdk:mapbox-java-services-rx:2.1.0'
compile 'com.mapbox.mapboxsdk:mapbox-android-services:2.1.0'
compile 'com.mapbox.mapboxsdk:mapbox-android-telemetry:2.1.0'
compile 'com.mapbox.mapboxsdk:mapbox-android-ui:2.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile files('libs/volley.jar')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "com.android.support:support-core-utils:28.0.0"
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.51'
ext {
setup = [
compileSdk: 28,
buildTools: "26.0.2",
minSdk:19,
targetSdk:28
]
versions = [
supportLib:"27.0.2"
]
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update:
I have also tried Clearing the project. When I do so the following error comes up.
Could not find support-v4.aar (androidx.legacy:legacy-support-v4:1.0.0).Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/legacy/legacy-support-v4/1.0.0/support-v4-1.0.0.aar

you might be missing a dependency:
dependencies {
api "androidx.legacy:legacy-support-v4:1.0.0"
}
Firebase and Google Services are also rather outdated versions... with androidx you should get rid of versions = [supportLib:"27.0.2"] and those 28.0.0 versions. as a migration example:
dependencies {
// compile "com.android.support:support-compat:28.0.0"
api "androidx.core:core:1.0.0"
// compile 'com.android.support:appcompat-v7:28.0.0'
api "androidx.appcompat:appcompat:1.0.0"
// compile 'com.android.support:recyclerview-v7:28.0.0'
api "androidx.recyclerview:recyclerview:1.0.0"
// compile 'com.android.support:cardview-v7:28.0.0'
api "androidx.cardview:cardview:1.0.0"
// compile 'com.android.support:design:28.0.0'
api "com.google.android.material:material:1.0.0-rc01"
// compile 'com.android.support.constraint:constraint-layout:1.1.3'
api "androidx.constraintlayout:constraintlayout-solver:1.1.2"
api "androidx.constraintlayout:constraintlayout:1.1.2"
// compile 'com.google.android.gms:play-services-ads:11.6.0'
api "com.google.android.gms:play-services-base:16.0.1"
api "com.google.android.gms:play-services-ads:16.0.0"
// compile 'com.google.firebase:firebase-core:11.6.0'
api "com.google.firebase:firebase-core:16.0.4"
// androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2"
...
}
see the package mapping.

Related

Multiple dex files define Lcom/getkeepsafe/relinker/SystemLibraryLoader;

I am facing this problem when am trying to build my project -> Multiple dex files define Lcom/getkeepsafe/relinker/SystemLibraryLoader;
I have tried to clean the .gradle, deleting the build folder and reinstalling dependencies but its still not working.
Here is my build.gradle:moduleapp
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
defaultConfig {
applicationId 'com.taxiapp.passenger'
minSdkVersion 17
targetSdkVersion 26
versionCode 13
versionName '1.0.3'
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dexOptions {
javaMaxHeapSize '4g'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
allprojects {
repositories {
mavenCentral()
}
}
/* IMPORTANT :
Be careful when update dependencies, different version library may caused error /
dependencies {
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
}
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'
exclude group: 'com.google.code.findbugs'
})
compile('com.mikepenz:fastadapter:2.0.0#aar') {
transitive = true
}
compile 'com.afollestad.material-dialogs:core:0.9.0.0'
compile 'com.mikepenz:iconics-core:2.8.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.6.0.2#aar'
compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
// compile('pl.droidsonroids.relinker:1.2.2'){
// exclude module: 'pl.droidsonroids.relinker:1.2.2'
// }
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'com.android.support:multidex:1.0.3'
compile 'com.google.guava:guava:19.0'
compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile 'com.google.android.gms:play-services:12.0.1'
compile 'org.greenrobot:eventbus:3.1.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.siyamed:android-shape-imageview:0.9.3'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.balysv:material-ripple:1.0.2'
}
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
And here is my build.gradle:projectmodule
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.realm:realm-gradle-plugin:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please advice what i can do to solve this proplem
Add this string inside dependecies{} in build.gradle:moduleapp
dependencies {
compile 'com.getkeepsafe.relinker:relinker:1.3.1' //this string
}
it seems that you are using a very old ready-made script, I advise you to do everything by yourself.
I recommend you to use 'implement' or 'api' instead of 'compile'
Also don't use
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
always use a specific version to avoid other 'Multiple dex files define' issues, for example.
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.17'
don't forget to rebuild the project by following step in toolbar-menu: Build -> Rebuild Project.

Error:Failed to resolve: firebase-auth-license when synchronizing Android project

I just tried to learn to make an android application, please help me to solve this problem. what's wrong with my code? When I synchronize this code I find an error.
Error:Failed to resolve: play-services-ads
Error:Failed to resolve: play-services-auth
Error:Failed to resolve: firebase-auth-license
build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.realm:realm-gradle-plugin:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (module.app)
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
defaultConfig {
applicationId 'com.mesanonline.passenger'
minSdkVersion 17
targetSdkVersion 26
versionCode 11
versionName '1.1.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dexOptions {
javaMaxHeapSize '4g'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
allprojects {
repositories {
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
mavenCentral()
}
}
dependencies {
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.+'
}
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'
exclude group: 'com.google.code.findbugs'
})
compile('com.mikepenz:fastadapter:2.0.0#aar') {
transitive = true
}
compile 'com.afollestad.material-dialogs:core:0.9.0.0'
compile 'com.mikepenz:iconics-core:2.6.7#aar'
compile 'com.mikepenz:fontawesome-typeface:4.6.0.2#aar'
compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
exclude module: 'support-v4'
}
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.guava:guava:19.0'
compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1#aar'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile 'com.google.android.gms:play-services:12.0.1'
compile 'org.greenrobot:eventbus:3.1.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.siyamed:android-shape-imageview:0.9.3'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.balysv:material-ripple:1.0.2'
}
dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
apply plugin: 'com.google.gms.google-services'
Try to put google() above jcenter() in repositories module.
Firebase Android SDKs and Google Play Services libraries now have independent version numbers.You have to update the google play service gradle plugin version to latest version (at least 3.3.1).
classpath 'com.google.gms:google-services:4.0.1'

ClassNotFoundException: unable to find class "android.support.v4.util.ArrayMap"

The signed apk of my app runs on the android versions higher than 5.0.1 but I am facing this issue that my app crashes immediately after launching the app on version 5.0.1 and this is the error I get -
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.*****1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
please note that the app is not crashing when I run using android studio but it crashes when I run the signed apk.
I don't know what to do, I have gone through a lot of stackoverflow questions but found nothing that can solve my issue. This is my app.gradle file -
**buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' } // for crashlytics
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "*****"
minSdkVersion 21
targetSdkVersion 26
flavorDimensions "default"
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
versionCode 3
multiDexEnabled true
versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dexOptions {
javaMaxHeapSize "2g"
}
}
repositories {
mavenCentral()
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//google 's library
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.android.support:support-v4:26.0.2'
implementation 'com.android.support:support-v13:26.0.2'
implementation 'com.android.support:cardview-v7:26.0.2'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.android.gms:play-services-vision:11.8.0'
//for barcode generation
implementation 'com.google.zxing:core:3.2.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
compile 'me.dm7.barcodescanner:zxing:1.9'
compile 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
//multidex support
compile 'com.android.support:multidex:1.0.1'
//for fancy dialogs
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
compile 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
//for home screen carousal view
compile 'com.synnapps:carouselview:0.1.4'
//for bottom navigation
compile 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
//for shaping the image view
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.jackandphantom.android:circularimageview:1.2.0'
//libraries for retrofit and conversion factory GSON
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
//FilePicker Library
compile 'com.droidninja:filepicker:2.0.8'
//for welcome screen
compile 'com.stephentuso:welcome:1.4.1'
compile 'com.squareup.okhttp3:okhttp:3.9.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.0.1'
compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
//material calender picker
compile 'com.wdullaer:materialdatetimepicker:3.4.0'
implementation 'com.trello:rxlifecycle:1.0'
implementation 'com.trello:rxlifecycle-components:1.0'
compile 'com.polidea.rxandroidble:rxandroidble:1.4.3'
implementation 'com.android.support:design:26.0.2'
compile 'io.reactivex.rxjava2:rxjava:2.0.7'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
//libraries for firebase integration
//for analytics
compile 'com.google.firebase:firebase-core:11.8.0'
//for cloud messenging
compile 'com.google.firebase:firebase-messaging:11.8.0'
//for circular indicator
compile 'com.github.lzyzsd:circleprogress:1.2.1'
compile 'me.biubiubiu.justifytext:library:1.1'
implementation files('libs/imagecapture.jar')
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
}
apply plugin: 'com.google.gms.google-services'**
This is my build.gradle (project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
maven { url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If the gradle version is 3.x.x try to add maven { url 'https://maven.google.com' } to
allprojects {
repositories {
//add here
}
}
instead of google() and sync gradle. It should help. You can see difference between them using this link.
I found the solution. I tried building the Signed apk for both the signature versions V1(jar signature) and V2(full apk signature) and it worked.

Firebase API initialization failure.java.lang.reflect.InvocationTargetException

I have integrated the FCM Database in my Android project. I used it for chat application. Now I need to implement the cloud message(Push notification) using FireBase. After I implement the FCM, I got an error-
Firebase API initialization failure. java.lang.reflect.InvocationTargetException
I am sending the gradle script please have a look.
Module :app
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.swatin.groupchatapplication"
minSdkVersion 16
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'
}
}
}
repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
}
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 project(':libbambuser-0.9.12')
compile 'com.basgeekball:awesome-validation:1.3'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.razorpay:checkout:1.4.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.bumptech.glide:glide:4.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.volley:volley:1.1.0-rc1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.14.2'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (Project: ProjectName)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
To solve this, you need to add the following line of code:
apply plugin: 'com.google.gms.google-services'
As the last line in your build.gradle (Project: ProjectName) file.
And if you are using also authentication, please also this line of code:
compile 'com.google.android.gms:play-services-auth:10.0.1'
I also strongly recommend you to use the latest versions for your Firebase dependencies. The latest version is now: 11.8.0.
The last version for Google Play Services is:
classpath 'com.google.gms:google-services:3.2.0'

Gradle error: JSON standard does not allow such token (android studio 3.0)

i have this problem and relative solution, but i don't know why it works
I just upgraded to Android 3.0 and tried to compile my app. I have a lot of erro in gradle.build if i have this structure (i'll keep the relevant part)
android{
....
}
dependencies {
....
}
and the error is JSON standard does not allow such token
But if i change the structure to
android {
....
dependencies {
....
}
}
(dependecies is INSIDE android object)
the error appears here:
compile '**com.android.support**:support-v4:26.1.0'
compile '**com.loopj.android**:android-async-http:1.4.9'
with another error that says "< value> expected, got ':'"
Any ideas ?
yeah things have changed. do it as follows
This is the best way to do it.
In your root level gradle.build use below
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and in your gradle-wrapper.properties file change the wrapper version as below
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip
also in your app level build.gradle make sure you are using 26 vesion as below
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 16
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'
}
}
}
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.2'
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.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.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.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'

Categories

Resources