I'm trying to migrate my app and adding classpath 'com.google.gms:google-services:1.3.0-beta1' breaks the build:
This is my top level gradle.build:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.github.hamsterksu:android-appversion-gradle-plugin:1.2.+'
classpath 'com.google.gms:google-services:1.3.0-beta1'
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
}
}
Doing that fails the build with the following message:
What went wrong:
A problem was found with the configuration of task ':app:zipalignAppDebug'.
File
'/path../outputs/apk/app-app-debug-unaligned.apk' specified for property 'inputFile' does not exist.
i have found these problem too, and i found its because i have using 22 buildtoolsversion
change your buildToolsVersion to version 23, and it will work again
open app/build.gradle
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "packagename.id"
minSdkVersion 15
targetSdkVersion 22
versionCode appVersionCode
versionName appVersionName
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
Related
i tried everything i could think of but i keep getting this error.
this is my gradle build:
buildscript {
repositories {
jcenter()
maven{ url "https://dl.bintray.com/android/android-tools" }
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
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 {
jcenter()
mavenCentral()
maven{url 'https://www.google.com/'}
maven { url "https://dl.bintray.com/android/android-tools" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.textbookexhange"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
my gradle wrapper is fine
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
The reason you are not able to resolve the version 4.0 because the version 4.0 is not available in the JCenter.
https://jcenter.bintray.com/com/android/tools/build/gradle/
Firstly the version 4.0 should be available in your Bintray package in order for it to mirror in the JCenter You can check the same in the below bintray download link:
https://dl.bintray.com/android/android-tools/com/android/tools/build/gradle/
Update the version 4.0 under the path "com/android/tools/build/gradle" in your bintray package so that it will be reflected in the JCenter.
I get below error when I had migrated to Android Studio 3.0 recently.
Error:Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead.
I tried following the steps in:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html but still get the same error.
My build.gradle is as follows:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://maven.google.com' }
}
}
Module's build.gradle is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.example.rakesh"
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dataBinding {
enabled true
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
once having seen the actual build.gradle ...
you need to build with buildToolsVersion '26.0.2' (or later), which is the least required version - while there are no instructions, which would be directly related to the given error message. it's a little strange, that it does not complain about the buildToolsVersion mismatch, in the first place.
the buildscript part does not belong into there (removing that from the module's build.gradle might already be the remedy). also, delete the .gradle and all the build directories, before trying to build.
Make sure you added the new repo in root gradle.build:
repositories {
maven {
url 'https://maven.google.com'
}
}
You may also use with newer Gradle wrapper:
repositories {
maven {
google()
}
}
If you have used data binding in repo, then make sure you have added:
android {
....
dataBinding {
enabled = true
}
}
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:3.0.0'
// 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 version 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'
}
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "//"
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'
}
}
}
and project level
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
actually before i'm using 2.3 gradle at that time there is no error now i changed to 3.0.0-alphs-5 app not installing error. i do appreciate if u solve this error . is it kotlin error or anything different i cant find the solution pls help me(this is happening only while i'm sharing not by debugging through studio)
Try the following
./gradlew --stop
and then go to
File > invalidate caches / restart > invalidate and restart
check your manifest if your MainActivity is duplicated.
I have a problem with Data Binding library for Android.
I have a freshly installed Android Studio v2.0 and newly created project.
The problem is that when I try to add
dataBinding {
enabled = true
}
to my build.gradle, I get this error while trying to build the project:
:app:dataBindingProcessLayoutsDebug FAILED
Error:Execution failed for task ':app:dataBindingProcessLayoutsDebug'.
Could not initialize class android.databinding.parser.XMLLexer
The build.gradle files look like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.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
}
and
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.silgrid.test"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
}
Does anyone know how to fix this?
Thanks.
Updating gradle version in main gradle file has solved this problem for me.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "com.android.databinding:dataBinder:1.0-rc1"
classpath 'com.google.gms:google-services:4.1.0'
}
}
For me it got fixed after updating to Android Studio 2.2
I migrated from eclipse to android studio. I've create a new project and I want to run it on genymotion. When I press run icon, it begins to compile and give me this error :
Error:Gradle: A problem occurred configuring root project 'Khabar'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.1.0.
Required by:
:Khabardar:unspecified
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.1.0/gradle-1.1.0.pom'.
> d29vzk4ow07wi7.cloudfront.net
This is some parts of my build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "example.ir.khabar"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
build.gradle in root :
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "example.ir.khabar"
minSdkVersion 8
targetSdkVersion 20
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 'com.android.support:appcompat-v7:20.0.0'
compile files('libs/universal-image-loader-1.8.4-with-sources.jar')
}
Could you help me? my gradle version is gradle-2.2.1-all
For me, the solution was to add the http url for jcenter, instead of https:
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
In addition to Al's answer, I also had to put the url inside allprojects:
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
I was having the same issue on Ubuntu Mate 18.04. I was able to fix it by replacing ibm-java80-jdk & ibm-java80-jre with openjdk. Also, I did update my DNS to cloudflare DNS. But I don't think it had anything to do with the fix.
add google() in your gradle inside the repositories section will solve your problem..
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}