Firebase analytics : not able to add google service plugin in android studio? - android

I have following at project level :
classpath 'com.android.tools.build:gradle:2.1.2'
Works well i have Android Studio 2.1.2
As per project requirement I need to add firebase anaylytics to my project.
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
and
apply plugin: 'com.google.gms.google-services'
while adding all above requirements it gives error as follow
Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
I am stuck with this problem kindly guide if someone has this issue before
moudle level gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.videoapp"
minSdkVersion 17
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'])
compile files('libs/volley.jar')
compile files('libs/picasso-2.4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:9.2.1'
compile 'com.google.firebase:firebase-core:9.2.1'
}
apply plugin: 'com.google.gms.google-services'

Related

This version of rendering library is more recent than your version of Android Studio. Please Update your Android Studio

I am getting the below error in the design editor of layout
I have selected the API version 23 on design editor.
I have installed SDK Tools with version 23
I mentioned buildToolsVersion as "23.0.1" in build.gradle
Still I am not sure why Android Studio is asking to update the Android Studio version.
When i check the Updates in Help menu. It was displayed as below.
When i change the API version from 23 to 21 in Design Editor, I am not getting any Error. But I dont understand why API version 23 is not working in the design Editor even if i have that version installed in SDK Manager.
build.gradle :
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.2'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.apso"
minSdkVersion 18
targetSdkVersion 23
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.7.0'
compile 'com.jakewharton:butterknife:7.0.1'
provided 'com.android.support:support-annotations:23.1.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'

adding firebase auth breaks gradle when in strange configuration

I am trying to use firebase messaging, auth and database in the same project, however when I try and add the auth dependence to gradle, as the firebase 'getting started' guide instructs, I get 2308 298 errors all related to build dependencies.
here is my app specific build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.name.withheld"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
maxProcessCount 4 // this is the default value
javaMaxHeapSize "2g"
}
// Enabling multidex support.
//multiDexEnabled true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
//I originally had all the play services enabled but now as a comment suggested I mm trying split dependencies.
//compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:design:24.1.1'
compile 'com.google.android.gms:play-services-base:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
also any way that I could speed up building would be helpful
edit:
I am still getting errors but this time they are about random com.google.android.gms: dependencies I have never heard of like
play-services-tasks
play-services-basement
LOCAL: internal_impl-24.1.1.jar
and ones I have used previously like
com.android.support:support-v4
com.android.support:recyclerview-v7
is there something that I did wronge to mess up my build enviroment, I am using android studios 2.1.2 on windows 8.1
compile 'com.google.firebase:firebase-auth:9.2.0'
Change all to 9.2.0 and check it once
Try this configuration:
build.graddle (Project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
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
}
}
build.graddle (Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
multiDexEnabled = true
applicationId "com.xxxxxx.xxxxxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 24
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.google.firebase:firebase-storage:9.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.1'
compile 'com.android.support:multidex:1.0.0'
compile 'org.apache.commons:commons-lang3:3.4'
}
apply plugin: 'com.google.gms.google-services'

Android error on running the app

I get the following error while I am trying to run the app.I have earlier updated the Android Studio.Gradle has also been posted below.
Error:
Error:(1, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Could not create plugin of type 'AppPlugin'.
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.jobinsabu.georgetravels"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
}
}
}
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:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
}
Check your grade file and update classpath version here:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
Try to change your classpath version and then update.
Make sure you are connected to internet for gradle syncing.
Hope it may helpful to you.
Thanks,
Bhuvnesh

google play services 8.4.0 - classes.jar not found - android studio

I am getting this error when I Run or Debug the app but when I build or clean my project there are no errors. It sounds strange but I've wasted my 4-5 hours searching for this but nothing was helpful.
Error:
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.> java.io.FileNotFoundException: C:\Users\Saeed Jassani\Downloads\AppName\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified)
build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 9
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.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
}
You can fix this by using alpha6:
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
}
Clean your project and add following dependencies in your project level build.gradle file
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}

Failed to resolve: com.android.support:appcompat-v7.15

I just installed Android Studio on elementary os 0.3.1 (based on Ubuntu 14.04 LTS), but I get the following error:
Error:(24, 13) Failed to resolve: com.android.support:appcompat-v7:15.+
Install Repository and sync project
Show in File
Show in Project Structure dialog
When I click on "Install Repository and sync project", I get this error:
Loading SDK information...
Ignoring unknown package filter 'extra-android-m2repository'
Warning:The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
My build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.android.happybirthday"
minSdkVersion 15
targetSdkVersion 15
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:15.+'
}
My build.gradle (Project: HappyBirthday)
// 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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
From Android Studio go to: Tools >> Android >> SDK Manager
Select and install "Extras|Android Support Repository"
If doesnt help, please post your gradle file.
try to install the option Android Support Library on the menu tools >> Android >> SDK Manager >> SDK Tools (tab).
Before that create a new project, that's worked for me.
Got same errors.
Mac OSX
V. 10.9.5
Android studio 1.4.1
build.gradle:
Before: android { compileSdkVersion 15 buildToolsVersion "19.1.0"
After: android { compileSdkVersion 23 buildToolsVersion "19.1.0"
Before: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:15.+' }
After: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.0' }
AndroidStudioProjects > 'app_name' > app > build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.johnkonderla.condor_paint"
minSdkVersion 16
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.1.0'
compile 'com.android.support:design:23.1.0'
}
Above changes + Build >> Clean Project.
Hope that helps!

Categories

Resources