This is my app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.fitness.perspactive"
minSdkVersion 17
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'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-firestore:10.2.1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is my project gradle file
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In my application I used Firebase realtime database. Later on, when I also tried to include cloud Firestore, it isn't syncing.
When I tried to sync it, it shows:
Failed to resolve: com.google.firebase:firebase-firestore:10.2.1
Please someone help me.
The correct version to use for the recently launched beta of Cloud Firestore is 11.4.2. You can declare a dependency on it like so:
compile 'com.google.firebase:firebase-firestore:11.4.2'
All Firebase components should be at the same version so, in your case that would be
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-firestore:11.4.2'
Make sure you have the latest Google Repository in the Android SDK manager, otherwise you won't be able to find this version either :-).
While you're at it you'll need to upgrade to the latest google-services plugin, version 3.1.1.
All of this and more are documented on the setup page. It's worth going through that step by step and checking that your project has all those things even if you have an existing Firebase-enabled app.
classpath 'com.google.gms:google-services:3.1.0'
make sure that your com.google.firebase:firebase-firestore:11.4.2 is meeting the same version preferred by https://firebase.google.com/docs/android/setup
Related
I am trying to setup Firebase in my android project.
Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.
Been looking for fixes online, most of them are removing jcenter() in build.gradle file. I don't have jcenter() or any other repository in my build.gradle.
Heres my build gradle project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build gradle module (app):
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.pabhelhasan.autowebpagerefresher2022"
minSdk 22
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '32.0.0'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.6.0-alpha01'
implementation 'com.getbase:floatingactionbutton:1.10.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Try to go to tools tab and firebase section, that will open chrome console.firebase.google.com and u connect it automatically with all the modules and imports.
Because gradle has changed and firebase didn't update the instructions, so it will not work they way you tried.
I wish to develop a chat app using firebase. However, I can't Connect to Firebase in the assistant pannel. Instead, it shows this error message
Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.
I tried searching up for fix online people suggest to delete jCenter() from gradle but i don't even have this code in my file. I was able to sync my project everything seems to work fine except i couldn't connect to it.
Project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module gradle
plugins {
id 'com.android.application'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
android {
compileSdk 32
defaultConfig {
applicationId "android.exercise.myExercise"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
manifestPlaceholders = [MAPS_API_KEY: "${properties.getProperty('secret-apiKey')}"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.google.android.gms:play-services-maps:18.0.1'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'com.google.android.material:material:1.6.0-alpha01'
implementation 'com.github.VishnuSivadasVS:Advanced-HttpURLConnection:1.2'
implementation 'com.google.android.gms:play-services-maps:18.0.2'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// chat sys
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
}
It's a little late, but I can still help. I had the same problem. And I solved the problem
File>Project Specture>Modules
or
Ctrl+Alt+Shift+S >Modules
Compile sdk Version: 32 or latest version
Build Tools Version: 32.0.0 or latest version
then click Apply button
then click OK button
and the problem will be solved.
Sorry for my english, i don't know english.
Add MAVEN in Project gradle:
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // Add this repository
}
I am using the latest version of Android Studio and all plugins. I am trying to connect android app to firebase console. Successfully downloaded google-services.json file and added to module root directory. Added lines "classpath 'com.google.gms: google-services: 4.3.3" and "apply plugin:' com.google.gms.google-services'" to the build.gradle files.
build.gradle project level:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
build.gradle app level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "app"
minSdkVersion 16
targetSdkVersion 29
versionCode 42
versionName "16.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// CloudPayments SDK
implementation 'ru.cloudpayments.android:sdk:1.0.5'
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-iid:20.2.4'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
}
apply plugin: 'com.google.gms.google-services'
When synchronizing the project, I get the error
No such property: applicationVariants for class: java.lang.String
which refers to the line "apply plugin: 'com.google.gms.google-services'" in build.gradle app level.
I ask for advice on how you can fix this error.
I solved this by checking all my gradle files and found out that, the gradle.properties file has some errors in it. I don’t know how they got there. But I replaced the file contents by copying the contents from a fresh android project.
Solved
I have an android studio project that includes one module for my app and one module for my backend.
According to the documentation I can use the following code to bring all the build endpoint libraries to my app module:
endpointsServer project(path: ':backend', configuration: 'endpoints')
In my backend module gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.3'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.5'
}
}
repositories {
jcenter(); }
apply plugin: 'java' apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
implementation 'com.google.endpoints:endpoints-framework:2.0.14'
implementation 'javax.servlet:servlet-api:2.5'
implementation 'javax.inject:javax.inject:1'
implementation 'com.google.firebase:firebase-admin:5.11.0'
}
appengine {
deploy {
stopPreviousVersion = false
promote = false
version = '1'
project = 'project-name'
} }
In my app module gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
}
}
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "appID"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1"
multiDexEnabled = true
resConfigs "en", "fr"
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
debuggable false
}
debug {
signingConfig null
}
}
}
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.2#aar') {
transitive = true;
}
implementation('com.firebaseui:firebase-ui-auth:3.3.1')
implementation 'com.google.firebase:firebase-core:15.0.2'
endpointsServer project(path: ':backend', configuration: 'endpoints')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.api-client:google-api-client-android:1.23.0'
implementation 'com.google.http-client:google-http-client-android:1.23.0'
implementation 'com.google.http-client:google-http-client-gson:1.23.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.android.gms:play-services-gcm:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.5'
testImplementation 'junit:junit:4.12'
}
configurations {
all {
exclude module: 'httpclient'
}
}
apply plugin: 'com.google.gms.google-services'
The problem is that when gradle is executing is causing the following error:
All firebase libraries must be either above or below 14.0.0
I have already looked at:
How to add firebase-admin to my android project?
and
android firebase admin sdk error 'All firebase libraries must be either above or below 14.0.0' [duplicate]
But both of them are trying to add the admin sdk on client side. Which is not why I am trying to do.
So how can I tell gradle that this are two different modules or how can I exclude the admin sdk from coming to my app module when I am using:
endpointsServer project(path: ':backend', configuration: 'endpoints')
I was trying to configure my test cases in VSapp center, my tests are written in appium. Followed the following steps:
Step 1# Added the JCenter repository enabled in the build.gradle in my project's root folder. build.gradle file is like following
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Step 2# Added the androidTestCompile('com.microsoft.appcenter:appium-test-extension:1.0') in build.gradle file inside app folder
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.keya.myapplication"
minSdkVersion 15
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'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestCompile('com.microsoft.appcenter:appium-test-extension:1.0')
def appCenterSdkVersion = '1.1.0'
compile "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
compile "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'org.assertj:assertj-core:2.0.0'
testCompile 'org.testng:testng:6.8.8'
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-collections-3.2.1.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-exec-1.3.jar')
compile files('libs/commons-lang3-3.4.jar')
compile files('libs/commons-logging-1.1.3.jar')
compile files('libs/commons-validator-1.4.1.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/guava-18.0.jar')
compile files('libs/httpclient-4.4.1.jar')
compile files('libs/httpcore-4.4.1.jar')
compile files('libs/httpmime-4.4.1.jar')
compile 'com.android.support:support-annotations:25.0.1'
compile group: 'com.beust', name: 'jcommander', version: '1.27'
testCompile 'info.cukes:cucumber-java:1.2.5'
testCompile 'info.cukes:cucumber-junit:1.2.5'
testCompile 'info.cukes:cucumber-picocontainer:1.2.2'
compile 'com.android.support:support-v4:25.0.1'
}
apply plugin: 'maven'
task createPom {
pom {
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.testCompile.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
def profilesNode = asNode().appendNode('profiles')
profilesNode.append(new XmlParser().parse('https://raw.githubusercontent.com/Microsoft/AppCenter-Test-Appium-Java-Extensions/master/gradleuploadprofilesnippet.xml'))
}
}.writeTo("pom.xml")}
within this step, everything was successful build was successful but when I was trying to import the following libs
import com.microsoft.appcenter.appium.Factory;
import com.microsoft.appcenter.appium.EnhancedAndroidDriver;
Application failed to import
Step3# I also tried to import the libs using mvn --> This step didnt work.
Application is showing Can not resolve symbol message
Can any one suggest me the solution?
Found the solution of the problem, just simply added the jar as library in build path and its working fine