after adding google-services.json also i am getting error like - android

GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
this is my project gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'maven-publish'
apply plugin: "java"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha5'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier "sources"
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
pom.withXml {
asNode().appendNode('description', 'A demonstration of Maven POM customization')
}
}
}
}
this is my app.gardle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/universal-image-loader-1.9.5.jar')
compile project(':databaseAutoCompleteLibrary')
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:gridlayout-v7:23.2.0'
compile project(':MPChartLib')
compile project(':filechooserlibrary')
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v13:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile project(':Volley')
compile 'com.google.code.gson:gson:2.4'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'milyn:opencsv:1.6'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:multidex:1.0.1'
}

Apply this in your app build.gradle file
apply plugin: 'com.google.gms.google-services'
dependencies {
compile 'com.google.android.gms:play-services:8.3.0'
}
In your project build.gradle define
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
allprojects {
repositories {
jcenter()
}
}

Related

Failed to resolve: com.android.support:support-v4:27.1.1. This error occur when i add graphview dependency

I have this gradle in studio.Its works correctly but when i try to add new dependencies of graphView (compile 'com.jjoe64:graphview:4.2.2').It give me that failed to resolve error.
Here is my gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is module gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "28.0.1"
defaultConfig {
applicationId "com.example.yawarabbas.gymcoach_app"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //important
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
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'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-core-ui:26.0.0-alpha1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.romandanylyk:pageindicatorview:1.0.2'
compile 'com.google.code.gson:gson:2.4'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
compile 'com.github.HotBitmapGG:RingProgressBar:V1.2.3'
compile 'com.jjoe64:graphview:4.2.2'
}
How to resolve it? I have read many solutions but it's not work.

Error:Execution failed for task ':app:compileRetrolambdaDebug' - After Firebase integration

I am creating an application with the support of Retrolambda & RxJava2. Everything works fine until I needed to implement push notification functionality. I have configured firebase in my application, since then the execution failed with below error message.
Error:Execution failed for task ':app:transformClassesWithRetrolambdaForDebug'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Top Level Build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Application level Build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.solver.inventory"
minSdkVersion 21
targetSdkVersion 25
versionCode 2
versionName "Beta V2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
//Use “exclude” to point at the specific file (or files) that Android Studio is complaining about//
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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(name: 'aficustomprint', ext: 'aar')
compile('com.github.KingsMentor:MobileVisionBarcodeScanner:v1.2') { transitive = true; }
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.mcxiaoke.volley:library:1.0.6'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
repositories {
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}
retrolambda {
javaVersion JavaVersion.VERSION_1_7
jvmArgs '-noverify'
defaultMethods false
incremental true
}
apply plugin: 'com.google.gms.google-services'
Everything works fine again if I remove the firebase from my application. Please help me out of this.

Plugin with id 'com.android.application' not found

