I am trying to use DataBinding in my existing project. As per the documentation I added below lines in app module's build.gradle and compiled the project.
dataBinding {
enabled = true
}
I got the below error:
Could not resolve all dependencies for configuration ':app:devDebugCompileClasspath'.
Could not find com.android.databinding:baseLibrary:3.0.0-alpha3.
Searched in the following locations:
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/google/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/google/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/android/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/android/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
https://jcenter.bintray.com/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
https://jcenter.bintray.com/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
https://jitpack.io/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
https://jitpack.io/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
https://maven.fabric.io/public/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
https://maven.fabric.io/public/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
Required by:
project :app
Could not find com.android.databinding:baseLibrary:3.0.0-alpha3.
Searched in the following locations:
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/google/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/google/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/android/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
file:/C:/Users/incnayak/AppData/Local/Android/sdk/extras/android/m2repository/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
https://jcenter.bintray.com/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
https://jcenter.bintray.com/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
https://jitpack.io/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
https://jitpack.io/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
https://maven.fabric.io/public/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.pom
https://maven.fabric.io/public/com/android/databinding/baseLibrary/3.0.0-alpha3/baseLibrary-3.0.0-alpha3.jar
Required by:
project :app > com.android.databinding:library:1.3.1
project :app > com.android.databinding:adapters:1.3.1
Can anybody help me in solving this? I am using Android Studio 3.0 Canary 3.
My project level gradle
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
classpath 'com.google.firebase:firebase-plugins:1.1.0'
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
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()
maven { url 'https://jitpack.io' }
}
}
App level gradle
buildscript {
dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply from: "../constants.gradle"
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion project.ext.compileSdk
buildToolsVersion "${project.ext.buildtools}"
signingConfigs {
config {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
// Data Binding Library
dataBinding {
enabled = true
}
defaultConfig {
applicationId "com.chanse.cee2048"
minSdkVersion project.ext.minSdk
targetSdkVersion project.ext.targetSdk
versionCode versionCodeNo
versionName versionNameMajor + "." + versionNameMinor + "." + versionNamePatch + "." + versionNameBuild
vectorDrawables.useSupportLibrary = true
versionNameSuffix ' (Beta)'
signingConfig signingConfigs.config
}
buildTypes {
release {
// debuggable true
// shrinkResources true
signingConfig signingConfigs.config
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
signingConfig signingConfigs.config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "chanse"
productFlavors {
dev {
applicationIdSuffix '.debug'
minSdkVersion project.ext.minSdkDebug
// Build only for english and xxhdpi density
resConfigs ("en", "xxhdpi")
// Have a different application name for dev version
resValue "string", "app_name", "Chanse Games Dev"
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion project.ext.minSdk
// Have a different application name for dev version
resValue "string", "app_name", "Chanse Games"
}
}
return void
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:${project.ext.support_library_version}"
compile "com.android.support:cardview-v7:${project.ext.support_library_version}"
compile "com.android.support:recyclerview-v7:${project.ext.support_library_version}"
compile "com.android.support:design:${project.ext.support_library_version}"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.databinding:library:1.3.1'
implementation 'com.android.databinding:adapters:1.3.1'
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2-4'
apply plugin: 'com.google.gms.google-services'
}
Add these lines to your module-level build.gradle as dependencies; Android Studio 3.0 changed the way it pulls in libraries that you previously downloaded via the SDK manager - https://developer.android.com/studio/build/dependencies.html#google-maven
implementation 'com.android.databinding:library:1.3.1'
implementation 'com.android.databinding:adapters:1.3.1'
You may not need the second line, depending on how you use data binding.
Instead of implementation, you can also use the old compile. Using implementation will avoid build warnings going forward; it's a part of the new Gradle Java library plugin that the Android Gradle plugin uses by default now.
You will also need to add something like the following (typically in your module-level build.gradle) if you don't have it yet - this adds Google's new Maven repository for Android dependencies:
repositories {
maven {
url 'https://maven.google.com'
}
}
Related
I have a capacitor app and I'm trying to implement the Firebase Distribution with Gradle (https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=1&apptype=aab) but I'm stuck at this error:
No signature of method: build_clqfykx9rkn9m9ygw4eh6w1bu.android() is applicable for argument types: (build_clqfykx9rkn9m9ygw4eh6w1bu$_run_closure1) values: [build_clqfykx9rkn9m9ygw4eh6w1bu$_run_closure1#60526ded]
I've did all the steps of the process and my build.gradle files look like this:
build.gradle:
// 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:4.2.1'
classpath 'com.google.gms:google-services:4.3.5'
// Add the App Distribution Gradle plugin
classpath 'com.google.firebase:firebase-appdistribution-gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply from: "variables.gradle"
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle:
apply plugin: 'com.android.application'
// Apply the App Distribution Gradle plugin
apply plugin: 'com.google.firebase.appdistribution'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.some.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName project.hasProperty('version') ? version : '1.0.0'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
flavorDimensions "environment"
productFlavors {
appA {
dimension "environment"
manifestPlaceholders = [displayName:"App A"]
}
appB {
dimension "environment"
applicationIdSuffix ".amigdala"
manifestPlaceholders = [displayName:"App B"]
}
}
signingConfigs {
release {
storeFile file("app-keystore.jks")
storePassword System.getenv("KSTOREPWD")
keyAlias "mykey"
keyPassword System.getenv("KEYPWD")
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
// https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=1&apptype=aab
firebaseAppDistribution {
serviceCredentialsFile "./service-account-key-distribution.json"
artifactType "AAB"
archivePath System.getenv("ARCHIVE_PATH")
releaseNotes "Change this before releasing in production!"
}
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
of course, everything worked until I added this part:
// https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=1&apptype=aab
firebaseAppDistribution {
serviceCredentialsFile "./service-account-key-distribution.json"
artifactType "AAB"
archivePath System.getenv("ARCHIVE_PATH")
releaseNotes "Change this before releasing in production!"
}
I'm very new at modifying build.gradle files so I guess is sometihng syntax related but I can't figure it out. Even if I make small changes like artifactType "AAB" -> artifactType="AAB" I keep bouncing from this error to this one: Task 'appDistributionUploadRelease' not found in root project 'android'.
Any help or leads will be apreciated, thank you.
No signature for method : build.android... Seams to appear when there's something wrong with you Gradle configuration, like missing properties in the firebaseAppDistribution property or wrong file paths. Once I fixed that i had the Task 'appDistributionUploadRelease' not found in root project 'android' problem, which I solved (by pure luck) changing the appDistributionUploadRelease command for appDistributionUploadAppARelease. It seems the task doesn't have a generic command and the flavour must be specified.
Since I updated my project on the new Android Studio 3.4 Canary 4, the gradle sync failed because:
ERROR: variant.getApplicationId() is not supported by feature plugins as it cannot handle delayed setting of the application ID. Please use getApplicationIdTextResource() instead.
Affected Modules: base
I was previously on Canary 3 and it worked perfectly.
The project is a multi feature app including an instant-app.
Gradle version is gradle-5.0-milestone-1-all
My project level build.gradle
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
compileSdkVersion = 28
minSdkVersion = 16
targetSdkVersion = 28
appVersionCode = 5
appVersion = "2.0.0-dev01"
}
base build.gradle
apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'
apply plugin: 'androidx.navigation.safeargs'
android {
def yo = rootProject
compileSdkVersion yo.compileSdkVersion
baseFeature true
defaultConfig {
minSdkVersion yo.minSdkVersion
targetSdkVersion yo.targetSdkVersion
versionCode yo.appVersionCode
versionName yo.appVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
}
buildTypes {
debug {
testCoverageEnabled !project.hasProperty('android.injected.invoked.from.ide')
multiDexKeepFile file('multidex-config.txt')
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
multiDexKeepFile file('multidex-config.txt')
}
}
dataBinding {
enabled = true
}
lintOptions {
disable "InvalidPackage"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
mavenCentral()
google()
}
dependencies {
application project(':app')
feature project(':module1')
[...]
}
app build.gradle
apply plugin: 'com.android.application'
android {
def yo = rootProject
compileSdkVersion yo.compileSdkVersion
defaultConfig {
applicationId "com.package.name"
minSdkVersion yo.minSdkVersion
targetSdkVersion yo.targetSdkVersion
versionCode yo.appVersionCode
versionName yo.appVersion
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix ".dev"
splits.abi.enable = false
splits.density.enable = false
aaptOptions.cruncherEnabled = false
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(':module1')
implementation project(':base')
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
I tried to sync my project without dependencies but it doest work too.
I also tried to invalidate caches and restart but no effects.
According to the error log, the problem is in the base build.gradle file but I have no idea what is the problem.
Thank you in advance for your help!
Ok I founded the problem.
This is the safe args navigation plugin thats failed.
apply plugin: 'androidx.navigation.safeargs'
If I remove this line, the project is able to sync but not to build cause to classes missing from navigation safeargs.
There is a bug in the navigation plugin in Android Studio 3.4 Canary 4 applied in a baseFeature build.gradle file.
I will post a new question for that.
For anyone who have a similar issue make sure all dependencies in your project-level build.gradle are up-to-date.
For example, I had this issue when my version of google-services plugin was outdated:
buildscript {
repositories {
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.0.1'
}
}
After updating to the latest version the issue was resolved:
buildscript {
repositories {
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.2.0'
}
}
I am implementing FCM into my android project using Cordova
When I build my project I am getting error "Could not find method implementation() for arguments [com.google.firebase:firebase-core:16.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
"
Here is my build.gradle file code inside app directory
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
implementation 'com.google.firebase:firebase-core:16.0.0' // Error generating line
}
}
You should write your repositories and dependencies in sequence manner which is suggested by Firebase.
Your build.gradle of project lavel should look like this, path of the file is just inside the project.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'Fabric URL'
}
}
dependencies {
classpath 'com.google.gms:google-services:3.3.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "JIT PACK URL"
}
maven {
url 'MAVEN URL'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And after that your app level build.gradle should look like this, path of the file is inside the app. C:\Users\ABC\DEF\Project Name\app\build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
flavorDimensions "versionCode"
defaultConfig {
applicationId "App Package Name as "com.companyName.appName""
minSdkVersion 19
targetSdkVersion 27
multiDexEnabled true
versionCode 15
versionName "1.0.12"
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// firebase push notifications
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
// firebase remote config
implementation 'com.google.firebase:firebase-config:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
If this not help for you you then try to change all the version of firebase and firebase remote config to latest version.
Because sometimes different version may cause problem.
I have an app using Android Annotations and everything is working fine except one thing - you cannot install both flavors on the same device despite the fact that they have different applicationId.
Researching this I came across some problems (that other people had) with annotation processing and flavors, and as I recall this was an issue also here, but we've manage to add following snippet and everything worked.
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
Until the other day we've didn't notice, that we couldn't install two flavors at once on one device. I've tried changing the gradle but every time I've ended up with the same problem or breaking the gradle script.
As I've mentioned, I've tried all things that I could think of and the online search didn't turn up anything useful, so if anybody have any idea I'll appreciate it.
Following there are my build.gradle scripts.
Top level:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:2.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App module level:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'android-apt'
android {
signingConfigs {
config {
keyAlias 'release'
keyPassword 'keyPassword'
storeFile file('../storeFile.jks')
storePassword 'storePassword'
}
}
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "some.awsome.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
signingConfig signingConfigs.config
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
productFlavors {
COGNICARE_personal {
applicationId "some.awsome.app.free"
}
COGNICARE_full {
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
repositories {
flatDir {
dirs 'libs'
}
maven { url "https://jitpack.io" }
mavenCentral()
}
def android_annotations_version = '3.3.2'
def google_libs_version = '23.3.0'
//some lib versions omitted
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//some aar lib omitted
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$google_libs_version"
apt "org.androidannotations:androidannotations:$android_annotations_version"
compile "org.androidannotations:androidannotations-api:$android_annotations_version"
//some libs omitted
compile 'com.android.support:multidex:1.0.0'
//some libs omitted
}
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
resourcePackageName android.defaultConfig.applicationId
}
}
Thanks in advance for any suggestion. Kudos!
OK, so thanks to #ligi pointing me to the right track.
We have a similar project with a very similar setup and the main difference are the Android Annotation used in one of them, an that has mislead me.
The bottom line is that I've had a provider in the manifest that I wasn't aware of, and the authority conflict did occur at that point.
Thanks for your time. Kudos.
I'm having a lot of trouble adding databinding to my project. There is a complicated build.gradle. Unfortunately, I cannot post too much from it.
If I add databinding {enabled = true} to my android block in my app build.gradle file I get the following error -->
Error:Cannot change dependencies of configuration ':projectName:compile' after it has been resolved.
Cannot get property 'javaCompile' on null object.
I've added the databinding library on my classpath. If I don't add the dataBinding {enabled = true} block the build succeeds with a warning that generated sources are in the wrong folder.
Any ideas?
Here is my sample build.gradle with databinding enabled. I'm using this setup in my projects and databinding is working fine. Notice that you only need to specify databinding {enabled true}. No more setup is required. You don't have to add databinding to dependencies.
build.gradle from main folder
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
subprojects {
buildscript {
repositories {
jcenter()
mavenCentral()
}
}
repositories {
jcenter()
mavenCentral()
}
}
build.gradle from app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "foo.bar"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//support library
compile 'com.android.support:appcompat-v7:23.1.1'
}