Error:Cause: buildToolsVersion is not specified in build.grade (Project:xxx) - android

Right now I am trying to integrate Fabric with Crashlytics (https://docs.fabric.io/android/fabric/integration.html) into an existing android application.
Following the integration instructions provided by Fabric I add apply plugin: 'com.android.application' to the root directory of my "build.grade (Project.NumenuApp)" file. I click to Sync Gradle, it fails, and I receive this error Error:Cause: buildToolsVersion is not specified. Android studio states that my plugins should be declared at the Module not Project level.
I already have the buildTools set in the "build.grade (Module:app)" file. My question is why is this happening and what can I do to remedy it? I have posted my code below. Thanks in advance. - Adrian
build.grade (Project:NumenuApp)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.grade (Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.numenu.numenuapp"
minSdkVersion 21
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:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
}

You have to remove these lines from your build.gradle (Project:NumenuApp). You are using the wrong file to apply the plugins.
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
Also move these lines in your build.gradle (Module:app)
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

this is my build.gradle(Module:app) file and I have a working CrashLytics, and I have nothing related to fabrics in my project.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'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
//apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.ws.cs"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
packagingOptions {
exclude "/lib/arm64-v8a/librealm-jni.so"
}
}
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.google.code.gson:gson:2.2.2'
compile 'io.realm:realm-android:0.82.1'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
}

Please check this line in your app.gradle present or not
buildToolsVersion "25.0.3"
Example
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "kc.care.task"
minSdkVersion 20
targetSdkVersion 25
versionCode 23
versionName "3.7"
multiDexEnabled = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}

Related

Retrolambda Error:Cannot get property 'destinationDir' on null object

I am trying to use retrolambda in my application but I face issues
build.gradle project
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle app
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "psystem.co.reaya"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
jackOptions {
enabled true
}
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
incremental true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:+'
compile 'com.android.support:multidex:1.0.1'
}
my tries to fix the issue remove jack options , I got this error `org.gradle.execution.TaskSelectionException: Task ',' not found in root project 'Reaya'.`
any one can help me to fix my issue
thank you
1.update the Android studio to 2.1 or higher version;
2.delete the "apply plugin: 'me.tatarka.retrolambda'"
Try it!
removing the lines apply plugin: 'me.tatarka.retrolambda' worked for me.
Might stick to retrolambda. Some discussions on jack can be found here

How to fix "Error:Error:line (23)Gradle DSL method not found: 'android()"

I was working on my project in Android Studio on Windows but now I am trying to open it on Ubuntu but it keeps complaining that:
Error:Error:line (23)Gradle DSL method not found: 'android()' Possible causes: //(Error23,0)
The project 'POSTER' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
The build file may be missing a Gradle plugin. Apply Gradle plugin
Project 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.1.2'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 23
buildToolsVersion '24.0.0'
}
App Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.ozuf.poster"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName "0.5 Beta"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(':volley')
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'org.jsoup:jsoup:1.9.1'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'ch.acra:acra:4.9.0-RC-2'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-ads:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
Gradle-wrapper.properties
#Fri Apr 08 19:27:52 WAT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
Please, do you have any idea what's causing this and how to fix it?
delete android settings in project gradle
android {
compileSdkVersion 23
buildToolsVersion '24.0.0'
}
if you want to set as common config, you can use is like this:
project gralde:
ext {
compileSdkVersion 23
buildToolsVersion '24.0.0'
}
app gralde:
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.ozuf.poster"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName "0.5 Beta"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

firebase setup on android

I can't setup the updated version of firebase on android studio.
I've created json file of the project on the site firebase and copied it into the project and after coping lines in gradle:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
compile 'com.google.firebase:firebase-core:9.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
I get the following error:
failed to resolve: compile 'com.google.firebase:firebase-core:9.0.0'
How can I fix it?
I had the same problem. If you are using Android studio, you should then update google repository in SDK Manager.
Following is my build.grade(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "package name"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.firebase:firebase-core:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
And this is my build.grade(project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
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()
}
}
Firebase is working based on Google Play Services. So please make sure you have the following sdk tools and they are updated to sync against the library versions of firebase that you are using.
SDK Tools installed for this project
Project level build.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.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Module Level build.gradle file
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.devdeeds.firebaseauth"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.firebase:firebase-auth:9.2.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}
apply plugin: 'com.google.gms.google-services'

TwitterCore sdk: buildToolsVersion is not specified

I'm trying to add TwitterCore Kit to my android app. I used this in my project level build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
and this in app level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.abhishek.cleartaxtask"
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 project(':volley')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile('com.twitter.sdk.android:twitter-core:1.6.6#aar') {
transitive = true;
}
}
When I sync gradle an error occurs buildToolsVersion is not specified. What am I doing wrong? How to add twitter sdk?
You have to remove these lines from your Build.Gradle (Project:cleartaxtask). You are using the Wrong Gradle to apply the plugins.
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
Also move these lines in your Build.Gradle (Module:app).
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
EDIT 1
For CrashLytics Error add this to your Dependencies.
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
For those who face same problem, add maven dependency at root(project) level build.gradle file.
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
} }

Twitter Kit Fabric Android on module Library Android Studio

I have a problem with Twitter Kit SDK for Android, I need to import Twitter Kit SDK to a library (module) within my project (I'm using Android Studio). I am using Fabric Studio Plugin for Android, to support the implementation, but when implement as shown in the link https://dev.twitter.com/fabric/android/integrating in the library (module), the Gradle not finds and returns me the message "Could not find com.twitter.sdk.android:twitter:1.4.0", then when I implement in my app (module), the import is successful, I can not import through the gradle for a library?
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
android {
signingConfigs {
}
compileSdkVersion 21
buildToolsVersion '20.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile('com.twitter.sdk.android:twitter:1.4.0#aar') {
transitive = true;
}
compile project(':httplib')
}
I created a re-usable twitter component usig fabric
My working gradle look like below
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
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:22.0.0'
compile('com.twitter.sdk.android:twitter:1.3.2#aar') {
transitive = true;
}
}
Once you updated your gradle make sure to sync gradle and finally rebuild the project.Worked well for me.

Categories

Resources