I have an old project, I import this project in my Android studio, i am getting this error.
Yes I searched for it from internet and i found many solutions for that,but non of them solved my issue.
Here is my build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
apply plugin: 'com.android.application'
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// 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
}
Here is My module level build.gradle
here is my build.gradle which is under app>src>build.gradle
apply plugin: 'com.android.application'
//apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.pedrocarrillo.expensetracker"
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2"
}
signingConfigs {
release {
def Properties localProps = new Properties()
localProps.load(new FileInputStream(file('../local.properties')))
storeFile file("tracker_expense.jks")
storePassword localProps["storePass"]
keyAlias localProps["alias"]
keyPassword localProps["pass"]
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
// compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.android.support:gridlayout-v7:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1#aar'
compile 'io.realm:realm-android:0.82.2'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
}
Try This : Project Level Gradle File...
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
// 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
}
Module Level Gradle File...
apply plugin: 'com.android.application'
//apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.pedrocarrillo.expensetracker"
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2"
}
signingConfigs {
release {
def Properties localProps = new Properties()
localProps.load(new FileInputStream(file('../local.properties')))
storeFile file("tracker_expense.jks")
storePassword localProps["storePass"]
keyAlias localProps["alias"]
keyPassword localProps["pass"]
}
}
buildTypes {
release {
signingConfig signingConfigs.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.google.android.gms:play-services:7.8.0'
compile 'com.android.support:gridlayout-v7:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1#aar'
compile 'io.realm:realm-android:0.82.2'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
}
In your top-level file you have to remove this line:
apply plugin: 'com.android.application'

Can't generate signed apk but it works fine

I can run the app and I can use it, but I can't generate signed apk. Here is the log and debug apk is running on some devices only.
Error:Execution failed for task
':app:transformClassesWithJarMergingForRelease'.com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/gson/annotations/Expose.class
Here is my app.gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply plugin: 'com.google.gms.google-services'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileOptions.encoding = 'UTF-8'
signingConfigs {
}
repositories {
//jcenter()
mavenCentral()
maven {
url 'http://repo.brightcove.com/releases'
}
}
defaultConfig {
applicationId "com.asd.asd"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
manifestPlaceholders = [partner: "asd"]
multiDexEnabled = true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
buildTypes {
debug {
buildConfigField 'boolean', 'IS_ENABLE_ADS', 'true'
signingConfig signingConfigs.debug
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile(name: 'MfsAndroidLibrary', ext: 'aar')
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:percent:25.1.1'
//compile 'com.android.support:design:22.2.0'
compile files('libs/gson-2.2.4.jar')
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
compile 'com.brightcove.player:exoplayer:4.+'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.useinsider:insider:6.0.8'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.pitt.fresh.library:freshdownloadview:1.0'
//compile 'cn.pedant.sweetalert:library:1.3'
// compile 'com.tkurimura:flickabledialog:0.9.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
compile 'org.jsoup:jsoup:1.7.3'
compile 'com.afollestad:sectioned-recyclerview:0.2.3'
compile 'com.tonicartos:superslim:0.4.13'
//for select birthday
compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
//image libraries
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.useinsider:insider:6.1.7'
compile 'com.wang.avi:library:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'io.card:android-sdk:5.3.0'
compile 'com.bkm.bexandroidsdk:bexandroidsdk:1.1.2'
}
apply plugin: 'com.google.gms.google-services'
and root gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.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
}
}
allprojects {
repositories {
jcenter()
flatDir{
dirs 'libs'
}
maven { url "http://mobile.useinsider.com" }
maven { url 'https://dl.bintray.com/bkmexpress/maven' }
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I deleted this line
compile files('libs/gson-2.2.4.jar')
added this code and it works
compile ('com.google.code.gson:gson:2.7'){
transitive = true;
exclude module: 'gson'
}

error : com.android.build.transform.api.TransformException

When I want to sync my build.gradle file I have got this error:
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdk1.7.0_75\bin\java.exe'' finished with
non-zero exit value 3
this is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'
apply plugin: 'com.parse'
def AAVersion = '3.3.2'
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.inspius.read247'
}
}
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.parse.com/repo' }
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.parse.tools:gradle:1.+'
}
}
android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION
defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode VERSION_CODE as int
versionName VERSION_NAME
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
repositories {
mavenCentral()
mavenLocal()
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:${SUPPORT_PACKAGE_VERSION}"
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.jeremyfeinstein.slidingmenu:library:1.3#aar'
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'de.keyboardsurfer.android.widget:crouton-library:1.8.2#aar'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'joda-time:joda-time:2.7'
compile 'com.daimajia.numberprogressbar:library:1.2#aar'
compile project(':libraries:pulltorefreshLib')
compile project(':libraries:Simple Facebook')
compile('com.crashlytics.sdk.android:crashlytics:2.2.2#aar') {
transitive = true;
}
compile project(':libraries:libraryPhotoView')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
//parse
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.11.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
}
What should I do?

Categories

Resources