When I tried to migrate my own project to AndroidX, the error message appeared on a error dialog:
The gradle plugin version in your project build.gradle file needs to be set to at least com.android.tools.build:gradle:3.2.0 in order to migrate to AndroidX.
Then I googled this error on the Internet. A site was found that it said classpath 'com.android.tools.build:gradle:3.2.0' has to be added to the build.gradle. Therefore, I added the line to the build.gradle like this:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-core-utils:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
However, the same error happened. Am I missing something?
Check your build.grade of Project level ( Not Module )
And change the version of the android gradle plugin:
buildscript {
...
dependencies {
...
classpath 'com.android.tools.build:gradle:3.4.1' // it should be more than 3.2.0
}
}
Related
The problem is that when I sync a project on Android Studio. I followed all the steps on the Fire base guide, the "ASCII" error occurred.I already paste my google-services.json file is in the app folder.
build.gradle(Project: )
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.anikr.communityapp"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
Add following line to gradle.properties
android.overridePathCheck=true
use classpath 'com.google.gms:google-services:4.2.0'
and remove firebase-analytics dependency.
This resolved my errors.
Add following line to gradle.properties(project properies)
android.overridePathCheck=true
My gradle app.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.prutheus.se"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services:8.3.0'
}
When I want to Run my app in debugger, I get an Error:
Error: Program type already present: android.support.v4.app.BackStackRecord$Op
I have read that it could has something todo with the implementation of com.google.android.gms stuff, but I do not know how to fix that?
Added implementation 'com.google.android.gms:play-services:8.3.0' looks confusing-old.
You're using updated SupportLibrary -> 28 but the play-services seems old.
In your root build.gradle add:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' // and use the updated version
classpath 'com.google.gms:google-services:4.1.0' // add this
..
.
Also make sure about the repositories:
Ensure that your top-level build.gradle contains a reference to the
google() repo or to maven { url "https://maven.google.com" }.
Read Setup Google Play Services.
classpath "com.android.tools.build:gradle:3.4.2"
This is the Soultion :
Go to Build Gradle App And Do this
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.4.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Trying to implement Firebase in my project but implementation 'com.google.firebase:firebase-core:16.0.1' ths line underlined. Please.
Thanks Mbuodile Obiosio but not work, I don't know.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.harun.basicmathquiz"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
AND
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
MY ERROR: All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 16.1.1, 16.0.1, 16.0.0, 15.0.1. Examples include com.google.firebase:firebase-analytics-impl:16.1.1 and com.google.firebase:firebase-analytics:16.0.1
Upgrade the google-service plugin in the top level gradle file, to avoid the mixing version error:
classpath 'com.google.gms:google-services:4.0.1'
https://bintray.com/android/android-tools/com.google.gms.google-services/
I am also faced with the same problem. My problem is solved by doing this
add the following in Gradle
classpath 'com.google.gms:google-services:4.0.1'
And in dependencies
dependencies {
.
.
.
implementation ('com.google.firebase:firebase-database:16.0.1') {
exclude group: "com.google.android.gms"
}
}
apply plugin: 'com.google.gms.google-services'
You're mixing versions and that's why you're getting the error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.harun.basicmathquiz"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
Don't forget to update the top level build.gradle file with
classpath 'com.google.gms:google-services:4.0.1'
I am trying to build an app on Android 27 and facing issues when I add android com.android.support:support-v4:27.1.0 and com.google.firebase:firebase-messaging:12.0.1 dependencies.
My Project Gradle file looks like this -
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.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My App build.gradle file looks like this -
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.project.webinar"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.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'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-base:12.0.1'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.google.android.gms:play-services-places:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
I am getting the following error while building on Android Studio 3.1.0 -
Can someone please help me how to get support-v4:27.1.0 to work for my app?
it seems your gradle is offline or you have enable proxy
Andriod Studio 3.3.1
gradle 4.4
I added firebase storage through the Android > Tools > Firebase option. However when I sync the gradle the build fails. This is the error that I'm getting:
Cannot resolve external dependency com.google.gms:google-services:3.2.1
because no repositories are defined. Required by:project :app
Does anyone know how to correct this error?
build.gradle (Module: APP)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.test"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
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'
implementation 'com.android.support:design:27.1.1'
//implementation 'com.google.android.gms:play-services:11.0.4'
}
buildscript {
dependencies {
classpath 'com.google.gms:google-services:3.2.1'
}
}
apply plugin: 'com.google.gms.google-services'
In my case, I have to add below code to project level gradle:
allprojects {
repositories {
google()
jcenter()
}
}
The error indicates that repositories is missing in order to determine from where google-services will be downloaded.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:3.2.1'
}
}
jcenter is a reference to bintray jcenter. Gradle can find the google-services:3.2.1 there.
In my case I was able to get it working by adding another repository scope to the top level.
repositories {
mavenLocal()
mavenCentral()
}
I was inspired to do so by this example.